Skip to content

Commit d7242d4

Browse files
committed
Chips on Update
1 parent ad4a639 commit d7242d4

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

services/static-webserver/client/source/class/osparc/metadata/ServicesInStudyUpdate.js

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,23 @@ qx.Class.define("osparc.metadata.ServicesInStudyUpdate", {
2727
UPDATE_BUTTON: Object.keys(osparc.metadata.ServicesInStudy.GRID_POS).length+2
2828
},
2929

30-
colorVersionLabel: function(versionLabel, metadata) {
30+
paintChip: function(versionChip, metadata) {
3131
const isDeprecated = osparc.service.Utils.isDeprecated(metadata);
3232
const isRetired = osparc.service.Utils.isRetired(metadata);
3333
if (isDeprecated) {
34-
versionLabel.set({
35-
textColor: "text-on-warning", // because the background is always yellow
36-
backgroundColor: osparc.service.StatusUI.getColor("deprecated"),
34+
versionChip.set({
35+
statusColor: osparc.ui.basic.Chip.STATUS.WARNING,
3736
toolTipText: qx.locale.Manager.tr("This service is deprecated. Please update.")
3837
});
3938
} else if (isRetired) {
40-
versionLabel.set({
41-
textColor: "text-on-warning", // because the background is always red
42-
backgroundColor: osparc.service.StatusUI.getColor("retired"),
39+
versionChip.set({
40+
statusColor: osparc.ui.basic.Chip.STATUS.ERROR,
4341
toolTipText: qx.locale.Manager.tr("This service has been retired. Please update.")
4442
});
43+
} else {
44+
versionChip.set({
45+
statusColor: osparc.ui.basic.Chip.STATUS.SUCCESS,
46+
});
4547
}
4648
}
4749
},
@@ -157,16 +159,18 @@ qx.Class.define("osparc.metadata.ServicesInStudyUpdate", {
157159
i++;
158160
const node = workbench[nodeId];
159161
const metadata = osparc.store.Services.getMetadata(node["key"], node["version"]);
160-
const currentVersionLabel = new qx.ui.basic.Label(osparc.service.Utils.extractVersionDisplay(metadata)).set({
162+
const currentVersionChip = new osparc.ui.basic.Chip(osparc.service.Utils.extractVersionDisplay(metadata));
163+
currentVersionChip.getChildControl("label").set({
161164
font: "text-14"
162165
});
163-
this.self().colorVersionLabel(currentVersionLabel, metadata);
164-
this._servicesGrid.add(currentVersionLabel, {
166+
this.self().paintChip(currentVersionChip, metadata);
167+
this._servicesGrid.add(currentVersionChip, {
165168
row: i,
166169
column: this.self().GRID_POS.CURRENT_VERSION
167170
});
168171

169-
const compatibleVersionLabel = new qx.ui.basic.Label().set({
172+
const compatibleVersionChip = new osparc.ui.basic.Chip();
173+
compatibleVersionChip.getChildControl("label").set({
170174
font: "text-14"
171175
});
172176
const latestCompatible = osparc.store.Services.getLatestCompatible(node["key"], node["version"]);
@@ -178,16 +182,18 @@ qx.Class.define("osparc.metadata.ServicesInStudyUpdate", {
178182
if (node["key"] !== latestMetadata["key"]) {
179183
label = latestMetadata["name"] + ":" + label;
180184
}
181-
compatibleVersionLabel.setValue(label);
185+
compatibleVersionChip.setLabel(label);
186+
this.self().paintChip(compatibleVersionChip, latestMetadata);
182187
})
183188
.catch(err => console.error(err));
184189
} else if (metadata) {
185190
// up to date
186-
compatibleVersionLabel.setValue(metadata["version"]);
191+
compatibleVersionChip.setLabel(metadata["version"]);
192+
this.self().paintChip(compatibleVersionChip, metadata);
187193
} else {
188-
compatibleVersionLabel.setValue(this.tr("Unknown"));
194+
compatibleVersionChip.setLabel(this.tr("Unknown"));
189195
}
190-
this._servicesGrid.add(compatibleVersionLabel, {
196+
this._servicesGrid.add(compatibleVersionChip, {
191197
row: i,
192198
column: this.self().GRID_POS.COMPATIBLE_VERSION
193199
});

0 commit comments

Comments
 (0)