Skip to content

Commit 29816b1

Browse files
authored
♻️ [Frontend] Maintenance: Refactor decorators (#7266)
1 parent fdd64ed commit 29816b1

File tree

24 files changed

+86
-93
lines changed

24 files changed

+86
-93
lines changed

services/static-webserver/client/source/class/osparc/Application.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ qx.Class.define("osparc.Application", {
6565

6666
// libs
6767
osparc.wrapper.IntlTelInput.getInstance().init();
68-
osparc.wrapper.Three.getInstance().init();
6968

7069
// trackers
7170
osparc.announcement.Tracker.getInstance().startTracker();

services/static-webserver/client/source/class/osparc/WatchDog.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ qx.Class.define("osparc.WatchDog", {
6161
init: false,
6262
nullable: false,
6363
event: "changeOnline",
64-
apply: "_applyOnline"
64+
apply: "__applyOnline"
6565
},
6666

6767
heartbeatInterval: {
@@ -75,8 +75,8 @@ qx.Class.define("osparc.WatchDog", {
7575
members: {
7676
__clientHeartbeatWWPinger: null,
7777

78-
_applyOnline: function(value) {
79-
let logo = osparc.navigation.LogoOnOff.getInstance();
78+
__applyOnline: function(value) {
79+
const logo = osparc.navigation.LogoOnOff.getInstance();
8080
if (logo) {
8181
logo.setOnline(value);
8282
}

services/static-webserver/client/source/class/osparc/dashboard/CardBase.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,23 @@ qx.Class.define("osparc.dashboard.CardBase", {
6666
LOADER: 3
6767
},
6868

69+
ICON_SIZE: 32,
70+
71+
createCardIcon: function() {
72+
const iconSize = osparc.dashboard.CardBase.ICON_SIZE;
73+
const icon = new osparc.ui.basic.Thumbnail(null, iconSize, iconSize).set({
74+
minHeight: iconSize,
75+
minWidth: iconSize,
76+
});
77+
icon.getChildControl("image").set({
78+
anonymous: true,
79+
decorator: "rounded",
80+
minWidth: iconSize,
81+
minHeight: iconSize,
82+
});
83+
return icon
84+
},
85+
6986
createTSRLayout: function() {
7087
const layout = new qx.ui.container.Composite(new qx.ui.layout.HBox(2).set({
7188
alignY: "middle"

services/static-webserver/client/source/class/osparc/dashboard/Dashboard.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ qx.Class.define("osparc.dashboard.Dashboard", {
4747
barPosition: "top"
4848
});
4949

50-
osparc.wrapper.Plotly.getInstance().init();
50+
// osparc.wrapper.Plotly.getInstance().init();
51+
// osparc.wrapper.Three.getInstance().init();
5152
osparc.wrapper.Svg.getInstance().init();
5253
osparc.wrapper.JsonDiffPatch.getInstance().init();
5354
osparc.wrapper.JsonTreeViewer.getInstance().init();

services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ qx.Class.define("osparc.dashboard.DragWidget", {
7171
__dropAllowed: function(allowed) {
7272
this.getChildControl("allowed-icon").set({
7373
source: allowed ? "@FontAwesome5Solid/check/14" : "@FontAwesome5Solid/times/14",
74-
textColor: allowed ? "default-button-text" : "danger-red",
74+
textColor: allowed ? "white" : "danger-red",
7575
});
7676
},
7777

services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,10 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
269269
const menuButton = this.getChildControl("menu-button");
270270
menuButton.setVisibility("visible");
271271

272-
const menu = new qx.ui.menu.Menu();
273-
menu.setPosition("bottom-right");
274-
osparc.utils.Utils.prettifyMenu(menu);
272+
const menu = new qx.ui.menu.Menu().set({
273+
appearance: "menu-wider",
274+
position: "bottom-right",
275+
});
275276

276277
const studyBrowserContext = osparc.store.Store.getInstance().getStudyBrowserContext();
277278
if (

services/static-webserver/client/source/class/osparc/dashboard/GridButtonBase.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
4747
TITLE_PADDING: 6,
4848
SPACING_IN: 5,
4949
SPACING: 15,
50-
ICON_SIZE: 32,
5150
THUMBNAIL_SIZE: 50,
5251
POS: {
5352
TITLE: {
@@ -178,17 +177,7 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
178177
break;
179178
}
180179
case "icon": {
181-
control = new osparc.ui.basic.Thumbnail(null, this.self().ICON_SIZE, this.self().ICON_SIZE).set({
182-
minHeight: this.self().ICON_SIZE,
183-
minWidth: this.self().ICON_SIZE,
184-
});
185-
control.getChildControl("image").set({
186-
anonymous: true,
187-
alignY: "top",
188-
alignX: "left",
189-
allowGrowX: true,
190-
allowGrowY: true,
191-
});
180+
control = osparc.dashboard.CardBase.createCardIcon();
192181
layout = this.getChildControl("header");
193182
layout.add(control, {
194183
column: 0,
@@ -275,7 +264,7 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
275264
case "project-status":
276265
control = new qx.ui.basic.Image().set({
277266
alignY: "middle",
278-
textColor: "status_icon",
267+
textColor: "text",
279268
height: 13,
280269
width: 13,
281270
margin: [0, 1]
@@ -296,8 +285,8 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
296285
const image = this.getChildControl("icon").getChildControl("image");
297286
image.set({
298287
source: value,
299-
decorator: "rounded",
300288
});
289+
osparc.utils.Utils.setAltToImage(image, "card-icon");
301290
}
302291
},
303292

services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
9393
break;
9494
case "menu-button":
9595
this.getChildControl("title").set({
96-
maxWidth: osparc.dashboard.GridButtonBase.ITEM_WIDTH - osparc.dashboard.GridButtonBase.ICON_SIZE - this.self().MENU_BTN_DIMENSIONS - 2,
96+
maxWidth: osparc.dashboard.GridButtonBase.ITEM_WIDTH - osparc.dashboard.CardBase.ICON_SIZE - this.self().MENU_BTN_DIMENSIONS - 2,
9797
});
9898
control = new qx.ui.form.MenuButton().set({
9999
appearance: "form-button-outlined",
@@ -273,9 +273,10 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
273273
_applyMenu: function(menu, old) {
274274
const menuButton = this.getChildControl("menu-button");
275275
if (menu) {
276-
menuButton.setMenu(menu);
277-
menu.setPosition("bottom-left");
278-
osparc.utils.Utils.prettifyMenu(menu);
276+
menuButton.setMenu(menu).set({
277+
appearance: "menu-wider",
278+
position: "bottom-left",
279+
});
279280
osparc.utils.Utils.setIdToWidget(menu, "studyItemMenuMenu");
280281
this.evaluateMenuButtons();
281282
}

services/static-webserver/client/source/class/osparc/dashboard/ListButtonBase.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,7 @@ qx.Class.define("osparc.dashboard.ListButtonBase", {
6666
let control;
6767
switch (id) {
6868
case "icon": {
69-
control = new osparc.ui.basic.Thumbnail(null, this.self().ITEM_HEIGHT, this.self().ITEM_HEIGHT).set({
70-
minHeight: this.self().ITEM_HEIGHT,
71-
minWidth: this.self().ITEM_HEIGHT
72-
});
73-
control.getChildControl("image").set({
74-
anonymous: true,
75-
decorator: "rounded",
76-
});
69+
control = osparc.dashboard.CardBase.createCardIcon();
7770
this._add(control, {
7871
row: 0,
7972
column: osparc.dashboard.ListButtonBase.POS.THUMBNAIL
@@ -124,7 +117,7 @@ qx.Class.define("osparc.dashboard.ListButtonBase", {
124117
case "project-status":
125118
control = new qx.ui.basic.Image().set({
126119
alignY: "middle",
127-
textColor: "status_icon",
120+
textColor: "text",
128121
height: 12,
129122
width: 12
130123
});
@@ -143,6 +136,7 @@ qx.Class.define("osparc.dashboard.ListButtonBase", {
143136
image.set({
144137
source: value
145138
});
139+
osparc.utils.Utils.setAltToImage(image, "card-icon");
146140
}
147141
},
148142

services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,10 @@ qx.Class.define("osparc.dashboard.ListButtonItem", {
294294
_applyMenu: function(menu, old) {
295295
const menuButton = this.getChildControl("menu-button");
296296
if (menu) {
297-
menuButton.setMenu(menu);
298-
menu.setPosition("bottom-left");
299-
osparc.utils.Utils.prettifyMenu(menu);
297+
menuButton.setMenu(menu).set({
298+
appearance: "menu-wider",
299+
position: "bottom-left",
300+
});
300301
osparc.utils.Utils.setIdToWidget(menu, "studyItemMenuMenu");
301302
this.evaluateMenuButtons();
302303
}

0 commit comments

Comments
 (0)