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] Open Study location from Search context #6630

Merged
merged 6 commits into from
Oct 29, 2024
Merged
Changes from 3 commits
Commits
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 @@ -90,22 +90,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
}
},

statics: {
sortFoldersList: function(foldersList, propKey) {
const sortByProperty = prop => {
return function(a, b) {
const upKey = qx.lang.String.firstUp(prop);
const getter = "get" + upKey;
if (getter in a && getter in b) {
return b[getter]() - a[getter]();
}
return 0;
};
};
foldersList.sort(sortByProperty(propKey || "lastModified"));
}
},

members: {
__dontShowTutorial: null,
__header: null,
Expand Down Expand Up @@ -421,11 +405,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
},

__addNewFolderButton: function() {
if (this.getCurrentContext() !== "studiesAndFolders") {
return;
}
const currentWorkspaceId = this.getCurrentWorkspaceId();
if (currentWorkspaceId) {
if (this.getCurrentContext() !== "studiesAndFolders") {
return;
}
const currentWorkspace = osparc.store.Workspaces.getInstance().getWorkspace(this.getCurrentWorkspaceId());
if (currentWorkspace && !currentWorkspace.getMyAccessRights()["write"]) {
// If user can't write in workspace, do not show plus button
Expand Down Expand Up @@ -1276,6 +1260,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
menu.add(openButton);
}

if (this.getCurrentContext() === "search") {
const renameStudyButton = this.__getOpenLocationMenuButton(studyData);
menu.add(renameStudyButton);
}

if (writeAccess) {
const renameStudyButton = this.__getRenameStudyMenuButton(studyData);
menu.add(renameStudyButton);
Expand Down Expand Up @@ -1339,6 +1328,14 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
card.evaluateMenuButtons();
},

__getOpenLocationMenuButton: function(studyData) {
const openLocationButton = new qx.ui.menu.Button(this.tr("Open location"), "@FontAwesome5Solid/external-link-alt/12");
openLocationButton.addListener("execute", () => {
this.__changeContext("studiesAndFolders", studyData["workspaceId"], studyData["folderId"]);
}, this);
return openLocationButton;
},

__getRenameStudyMenuButton: function(studyData) {
const renameButton = new qx.ui.menu.Button(this.tr("Rename..."), "@FontAwesome5Solid/pencil-alt/12");
renameButton.addListener("execute", () => {
Expand Down
Loading