-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 Feature: Stop, and Start, buttons in service options (#4564)
- Loading branch information
Showing
3 changed files
with
109 additions
and
21 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
services/static-webserver/client/source/class/osparc/component/node/StartStopButton.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* ************************************************************************ | ||
osparc - the simcore frontend | ||
https://osparc.io | ||
Copyright: | ||
2023 IT'IS Foundation, https://itis.swiss | ||
License: | ||
MIT: https://opensource.org/licenses/MIT | ||
Authors: | ||
* Odei Maiz (odeimaiz) | ||
************************************************************************ */ | ||
|
||
qx.Class.define("osparc.component.node.StartStopButton", { | ||
extend: qx.ui.core.Widget, | ||
|
||
construct: function(node) { | ||
this.base(arguments); | ||
|
||
this._setLayout(new qx.ui.layout.HBox(5)); | ||
|
||
if (node) { | ||
this.setNode(node); | ||
} | ||
}, | ||
|
||
properties: { | ||
node: { | ||
check: "osparc.data.model.Node", | ||
init: null, | ||
nullable: false, | ||
event: "changeNode", | ||
apply: "__applyNode" | ||
} | ||
}, | ||
|
||
members: { | ||
_createChildControlImpl: function(id) { | ||
let control; | ||
switch (id) { | ||
case "start-button": | ||
control = new qx.ui.form.Button().set({ | ||
label: this.tr("Start"), | ||
icon: "@FontAwesome5Solid/play/14", | ||
allowGrowX: false, | ||
enabled: false | ||
}); | ||
control.addListener("execute", () => this.fireEvent("startPressed")); | ||
this._add(control); | ||
break; | ||
case "stop-button": | ||
control = new qx.ui.form.Button().set({ | ||
label: this.tr("Stop"), | ||
icon: "@FontAwesome5Solid/stop/14", | ||
allowGrowX: false, | ||
enabled: false | ||
}); | ||
control.addListener("execute", () => this.fireEvent("stopPressed")); | ||
this._add(control); | ||
break; | ||
} | ||
|
||
return control || this.base(arguments, id); | ||
}, | ||
|
||
__applyNode: function(node) { | ||
if (node && node.isDynamic()) { | ||
const startButton = this.getChildControl("start-button"); | ||
node.attachHandlersToStartButton(startButton); | ||
|
||
const stopButton = this.getChildControl("stop-button"); | ||
node.attachHandlersToStopButton(stopButton); | ||
} | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters