Skip to content

Commit 516cc24

Browse files
committed
refactoring
1 parent 2ab8ac7 commit 516cc24

File tree

2 files changed

+32
-19
lines changed

2 files changed

+32
-19
lines changed

services/static-webserver/client/source/class/osparc/file/FileLabelWithActions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ qx.Class.define("osparc.file.FileLabelWithActions", {
226226
pollTasks.createPollingTask(fetchPromise, interval)
227227
.then(task => {
228228
const taskUI = new osparc.task.TaskUI();
229+
taskUI.setIcon("@FontAwesome5Solid/trash/14");
229230
taskUI.setTitle(this.tr("Deleting files"));
230231
taskUI.setTask(task);
231232
osparc.task.TasksContainer.getInstance().addTaskUI(taskUI);

services/static-webserver/client/source/class/osparc/ui/window/Confirmation.js

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,9 @@ qx.Class.define("osparc.ui.window.Confirmation", {
2323
this.setMessage(message);
2424
}
2525

26-
const confirmButton = this.__confirmButton = new qx.ui.form.Button();
27-
confirmButton.set({
28-
center: true,
29-
minWidth: 100
30-
});
26+
const confirmButton = this.getChildControl("confirm-button");
3127
this.bind("confirmText", confirmButton, "label");
32-
confirmButton.addListener("execute", () => {
33-
this.setConfirmed(true);
34-
this.close(1);
35-
}, this);
36-
const command = new qx.ui.command.Command("Enter");
37-
confirmButton.setCommand(command);
38-
this.addButton(confirmButton);
28+
3929
this.addCancelButton();
4030
},
4131

@@ -60,30 +50,52 @@ qx.Class.define("osparc.ui.window.Confirmation", {
6050
},
6151

6252
members: {
63-
__confirmButton: null,
53+
54+
_createChildControlImpl: function(id) {
55+
let control;
56+
switch (id) {
57+
case "confirm-button": {
58+
const btnsLayout = this.getChildControl("buttons-layout");
59+
control = new qx.ui.form.Button().set({
60+
appearance: "form-button",
61+
center: true,
62+
minWidth: 100,
63+
});
64+
control.addListener("execute", () => {
65+
this.setConfirmed(true);
66+
this.close(1);
67+
}, this);
68+
const command = new qx.ui.command.Command("Enter");
69+
control.setCommand(command);
70+
btnsLayout.addAt(control, 1);
71+
break;
72+
}
73+
}
74+
return control || this.base(arguments, id);
75+
},
6476

6577
getConfirmButton: function() {
66-
return this.__confirmButton;
78+
return this.getChildControl("confirm-button");
6779
},
6880

6981
getCancelButton: function() {
7082
return this.getChildControl("cancel-button");
7183
},
7284

7385
__applyConfirmAppearance: function(confirmationAction) {
74-
const confBtn = this.__confirmButton;
86+
const confirmButton = this.getChildControl("confirm-button");
7587
switch (confirmationAction) {
7688
case "create":
77-
confBtn.setAppearance("strong-button");
89+
confirmButton.setAppearance("strong-button");
7890
break;
7991
case "warning":
80-
confBtn.setAppearance("warning-button");
92+
confirmButton.setAppearance("warning-button");
8193
break;
8294
case "delete":
83-
confBtn.setAppearance("danger-button");
95+
confirmButton.setAppearance("danger-button");
8496
break;
8597
default:
86-
confBtn.resetAppearance();
98+
confirmButton.resetAppearance();
8799
break;
88100
}
89101
}

0 commit comments

Comments
 (0)