Skip to content

Commit 6496dc3

Browse files
committed
refactor
1 parent a900da6 commit 6496dc3

File tree

1 file changed

+32
-20
lines changed
  • services/static-webserver/client/source/class/osparc/workbench

1 file changed

+32
-20
lines changed

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

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,19 @@ qx.Class.define("osparc.workbench.NodeUI", {
220220
column: this.self().CAPTION_POS.DEPRECATED
221221
});
222222
break;
223-
case "chips": {
223+
case "middle-container":
224224
control = new qx.ui.container.Composite(new qx.ui.layout.Flow(3, 3).set({
225225
alignY: "middle"
226226
})).set({
227-
margin: [3, 4]
227+
padding: [3, 4]
228228
});
229+
this.add(control, {
230+
row: 0,
231+
column: 1
232+
});
233+
break;
234+
case "node-type-chip": {
235+
control = new osparc.ui.basic.Chip();
229236
let nodeType = this.getNode().getMetaData().type;
230237
if (this.getNode().isIterator()) {
231238
nodeType = "iterator";
@@ -234,32 +241,34 @@ qx.Class.define("osparc.workbench.NodeUI", {
234241
}
235242
const type = osparc.service.Utils.getType(nodeType);
236243
if (type) {
237-
const chip = new osparc.ui.basic.Chip().set({
244+
control.set({
238245
icon: type.icon + "14",
239246
toolTipText: type.label
240247
});
241-
control.add(chip);
242248
}
243-
const nodeStatus = new osparc.ui.basic.NodeStatusUI(this.getNode());
244-
control.add(nodeStatus);
245-
const statusLabel = nodeStatus.getChildControl("label");
249+
this.getChildControl("middle-container").add(control);
250+
break;
251+
}
252+
case "node-status-ui": {
253+
control = new osparc.ui.basic.NodeStatusUI(this.getNode()).set({
254+
maxHeight: 20,
255+
font: "text-10",
256+
});
257+
const statusLabel = control.getChildControl("label");
246258
const requestOpenLogger = () => this.fireEvent("requestOpenLogger");
247259
const evaluateLabel = () => {
248260
const failed = statusLabel.getValue() === "Unsuccessful";
249261
statusLabel.setCursor(failed ? "pointer" : "auto");
250-
if (nodeStatus.hasListener("tap")) {
251-
nodeStatus.removeListener("tap", requestOpenLogger);
262+
if (control.hasListener("tap")) {
263+
control.removeListener("tap", requestOpenLogger);
252264
}
253265
if (failed) {
254-
nodeStatus.addListener("tap", requestOpenLogger);
266+
control.addListener("tap", requestOpenLogger);
255267
}
256268
};
257269
evaluateLabel();
258270
statusLabel.addListener("changeValue", evaluateLabel);
259-
this.add(control, {
260-
row: 0,
261-
column: 1
262-
});
271+
this.getChildControl("middle-container").add(control);
263272
break;
264273
}
265274
case "progress":
@@ -293,16 +302,19 @@ qx.Class.define("osparc.workbench.NodeUI", {
293302
});
294303
this.resetThumbnail();
295304

296-
this.__createWindowLayout();
305+
this.__createContentLayout();
297306
},
298307

299-
__createWindowLayout: function() {
308+
__createContentLayout: function() {
300309
const node = this.getNode();
310+
if (node) {
311+
this.getChildControl("middle-container").removeAll();
312+
this.getChildControl("node-type-chip");
313+
this.getChildControl("node-status-ui");
301314

302-
this.getChildControl("chips").show();
303-
304-
if (node.isComputational() || node.isFilePicker() || node.isIterator()) {
305-
this.getChildControl("progress").show();
315+
if (node.isComputational() || node.isFilePicker() || node.isIterator()) {
316+
this.getChildControl("progress");
317+
}
306318
}
307319
},
308320

0 commit comments

Comments
 (0)