Skip to content

Commit f9e2bff

Browse files
committed
refactor
1 parent a44f460 commit f9e2bff

File tree

4 files changed

+51
-11
lines changed

4 files changed

+51
-11
lines changed

services/static-webserver/client/source/class/osparc/jobs/JobsTable.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ qx.Class.define("osparc.jobs.JobsTable", {
3636

3737
Object.values(this.self().COLS).forEach(col => columnModel.setColumnWidth(col.column, col.width));
3838

39-
const fontButtonRenderer = new osparc.ui.table.cellrenderer.SVGButtonRenderer();
39+
const fontButtonRenderer = new osparc.ui.table.cellrenderer.ImageButtonRenderer();
40+
fontButtonRenderer.setIconPath("osparc/offline.svg");
4041
columnModel.setDataCellRenderer(this.self().COLS.INFO.column, fontButtonRenderer);
4142
},
4243

services/static-webserver/client/source/class/osparc/jobs/JobsTableModel.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ qx.Class.define("osparc.jobs.JobsTableModel", {
126126
[jobsCols.SUBMIT.id]: job.getSubmittedAt() ? osparc.utils.Utils.formatDateAndTime(job.getSubmittedAt()) : "-",
127127
[jobsCols.START.id]: job.getStartedAt() ? osparc.utils.Utils.formatDateAndTime(job.getStartedAt()) : "-",
128128
[jobsCols.INSTANCE.id]: job.getInstance(),
129-
[jobsCols.INFO.id]: "@FontAwesome5Solid/copy/14",
130129
});
131130
});
132131
return data;
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
1616
************************************************************************ */
1717

18-
qx.Class.define("osparc.ui.table.cellrenderer.SVGButtonRenderer", {
18+
qx.Class.define("osparc.ui.table.cellrenderer.ButtonRenderer", {
1919
extend: osparc.ui.table.cellrenderer.Html,
2020

21-
construct: function(id, icon) {
21+
construct: function(clickAction, icon) {
2222
this.base(arguments);
2323
},
2424

@@ -29,28 +29,26 @@ qx.Class.define("osparc.ui.table.cellrenderer.SVGButtonRenderer", {
2929
init: "clickAction",
3030
},
3131

32-
svgIcon: {
32+
buttonContent: {
3333
check: "String",
3434
nullable: false,
35-
init: "osparc/offline.svg", // Default icon
36-
},
35+
init: "",
36+
}
3737
},
3838

3939
members: {
4040
// Override
4141
_getContentHtml: function(cellInfo) {
4242
const clickAction = this.getClickAction();
43-
const iconPath = this.getSvgIcon();
44-
const resMgr = qx.util.ResourceManager.getInstance();
45-
const iconUrl = resMgr.toUri(iconPath); // Resolves to the correct URL of the asset
43+
const buttonContent = this.getButtonContent();
4644

4745
// Return the button with the image
4846
return `
4947
<div class="qx-material-button"
5048
data-action="${clickAction}" data-row="${cellInfo.row}"
5149
style="cursor:pointer; padding:2px 2px; width:29px; height:20px; display:flex; align-items:center; justify-content:center;"
5250
>
53-
<img src="${iconUrl}" style="width:16px; height:16px;" alt="icon"/>
51+
${buttonContent}
5452
</div>
5553
`;
5654
},
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/* ************************************************************************
2+
3+
osparc - the simcore frontend
4+
5+
https://osparc.io
6+
7+
Copyright:
8+
2035 IT'IS Foundation, https://itis.swiss
9+
10+
License:
11+
MIT: https://opensource.org/licenses/MIT
12+
13+
Authors:
14+
* Odei Maiz (odeimaiz)
15+
16+
************************************************************************ */
17+
18+
qx.Class.define("osparc.ui.table.cellrenderer.ImageButtonRenderer", {
19+
extend: osparc.ui.table.cellrenderer.ButtonRenderer,
20+
21+
construct: function(clickAction, icon) {
22+
this.base(arguments);
23+
},
24+
25+
properties: {
26+
iconPath: {
27+
check: "String",
28+
init: null,
29+
nullable: false,
30+
apply: "__applyIconPath",
31+
},
32+
},
33+
34+
members: {
35+
__applyIconPath: function(iconPath) {
36+
const resMgr = qx.util.ResourceManager.getInstance();
37+
const iconUrl = resMgr.toUri(iconPath); // Resolves to the correct URL of the asset
38+
39+
this.setButtonContent(`<img src="${iconUrl}" style="width:16px; height:16px;" alt="icon"/>`);
40+
},
41+
}
42+
});

0 commit comments

Comments
 (0)