-
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.
✨ [Frontend] Workspaces: Connect to backend (#6304)
Co-authored-by: matusdrobuliak66 <[email protected]> Co-authored-by: matusdrobuliak66 <[email protected]>
- Loading branch information
1 parent
99de33d
commit 4d70330
Showing
26 changed files
with
778 additions
and
466 deletions.
There are no files selected for viewing
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
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
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
93 changes: 93 additions & 0 deletions
93
services/static-webserver/client/source/class/osparc/dashboard/MoveResourceToWorkspace.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,93 @@ | ||
/* ************************************************************************ | ||
osparc - the simcore frontend | ||
https://osparc.io | ||
Copyright: | ||
2024 IT'IS Foundation, https://itis.swiss | ||
License: | ||
MIT: https://opensource.org/licenses/MIT | ||
Authors: | ||
* Odei Maiz (odeimaiz) | ||
************************************************************************ */ | ||
|
||
qx.Class.define("osparc.dashboard.MoveResourceToWorkspace", { | ||
extend: qx.ui.core.Widget, | ||
|
||
construct: function(currentWorkspaceId) { | ||
this.base(arguments); | ||
|
||
this.__currentWorkspaceId = currentWorkspaceId; | ||
|
||
this._setLayout(new qx.ui.layout.VBox(10)); | ||
|
||
this.getChildControl("current-workspace"); | ||
const workspacesTree = this.getChildControl("workspaces-tree"); | ||
this.getChildControl("cancel-btn"); | ||
const moveButton = this.getChildControl("move-btn"); | ||
|
||
moveButton.setEnabled(false) | ||
workspacesTree.addListener("selectionChanged", e => { | ||
const workspaceId = e.getData(); | ||
moveButton.setEnabled(this.__currentWorkspaceId !== workspaceId); | ||
this.__selectedWorkspaceId = workspaceId; | ||
}); | ||
moveButton.addListener("execute", () => { | ||
this.fireDataEvent("moveToWorkspace", this.__selectedWorkspaceId); | ||
}, this); | ||
}, | ||
|
||
events: { | ||
"cancel": "qx.event.type.Event", | ||
"moveToWorkspace": "qx.event.type.Data" | ||
}, | ||
|
||
members: { | ||
__currentWorkspaceId: null, | ||
|
||
_createChildControlImpl: function(id) { | ||
let control; | ||
switch (id) { | ||
case "current-workspace": { | ||
const workspace = osparc.store.Workspaces.getWorkspace(this.__currentWorkspaceId); | ||
const currentWorkspaceName = workspace ? workspace.getName() : "My Workspace"; | ||
control = new qx.ui.basic.Label(this.tr("Current location: ") + currentWorkspaceName); | ||
this._add(control); | ||
break; | ||
} | ||
case "workspaces-tree": | ||
control = new osparc.dashboard.WorkspacesTree(); | ||
this._add(control); | ||
break; | ||
case "buttons-layout": | ||
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(10).set({ | ||
alignX: "right" | ||
})); | ||
this._add(control); | ||
break; | ||
case "cancel-btn": { | ||
const buttons = this.getChildControl("buttons-layout"); | ||
control = new qx.ui.form.Button(this.tr("Cancel")).set({ | ||
appearance: "form-button-text" | ||
}); | ||
control.addListener("execute", () => this.fireEvent("cancel"), this); | ||
buttons.add(control); | ||
break; | ||
} | ||
case "move-btn": { | ||
const buttons = this.getChildControl("buttons-layout"); | ||
control = new qx.ui.form.Button(this.tr("Move")).set({ | ||
appearance: "form-button" | ||
}); | ||
buttons.add(control); | ||
break; | ||
} | ||
} | ||
return control || this.base(arguments, id); | ||
} | ||
} | ||
}); |
Oops, something went wrong.