Skip to content

Commit 81541a2

Browse files
committed
isUnknown
1 parent fa2b61e commit 81541a2

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,10 @@ qx.Class.define("osparc.data.model.Node", {
272272
return (metadata && metadata.type && metadata.type === "computational");
273273
},
274274

275+
isUnknown: function(metadata) {
276+
return (metadata && metadata.key && metadata.key === osparc.store.Services.UNKNOWN_SERVICE_KEY);
277+
},
278+
275279
isUpdatable: function(metadata) {
276280
return osparc.service.Utils.isUpdatable(metadata);
277281
},
@@ -404,6 +408,10 @@ qx.Class.define("osparc.data.model.Node", {
404408
return osparc.data.model.Node.isComputational(this.getMetaData());
405409
},
406410

411+
isUnknown: function() {
412+
return osparc.data.model.Node.isUnknown(this.getMetaData());
413+
},
414+
407415
isUpdatable: function() {
408416
return osparc.data.model.Node.isUpdatable(this.getMetaData());
409417
},

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,22 @@ qx.Class.define("osparc.data.model.NodeUnknown", {
3636
// but keep the original key and version
3737
if (key && version) {
3838
this.set({
39-
key: key || metadata["key"],
40-
version: version || metadata["version"],
39+
key,
40+
version,
4141
});
4242
}
4343
},
4444

4545
members: {
46+
// override
47+
serialize: function() {
48+
/*
49+
if (this.getKey() === osparc.store.Services.UNKNOWN_SERVICE_KEY) {
50+
return null;
51+
}
52+
*/
53+
54+
return this.base(arguments);
55+
}
4656
}
4757
});

services/static-webserver/client/source/class/osparc/workbench/NodeUI.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ qx.Class.define("osparc.workbench.NodeUI", {
105105
},
106106

107107
type: {
108-
check: ["normal", "file", "parameter", "iterator", "probe"],
109-
init: "normal",
108+
check: ["computational", "dynamic", "file", "parameter", "iterator", "probe", "unknown"],
109+
init: null,
110110
nullable: false,
111111
apply: "__applyType"
112112
},
@@ -321,7 +321,11 @@ qx.Class.define("osparc.workbench.NodeUI", {
321321
converter: val => val === null ? 0 : val
322322
});
323323
}
324-
if (node.isFilePicker()) {
324+
if (node.isComputational()) {
325+
this.setType("computational");
326+
} else if (node.isDynamic()) {
327+
this.setType("dynamic");
328+
} else if (node.isFilePicker()) {
325329
this.setType("file");
326330
} else if (node.isParameter()) {
327331
this.setType("parameter");
@@ -330,6 +334,8 @@ qx.Class.define("osparc.workbench.NodeUI", {
330334
this.setType("iterator");
331335
} else if (node.isProbe()) {
332336
this.setType("probe");
337+
} else if (node.isUnknown()) {
338+
this.setType("unknown");
333339
}
334340
this.addListener("resize", () => {
335341
setTimeout(() => this.fireEvent("updateNodeDecorator"), 50);
@@ -468,6 +474,9 @@ qx.Class.define("osparc.workbench.NodeUI", {
468474
case "probe":
469475
this.__turnIntoProbeUI();
470476
break;
477+
case "unknown":
478+
this.__turnIntoUnknownUI();
479+
break;
471480
}
472481
},
473482

@@ -585,6 +594,15 @@ qx.Class.define("osparc.workbench.NodeUI", {
585594
this.__setProbeValue(linkLabel);
586595
},
587596

597+
__turnIntoUnknownUI: function() {
598+
const width = 150;
599+
this.__setNodeUIWidth(width);
600+
601+
const chipContainer = this.getChildControl("chips");
602+
chipContainer.add();
603+
this.fireEvent("updateNodeDecorator");
604+
},
605+
588606
__checkTurnIntoIteratorUI: function() {
589607
const outputs = this.getNode().getOutputs();
590608
const portKey = "out_1";

0 commit comments

Comments
 (0)