Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ [Frontend] Workspaces #6283

Merged
merged 61 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
929ad65
move file
odeimaiz Sep 2, 2024
8ad1260
Workspaces
odeimaiz Sep 2, 2024
e6c00d1
Workspace model
odeimaiz Sep 2, 2024
f2ccfb9
minor
odeimaiz Sep 2, 2024
378086c
fake data
odeimaiz Sep 2, 2024
b85d3cd
fetch fake Workspaces
odeimaiz Sep 2, 2024
e46878d
My workspace
odeimaiz Sep 2, 2024
ed04360
currentWorkspaceId
odeimaiz Sep 2, 2024
e3ad433
workspace buttons
odeimaiz Sep 2, 2024
e9df51f
minor
odeimaiz Sep 2, 2024
5a1b8c2
minor
odeimaiz Sep 2, 2024
ee66c1f
minor
odeimaiz Sep 2, 2024
a28ad0b
remove sharing folder features
odeimaiz Sep 2, 2024
ed39aea
remove folder sharing
odeimaiz Sep 2, 2024
d2f768d
Workspace items
odeimaiz Sep 2, 2024
4550b79
load workspaces
odeimaiz Sep 2, 2024
59c42b0
rename file
odeimaiz Sep 2, 2024
7ea260b
thumbnails
odeimaiz Sep 2, 2024
ecf2a31
own layout
odeimaiz Sep 2, 2024
3bcd2d3
minor
odeimaiz Sep 2, 2024
5a47cd1
fix
odeimaiz Sep 2, 2024
2e2d640
all items on workspace
odeimaiz Sep 2, 2024
3e22cc1
load workspaces
odeimaiz Sep 2, 2024
b5bf29e
minor
odeimaiz Sep 2, 2024
c919ef5
FolderHeader -> ContainerHeader
odeimaiz Sep 2, 2024
a8a398a
header
odeimaiz Sep 2, 2024
802c11a
new workspace
odeimaiz Sep 2, 2024
e82a6bc
appearance
odeimaiz Sep 2, 2024
a077658
styling
odeimaiz Sep 2, 2024
afa86c4
simplify
odeimaiz Sep 2, 2024
245ae03
list shared workspaces
odeimaiz Sep 2, 2024
249c399
Do not exclude left filters
odeimaiz Sep 2, 2024
fa1567e
minor
odeimaiz Sep 2, 2024
f4e59a0
minor
odeimaiz Sep 2, 2024
fcb8a75
minor
odeimaiz Sep 2, 2024
b9415b8
minor
odeimaiz Sep 3, 2024
5dec977
resetSharedWithActiveFilter
odeimaiz Sep 3, 2024
cf3b821
header binding
odeimaiz Sep 3, 2024
35f2980
don't add empty container
odeimaiz Sep 3, 2024
fad5323
minor
odeimaiz Sep 3, 2024
8995a78
WorkspaceEditor
odeimaiz Sep 3, 2024
3563cba
default icon
odeimaiz Sep 3, 2024
6eba402
in two steps
odeimaiz Sep 3, 2024
7c2fe6c
create Workspace
odeimaiz Sep 3, 2024
ff30686
minor
odeimaiz Sep 3, 2024
4fc4e4d
fake post
odeimaiz Sep 3, 2024
e73ca99
WORKSPACE ROLES
odeimaiz Sep 3, 2024
06b765f
renaming
odeimaiz Sep 3, 2024
939f59d
Share workspaces
odeimaiz Sep 3, 2024
5441309
use cache
odeimaiz Sep 3, 2024
7f31bd4
minor
odeimaiz Sep 3, 2024
f4e3efa
Share workspaces
odeimaiz Sep 3, 2024
f3c0129
minor
odeimaiz Sep 3, 2024
689fb6e
updateWorkspace
odeimaiz Sep 3, 2024
e05c8df
add resources
odeimaiz Sep 3, 2024
b7bc3bd
update access rights
odeimaiz Sep 3, 2024
3d8c6fe
wire signals
odeimaiz Sep 3, 2024
b3a2079
sync buttons
odeimaiz Sep 3, 2024
888ee5d
warning message
odeimaiz Sep 3, 2024
c6c916d
Merge branch 'master' into feature/workspaces
odeimaiz Sep 3, 2024
fc33547
Merge branch 'master' into feature/workspaces
odeimaiz Sep 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

qx.Class.define("osparc.dashboard.FolderHeader", {
qx.Class.define("osparc.dashboard.ContainerHeader", {
extend: qx.ui.core.Widget,

construct: function() {
Expand All @@ -31,17 +31,21 @@ qx.Class.define("osparc.dashboard.FolderHeader", {
}));
},

events: {
"changeCurrentFolderId": "qx.event.type.Data"
},

properties: {
currentWorkspaceId: {
check: "Number",
nullable: true,
init: null,
event: "changeCurrentWorkspaceId",
apply: "__buildBreadcrumbs"
},

currentFolderId: {
check: "Number",
nullable: true,
init: null,
event: "changeCurrentFolderId",
apply: "__applyCurrentFolderId"
apply: "__buildBreadcrumbs"
}
},

Expand All @@ -55,24 +59,10 @@ qx.Class.define("osparc.dashboard.FolderHeader", {
}));
this._addAt(control, 0, {flex: 1});
break;
case "permissions-info": {
control = new qx.ui.container.Composite(new qx.ui.layout.HBox().set({
alignY: "middle"
})).set({
paddingRight: 14
});
this._addAt(control, 1);
break;
}
}
return control || this.base(arguments, id);
},

__applyCurrentFolderId: function() {
this.__buildBreadcrumbs();
this.__populatePermissions();
},

__buildBreadcrumbs: function() {
const breadcrumbsLayout = this.getChildControl("breadcrumbs-layout");
breadcrumbsLayout.removeAll();
Expand Down Expand Up @@ -110,14 +100,38 @@ qx.Class.define("osparc.dashboard.FolderHeader", {
return this.__createFolderButton(currentFolder);
},

__createRootButton: function(workspaceId) {
let rootButton = null;
if (workspaceId) {
if (workspaceId === -1) {
rootButton = new qx.ui.form.Button(this.tr("Shared Workspaces"), osparc.store.Workspaces.iconPath());
} else {
const workspace = osparc.store.Workspaces.getWorkspace(workspaceId);
rootButton = new qx.ui.form.Button(workspace.getName(), osparc.store.Workspaces.iconPath());
}
rootButton.addListener("execute", () => this.set({
currentWorkspaceId: workspaceId,
currentFolderId: null,
}));
} else {
rootButton = new qx.ui.form.Button(this.tr("My Workspace"), "@FontAwesome5Solid/home/14");
rootButton.addListener("execute", () => this.set({
currentWorkspaceId: null,
currentFolderId: null,
}));
}
return rootButton;
},

__createFolderButton: function(folder) {
let folderButton = null;
if (folder) {
folderButton = new qx.ui.form.Button(folder.getName(), "@FontAwesome5Solid/folder/14");
folderButton.addListener("execute", () => this.fireDataEvent("changeCurrentFolderId", folder ? folder.getFolderId() : null), this);
} else {
folderButton = new qx.ui.form.Button(this.tr("Home"), "@FontAwesome5Solid/home/14");
const workspaceId = this.getCurrentWorkspaceId();
folderButton = this.__createRootButton(workspaceId);
}
folderButton.addListener("execute", () => this.fireDataEvent("changeCurrentFolderId", folder ? folder.getFolderId() : null), this);
folderButton.set({
backgroundColor: "transparent",
textColor: "text",
Expand All @@ -128,22 +142,6 @@ qx.Class.define("osparc.dashboard.FolderHeader", {

__createArrow: function() {
return new qx.ui.basic.Label("/");
},

__populatePermissions: function() {
const permissionsLayout = this.getChildControl("permissions-info");
permissionsLayout.removeAll();

if (this.getCurrentFolderId()) {
const currentFolder = osparc.store.Folders.getInstance().getFolder(this.getCurrentFolderId());
const ar = currentFolder.getMyAccessRights();
const permissions = ar["read"] + ar["write"] + ar["delete"];
const roleTitle = new qx.ui.basic.Label().set({
value: osparc.data.Roles.FOLDERS[permissions].label
});
permissionsLayout.add(roleTitle);
permissionsLayout.add(osparc.data.Roles.createRolesFolderInfo(false));
}
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ qx.Class.define("osparc.dashboard.Dashboard", {
const preResourcePromises = [];
const store = osparc.store.Store.getInstance();
preResourcePromises.push(store.getAllGroupsAndMembers());
preResourcePromises.push(osparc.service.Store.getServicesLatest(false));
preResourcePromises.push(osparc.store.Services.getServicesLatest(false));
if (permissions.canDo("study.tag")) {
preResourcePromises.push(osparc.data.Resources.get("tags"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,6 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
apply: "__applyDescription"
},

myAccessRights: {
check: "Object",
nullable: true,
apply: "__applyMyAccessRights"
},

accessRights: {
check: "Object",
nullable: true,
apply: "__applyAccessRights"
},

lastModified: {
check: "Date",
nullable: true,
Expand All @@ -103,7 +91,8 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
let control;
switch (id) {
case "icon": {
control = new osparc.dashboard.FolderWithSharedIcon().set({
control = new qx.ui.basic.Image().set({
source: "@FontAwesome5Solid/folder/26",
anonymous: true,
height: 40,
padding: 5
Expand Down Expand Up @@ -155,9 +144,9 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
folder.bind("parentId", this, "parentFolderId");
folder.bind("name", this, "title");
folder.bind("description", this, "description");
folder.bind("accessRights", this, "accessRights");
folder.bind("lastModified", this, "lastModified");
folder.bind("myAccessRights", this, "myAccessRights");

this.__addMenuButton();
},

__applyTitle: function(value) {
Expand All @@ -177,73 +166,51 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
}
},

__applyMyAccessRights: function(value) {
if (value && value["delete"]) {
const menuButton = this.getChildControl("menu-button");
menuButton.setVisibility("visible");
__addMenuButton: function() {
const menuButton = this.getChildControl("menu-button");
menuButton.setVisibility("visible");

const menu = new qx.ui.menu.Menu().set({
position: "bottom-right"
});
const menu = new qx.ui.menu.Menu().set({
position: "bottom-right"
});

const editButton = new qx.ui.menu.Button(this.tr("Rename..."), "@FontAwesome5Solid/pencil-alt/12");
editButton.addListener("execute", () => {
const folder = this.getFolder();
const newFolder = false;
const folderEditor = new osparc.editor.FolderEditor(newFolder).set({
label: folder.getName(),
description: folder.getDescription()
});
const title = this.tr("Edit Folder");
const win = osparc.ui.window.Window.popUpInWindow(folderEditor, title, 300, 200);
folderEditor.addListener("updateFolder", () => {
const newName = folderEditor.getLabel();
const newDescription = folderEditor.getDescription();
const updateData = {
"name": newName,
"description": newDescription
};
osparc.data.model.Folder.putFolder(this.getFolderId(), updateData)
.then(() => {
folder.set({
name: newName,
description: newDescription
});
this.fireDataEvent("folderUpdated", folder.getFolderId());
})
.catch(err => console.error(err));
win.close();
});
folderEditor.addListener("cancel", () => win.close());
const editButton = new qx.ui.menu.Button(this.tr("Rename..."), "@FontAwesome5Solid/pencil-alt/12");
editButton.addListener("execute", () => {
const folder = this.getFolder();
const newFolder = false;
const folderEditor = new osparc.editor.FolderEditor(newFolder).set({
label: folder.getName(),
description: folder.getDescription()
});
menu.add(editButton);

const shareButton = new qx.ui.menu.Button(this.tr("Share..."), "@FontAwesome5Solid/share-alt/12");
shareButton.addListener("execute", () => this.__openShareWith(), this);
menu.add(shareButton);

menu.addSeparator();

const deleteButton = new qx.ui.menu.Button(this.tr("Delete"), "@FontAwesome5Solid/trash/12");
deleteButton.addListener("execute", () => this.__deleteStudyRequested(), this);
menu.add(deleteButton);
const title = this.tr("Edit Folder");
const win = osparc.ui.window.Window.popUpInWindow(folderEditor, title, 300, 200);
folderEditor.addListener("updateFolder", () => {
const newName = folderEditor.getLabel();
const newDescription = folderEditor.getDescription();
const updateData = {
"name": newName,
"description": newDescription
};
osparc.data.model.Folder.putFolder(this.getFolderId(), updateData)
.then(() => {
folder.set({
name: newName,
description: newDescription
});
this.fireDataEvent("folderUpdated", folder.getFolderId());
})
.catch(err => console.error(err));
win.close();
});
folderEditor.addListener("cancel", () => win.close());
});
menu.add(editButton);

menuButton.setMenu(menu);
}
},
const deleteButton = new qx.ui.menu.Button(this.tr("Delete"), "@FontAwesome5Solid/trash/12");
deleteButton.addListener("execute", () => this.__deleteStudyRequested(), this);
menu.add(deleteButton);

__applyAccessRights: function(value) {
if (value && Object.keys(value).length) {
const shareIcon = this.getChildControl("icon").getChildControl("shared-icon");
// if it's not shared don't show the share icon
shareIcon.addListener("changeSource", e => {
const newSource = e.getData();
shareIcon.set({
visibility: newSource.includes(osparc.dashboard.CardBase.SHARE_ICON) ? "hidden" : "visible"
});
});
osparc.dashboard.CardBase.populateShareIcon(shareIcon, value);
}
menuButton.setMenu(menu);
},

__updateTooltip: function() {
Expand All @@ -260,18 +227,6 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
this.setValue(false);
},

__openShareWith: function() {
const disableShare = true;
if (disableShare) {
osparc.FlashMessenger.getInstance().logAs(this.tr("Not yet implemented"), "WARNING");
} else {
const title = this.tr("Share Folder");
const permissionsView = new osparc.share.CollaboratorsFolder(this.getFolder());
osparc.ui.window.Window.popUpInWindow(permissionsView, title);
permissionsView.addListener("updateAccessRights", () => this.__applyAccessRights(this.getFolder().getAccessRights()), this);
}
},

__deleteStudyRequested: function() {
const msg = this.tr("Are you sure you want to delete") + " <b>" + this.getTitle() + "</b>?";
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
Expand Down
Loading
Loading