forked from ITISFoundation/osparc-simcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 [Frontend] Move multiple studies at once (ITISFoundation#6457)
- Loading branch information
1 parent
c0ba01a
commit 54e8174
Showing
13 changed files
with
421 additions
and
407 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
125 changes: 125 additions & 0 deletions
125
services/static-webserver/client/source/class/osparc/dashboard/MoveResourceTo.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,125 @@ | ||
/* ************************************************************************ | ||
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.MoveResourceTo", { | ||
extend: qx.ui.core.Widget, | ||
|
||
construct: function(currentWorkspaceId, currentFolderId) { | ||
this.base(arguments); | ||
|
||
this.__currentWorkspaceId = currentWorkspaceId; | ||
this.__currentFolderId = currentFolderId; | ||
|
||
this._setLayout(new qx.ui.layout.VBox(10)); | ||
|
||
this.getChildControl("current-location"); | ||
|
||
const workspacesAndFoldersTree = this.getChildControl("workspaces-and-folders-tree"); | ||
this.getChildControl("cancel-btn"); | ||
const moveButton = this.getChildControl("move-btn"); | ||
|
||
moveButton.setEnabled(false); | ||
workspacesAndFoldersTree.getSelection().addListener("change", () => { | ||
const selection = workspacesAndFoldersTree.getSelection(); | ||
if (selection.getLength() > 0) { | ||
const item = selection.getItem(0); | ||
this.__selectedWorkspaceId = item.getWorkspaceId(); | ||
this.__selectedFolderId = item.getFolderId(); | ||
moveButton.setEnabled(this.__currentWorkspaceId !== this.__selectedWorkspaceId || this.__currentFolderId !== this.__selectedFolderId); | ||
} | ||
}, this); | ||
moveButton.addListener("execute", () => { | ||
this.fireDataEvent("moveTo", { | ||
workspaceId: this.__selectedWorkspaceId, | ||
folderId: this.__selectedFolderId, | ||
}); | ||
}, this); | ||
}, | ||
|
||
events: { | ||
"cancel": "qx.event.type.Event", | ||
"moveTo": "qx.event.type.Data" | ||
}, | ||
|
||
members: { | ||
__currentWorkspaceId: null, | ||
__currentFolderId: null, | ||
__selectedWorkspaceId: null, | ||
__selectedFolderId: null, | ||
|
||
_createChildControlImpl: function(id) { | ||
let control; | ||
switch (id) { | ||
case "current-location": { | ||
control = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)); | ||
const intro = new qx.ui.basic.Label(this.tr("Current location")); | ||
control.add(intro); | ||
const workspace = osparc.store.Workspaces.getInstance().getWorkspace(this.__currentWorkspaceId); | ||
const workspaceText = workspace ? workspace.getName() : "My Workspace"; | ||
const workspaceLabel = new qx.ui.basic.Label(this.tr("- Workspace: ") + workspaceText); | ||
control.add(workspaceLabel); | ||
const folder = osparc.store.Folders.getInstance().getFolder(this.__currentFolderId); | ||
if (folder) { | ||
const folderText = folder.getName(); | ||
const folderLabel = new qx.ui.basic.Label(this.tr("- Folder: ") + folderText); | ||
control.add(folderLabel); | ||
} | ||
this._add(control); | ||
break; | ||
} | ||
case "workspaces-and-folders-tree": | ||
control = new osparc.dashboard.WorkspacesAndFoldersTree(); | ||
this._add(control, { | ||
flex: 1 | ||
}); | ||
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); | ||
}, | ||
|
||
__getUpstreamFolders: function(childFolder, folderIds = []) { | ||
if (childFolder) { | ||
folderIds.unshift(childFolder.getFolderId()); | ||
const parentFolder = osparc.store.Folders.getInstance().getFolder(childFolder.getParentFolderId()); | ||
this.__getUpstreamFolders(parentFolder, folderIds); | ||
} | ||
} | ||
} | ||
}); |
94 changes: 0 additions & 94 deletions
94
services/static-webserver/client/source/class/osparc/dashboard/MoveResourceToFolder.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.