Skip to content

Commit 05c9f1b

Browse files
committed
[skip ci] more refactoring
1 parent 81916b8 commit 05c9f1b

File tree

4 files changed

+20
-27
lines changed

4 files changed

+20
-27
lines changed

services/static-webserver/client/source/class/osparc/dashboard/ResourceDetails.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
431431
if (
432432
osparc.utils.Resources.isService(resourceData) ||
433433
!osparc.product.Utils.showStudyPreview() ||
434-
osparc.data.model.Study.getUiMode(resourceData) === "app"
434+
osparc.study.Utils.getUiMode(resourceData) === "app"
435435
) {
436436
// there is no pipelining or don't show it
437437
return null;

services/static-webserver/client/source/class/osparc/data/model/Study.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -301,20 +301,6 @@ qx.Class.define("osparc.data.model.Study", {
301301
return false;
302302
},
303303

304-
hasSlideshow: function(studyData) {
305-
if ("ui" in studyData && "slideshow" in studyData["ui"] && Object.keys(studyData["ui"]["slideshow"]).length) {
306-
return true;
307-
}
308-
return false;
309-
},
310-
311-
getUiMode: function(studyData) {
312-
if ("ui" in studyData && "mode" in studyData["ui"]) {
313-
return studyData["ui"]["mode"];
314-
}
315-
return null;
316-
},
317-
318304
getOutputValue: function(studyData, nodeId, portId) {
319305
if ("workbench" in studyData &&
320306
nodeId in studyData["workbench"] &&
@@ -354,17 +340,6 @@ qx.Class.define("osparc.data.model.Study", {
354340
"RETRY"
355341
].includes(state);
356342
},
357-
358-
__isAnyLinkedNodeMissing: function(studyData) {
359-
const existingNodeIds = Object.keys(studyData["workbench"]);
360-
const linkedNodeIds = osparc.data.model.Workbench.getLinkedNodeIds(studyData["workbench"]);
361-
const allExist = linkedNodeIds.every(linkedNodeId => existingNodeIds.includes(linkedNodeId));
362-
return !allExist;
363-
},
364-
365-
isCorrupt: function(studyData) {
366-
return this.__isAnyLinkedNodeMissing(studyData);
367-
},
368343
},
369344

370345
members: {

services/static-webserver/client/source/class/osparc/desktop/MainPageHandler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ qx.Class.define("osparc.desktop.MainPageHandler", {
103103
}
104104

105105
// check if it's corrupt
106-
if (osparc.data.model.Study.isCorrupt(studyData)) {
106+
if (osparc.study.Utils.isCorrupt(studyData)) {
107107
const msg = `${qx.locale.Manager.tr("We encountered an issue with the")} ${studyAlias} <br>${qx.locale.Manager.tr("Please contact support.")}`;
108108
throw new Error(msg);
109109
}

services/static-webserver/client/source/class/osparc/study/Utils.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ qx.Class.define("osparc.study.Utils", {
2323
type: "static",
2424

2525
statics: {
26+
__isAnyLinkedNodeMissing: function(studyData) {
27+
const existingNodeIds = Object.keys(studyData["workbench"]);
28+
const linkedNodeIds = osparc.data.model.Workbench.getLinkedNodeIds(studyData["workbench"]);
29+
const allExist = linkedNodeIds.every(linkedNodeId => existingNodeIds.includes(linkedNodeId));
30+
return !allExist;
31+
},
32+
33+
isCorrupt: function(studyData) {
34+
return this.__isAnyLinkedNodeMissing(studyData);
35+
},
36+
2637
extractServices: function(workbench) {
2738
const services = [];
2839
Object.values(workbench).forEach(srv => {
@@ -270,6 +281,13 @@ qx.Class.define("osparc.study.Utils", {
270281
return Boolean("debt" in studyData && studyData["debt"] < 0);
271282
},
272283

284+
getUiMode: function(studyData) {
285+
if ("ui" in studyData && "mode" in studyData["ui"]) {
286+
return studyData["ui"]["mode"];
287+
}
288+
return null;
289+
},
290+
273291
__getBlockedState: function(studyData) {
274292
if (studyData["workbench"]) {
275293
const unaccessibleServices = osparc.study.Utils.getInaccessibleServices(studyData["workbench"])

0 commit comments

Comments
 (0)