Skip to content

Commit

Permalink
merge master into 6948-expose-licensing-endpoints-in-api-server
Browse files Browse the repository at this point in the history
  • Loading branch information
bisgaard-itis committed Jan 7, 2025
2 parents 4758760 + 92ff5d5 commit 7caaa0e
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
const data = e.getData();
const destWorkspaceId = data["workspaceId"];
const destFolderId = data["folderId"];
this._folderToFolderRequested(folderId, currentWorkspaceId, destWorkspaceId, destFolderId);
this.__folderToFolderRequested(folderId, currentWorkspaceId, destWorkspaceId, destFolderId);
});
moveFolderTo.addListener("cancel", () => win.close());
},
Expand All @@ -591,7 +591,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
});
},

_folderToFolderRequested: function(folderId, workspaceId, destWorkspaceId, destFolderId) {
__folderToFolderRequested: function(folderId, workspaceId, destWorkspaceId, destFolderId) {
if (destWorkspaceId === workspaceId) {
this.__doMoveFolder(folderId, destWorkspaceId, destFolderId);
} else {
Expand Down Expand Up @@ -1183,7 +1183,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
destWorkspaceId,
destFolderId,
} = e.getData();
this._moveStudyToFolderReqested(studyData, destWorkspaceId, destFolderId);
this.__studyToFolderRequested(studyData, destWorkspaceId, destFolderId);
});
workspacesAndFoldersTree.addListener("folderToFolderRequested", e => {
const {
Expand All @@ -1192,17 +1192,38 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
destWorkspaceId,
destFolderId,
} = e.getData();
this._folderToFolderRequested(folderId, workspaceId, destWorkspaceId, destFolderId);
this.__folderToFolderRequested(folderId, workspaceId, destWorkspaceId, destFolderId);
});

this._resourceFilter.addListener("trashStudyRequested", e => {
this.__trashStudyRequested(e.getData());
const studyData = e.getData();
this.__trashStudyRequested(studyData);
});
this._resourceFilter.addListener("trashFolderRequested", e => {
this._trashFolderRequested(e.getData());
const folderId = e.getData();
this._trashFolderRequested(folderId);
});
},

_studyToFolderRequested: function(data) {
const {
studyData,
destWorkspaceId,
destFolderId,
} = data;
this.__studyToFolderRequested(studyData, destWorkspaceId, destFolderId);
},

_folderToFolderRequested: function(data) {
const {
folderId,
workspaceId,
destWorkspaceId,
destFolderId,
} = data;
this.__folderToFolderRequested(folderId, workspaceId, destWorkspaceId, destFolderId);
},

__addSortByButton: function() {
const sortByButton = new osparc.dashboard.SortedByMenuButton();
sortByButton.set({
Expand Down Expand Up @@ -1686,7 +1707,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
});
},

_moveStudyToFolderReqested: function(studyData, destWorkspaceId, destFolderId) {
__studyToFolderRequested: function(studyData, destWorkspaceId, destFolderId) {
if (studyData["workspaceId"] === destWorkspaceId) {
this.__doMoveStudy(studyData, destWorkspaceId, destFolderId);
} else {
Expand All @@ -1713,7 +1734,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
const data = e.getData();
const destWorkspaceId = data["workspaceId"];
const destFolderId = data["folderId"];
this._moveStudyToFolderReqested(studyData, destWorkspaceId, destFolderId);
this.__studyToFolderRequested(studyData, destWorkspaceId, destFolderId);
}, this);
moveStudyTo.addListener("cancel", () => win.close());
}, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ qx.Class.define("osparc.file.FilesTree", {
newChildren[0].children[0].children.length) { // node
const nodeData = newChildren[0].children[0].children[0];
const nodeTreeName = nodeData.label;
this.__resetTree(nodeTreeName);
this.__resetTree(nodeTreeName, nodeId);
const rootNodeModel = this.getModel();
if (nodeData.children.length) {
const nodeItemsOnly = nodeData.children;
Expand Down Expand Up @@ -253,12 +253,12 @@ qx.Class.define("osparc.file.FilesTree", {
}
},

__resetTree: function(treeName) {
// FIXME: It is not resetting the model
__resetTree: function(treeName, itemId) {
itemId = itemId || treeName.replace(/\s/g, ""); // default to tree name without white spaces
this.resetModel();
const rootData = {
label: treeName,
itemId: treeName.replace(/\s/g, ""), // remove all white spaces
itemId,
location: null,
path: null,
pathLabel: [treeName],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,14 @@ qx.Class.define("osparc.file.TreeFolderView", {
let found = false;
while (!found && path.length) {
found = foldersTree.findItemId(path.join("/"));
if (found) {
foldersTree.openNodeAndParents(found);
foldersTree.setSelection(new qx.data.Array([found]));
foldersTree.fireEvent("selectionChanged");
}
// look for next parent
path.pop();
}
if (!found) {
if (found) {
foldersTree.openNodeAndParents(found);
foldersTree.setSelection(new qx.data.Array([found]));
foldersTree.fireEvent("selectionChanged");
} else {
folderViewer.resetFolder();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ qx.Class.define("osparc.widget.NodeDataManager", {
foldersTree.resetCache();

const openSameFolder = () => {
if (!this.getStudyId()) {
// drop first, which is the study id
path.shift();
}
// drop last, which is the file
path.pop();
treeFolderView.openPath(path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
__selectedItemId: null,
__startHint: null,
__toolHint: null,
__dropHereNodeUI: null,
__dropHereUI: null,
__selectionRectInitPos: null,
__selectionRectRepr: null,
__panning: null,
Expand Down Expand Up @@ -1685,7 +1685,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
this.setDroppable(true);
const stopDragging = e => {
this.__isDraggingLink = null;
this.__updateWidgets(false);
this.__updateDropHere(false);
};
const startDragging = e => {
this.addListenerOnce("dragleave", stopDragging, this);
Expand Down Expand Up @@ -1786,7 +1786,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {

const posX = e.offsetX + 2;
const posY = e.offsetY + 2;
this.__updateWidgets(dragging, posX, posY);
this.__updateDropHere(dragging, posX, posY);
},

__draggingLink: function(e, dragging) {
Expand All @@ -1802,34 +1802,36 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
}

const pos = this.__pointerEventToWorkbenchPos(e);
this.__updateWidgets(dragging, pos.x, pos.y);
this.__updateDropHere(dragging, pos.x, pos.y);
},

__updateWidgets: function(dragging, posX, posY) {
__updateDropHere: function(show, posX, posY) {
const boxWidth = 120;
const boxHeight = 60;
if (this.__dropHereNodeUI === null) {
const dropHereNodeUI = this.__dropHereNodeUI = new qx.ui.basic.Label(this.tr("Drop here")).set({
if (this.__dropHereUI === null) {
const dropHereNodeUI = this.__dropHereUI = new qx.ui.basic.Label(this.tr("Drop here")).set({
font: "workbench-start-hint",
textColor: "workbench-start-hint"
});
dropHereNodeUI.exclude();
this.__workbenchLayout.add(dropHereNodeUI);
dropHereNodeUI.rect = this.__svgLayer.drawDashedRect(boxWidth, boxHeight);
}
const dropMe = this.__dropHereNodeUI;
if (dragging) {
dropMe.show();
const dropMeBounds = dropMe.getBounds() || dropMe.getSizeHint();
dropMe.setLayoutProperties({
let dropHere = this.__dropHereUI;
if (show) {
dropHere.show();
const dropMeBounds = dropHere.getBounds() || dropHere.getSizeHint();
dropHere.setLayoutProperties({
left: posX - parseInt(dropMeBounds.width/2) - parseInt(boxWidth/2),
top: posY - parseInt(dropMeBounds.height/2)- parseInt(boxHeight/2)
});
if ("rect" in dropMe) {
osparc.wrapper.Svg.updateItemPos(dropMe.rect, posX - boxWidth, posY - boxHeight);
if ("rect" in dropHere) {
osparc.wrapper.Svg.updateItemPos(dropHere.rect, posX - boxWidth, posY - boxHeight);
}
} else {
this.__removeDropHint();
dropHere.exclude();
osparc.wrapper.Svg.removeItem(dropHere.rect);
dropHere = null;
}
},

Expand Down Expand Up @@ -2017,14 +2019,14 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
this.__draggingLink(e, false);

if (this.__isDraggingLink && "dragData" in this.__isDraggingLink) {
const data = this.__isDraggingLink["dragData"];
this.__isDraggingLink = null;
const pos = this.__pointerEventToWorkbenchPos(e, false);
const service = qx.data.marshal.Json.createModel(osparc.service.Utils.getFilePicker());
const nodeUI = await this.__addNode(service, pos);
if (nodeUI) {
const node = nodeUI.getNode();
const data = this.__isDraggingLink["dragData"];
osparc.file.FilePicker.setOutputValueFromStore(node, data.getLocation(), data.getDatasetId(), data.getFileId(), data.getLabel());
this.__isDraggingLink = null;
}
}
},
Expand All @@ -2047,11 +2049,5 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
});
}
},

__removeDropHint: function() {
this.__dropHereNodeUI.setVisibility("excluded");
osparc.wrapper.Svg.removeItem(this.__dropHereNodeUI.rect);
this.__dropHereNodeUI = null;
}
}
});

0 comments on commit 7caaa0e

Please sign in to comment.