Skip to content

Commit a26c99b

Browse files
committed
[skip ci] getIconForStatus
1 parent eeeccff commit a26c99b

File tree

2 files changed

+56
-27
lines changed

2 files changed

+56
-27
lines changed

services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,31 @@ qx.Class.define("osparc.form.renderer.PropForm", {
9797
downloading: 2,
9898
uploading: 3,
9999
succeed: 4
100+
},
101+
102+
getIconForStatus: function(status) {
103+
let icon;
104+
switch (status) {
105+
case this.RETRIEVE_STATUS.failed:
106+
icon = this.getFailedAtom();
107+
break;
108+
case this.RETRIEVE_STATUS.empty:
109+
icon = this.getRetrievedEmpty();
110+
break;
111+
case this.RETRIEVE_STATUS.retrieving:
112+
icon = this.getRetrievingAtom();
113+
break;
114+
case this.RETRIEVE_STATUS.downloading:
115+
icon = this.getDownloadingAtom();
116+
break;
117+
case this.RETRIEVE_STATUS.uploading:
118+
icon = this.getUploadingAtom();
119+
break;
120+
case this.RETRIEVE_STATUS.succeed:
121+
icon = this.getSucceededAtom();
122+
break;
123+
}
124+
return icon;
100125
}
101126
},
102127

@@ -591,27 +616,7 @@ qx.Class.define("osparc.form.renderer.PropForm", {
591616
},
592617

593618
__setRetrievingStatus: function(status, portId, idx, row) {
594-
let icon;
595-
switch (status) {
596-
case this.self().RETRIEVE_STATUS.failed:
597-
icon = this.self().getFailedAtom();
598-
break;
599-
case this.self().RETRIEVE_STATUS.empty:
600-
icon = this.self().getRetrievedEmpty();
601-
break;
602-
case this.self().RETRIEVE_STATUS.retrieving:
603-
icon = this.self().getRetrievingAtom();
604-
break;
605-
case this.self().RETRIEVE_STATUS.downloading:
606-
icon = this.self().getDownloadingAtom();
607-
break;
608-
case this.self().RETRIEVE_STATUS.uploading:
609-
icon = this.self().getUploadingAtom();
610-
break;
611-
case this.self().RETRIEVE_STATUS.succeed:
612-
icon = this.self().getSucceededAtom();
613-
break;
614-
}
619+
const icon = this.self().getIconForStatus(status);
615620
icon.key = portId;
616621

617622
// remove first if any

services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ qx.Class.define("osparc.widget.NodeOutputs", {
3838

3939
const grid = new qx.ui.layout.Grid(5, 5);
4040
grid.setColumnFlex(this.self().POS.LABEL, 1);
41-
grid.setColumnFlex(this.self().POS.INFO, 0);
42-
grid.setColumnFlex(this.self().POS.ICON, 0);
4341
grid.setColumnFlex(this.self().POS.VALUE, 1);
44-
grid.setColumnFlex(this.self().POS.UNIT, 0);
45-
grid.setColumnFlex(this.self().POS.PROBE, 0);
4642
grid.setColumnMinWidth(this.self().POS.VALUE, 50);
4743
Object.keys(this.self().POS).forEach((_, idx) => grid.setColumnAlign(idx, "left", "middle"));
4844
const gridLayout = this.__gridLayout = new qx.ui.container.Composite(grid);
@@ -88,7 +84,8 @@ qx.Class.define("osparc.widget.NodeOutputs", {
8884
ICON: 2,
8985
VALUE: 3,
9086
UNIT: 4,
91-
PROBE: 5
87+
PROBE: 5,
88+
RETRIEVE_STATUS: 6,
9289
}
9390
},
9491

@@ -107,7 +104,7 @@ qx.Class.define("osparc.widget.NodeOutputs", {
107104

108105
const label = new qx.ui.basic.Label().set({
109106
rich: true,
110-
value: port.label + " :",
107+
value: port.label,
111108
toolTipText: port.label
112109
});
113110
// leave ``rich`` set to true. Ellipsis will be handled here:
@@ -227,6 +224,33 @@ qx.Class.define("osparc.widget.NodeOutputs", {
227224
infoButton.setVisibility(extendedVersion ? "hidden" : "visible");
228225
grid.setColumnMinWidth(this.self().POS.VALUE, extendedVersion ? 150 : 50);
229226
}
227+
},
228+
229+
setRetrievingStatus: function(portId, status) {
230+
const ports = this.getPorts();
231+
const portKeys = Object.keys(ports);
232+
const idx = portKeys.findIndex(portId);
233+
if (idx === -1) {
234+
return;
235+
}
236+
237+
const icon = osparc.form.renderer.PropForm.getIconForStatus(status);
238+
// remove first if any
239+
let children = this._getChildren();
240+
for (let i=0; i<children.length; i++) {
241+
let child = children[i];
242+
const layoutProps = child.getLayoutProperties();
243+
if (
244+
layoutProps.row === idx &&
245+
layoutProps.column === this.self().POS.RETRIEVE_STATUS
246+
) {
247+
this._remove(child);
248+
}
249+
}
250+
this._addAt(icon, idx, {
251+
idx,
252+
column: this.self().POS.RETRIEVE_STATUS
253+
});
230254
}
231255
}
232256
});

0 commit comments

Comments
 (0)