Skip to content

🎨 [Frontend] UI/UX Data handling: Larger window and list view by default #7160

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

Merged
merged 31 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3b91038
rename StudyDataManager
odeimaiz Feb 3, 2025
6862a22
Own window
odeimaiz Feb 3, 2025
86be17c
no shot show file uuid in tree
odeimaiz Feb 3, 2025
f952525
list by default
odeimaiz Feb 3, 2025
6ddcab4
refactor
odeimaiz Feb 3, 2025
f374bdb
minor
odeimaiz Feb 3, 2025
c9e024d
renaming
odeimaiz Feb 3, 2025
c98f45d
refactor
odeimaiz Feb 3, 2025
5de5020
pop up project files
odeimaiz Feb 3, 2025
3a32e45
aesthetics
odeimaiz Feb 3, 2025
f6d9fbf
Merge branch 'master' into ui-ux/data-handling
odeimaiz Feb 3, 2025
4f4580a
more refactoring
odeimaiz Feb 3, 2025
ecbbe87
Merge branch 'master' into ui-ux/data-handling
odeimaiz Feb 4, 2025
ac60baf
select study
odeimaiz Feb 4, 2025
a9e35cd
minor
odeimaiz Feb 4, 2025
3fe7602
minor
odeimaiz Feb 4, 2025
6825c5d
re-arrange
odeimaiz Feb 4, 2025
104ecca
prettify tables
odeimaiz Feb 4, 2025
ce5c221
folders first
odeimaiz Feb 4, 2025
4b945ef
folders can also be selected
odeimaiz Feb 4, 2025
b4877bd
comment
odeimaiz Feb 4, 2025
2b5b59e
deleteFolder
odeimaiz Feb 4, 2025
51f2dbc
minor text
odeimaiz Feb 4, 2025
b6d8bd2
Merge branch 'master' into ui-ux/data-handling
odeimaiz Feb 4, 2025
8f9a65b
folderGridView
odeimaiz Feb 4, 2025
735eb9d
canShowStudyData
odeimaiz Feb 5, 2025
d8b7545
confirmation for deletion
odeimaiz Feb 5, 2025
0c3b7bf
minor
odeimaiz Feb 5, 2025
40fb43e
Merge branch 'master' into ui-ux/data-handling
odeimaiz Feb 5, 2025
825c837
minors
odeimaiz Feb 5, 2025
5aaad47
Merge branch 'ui-ux/data-handling' of github.com:odeimaiz/osparc-simc…
odeimaiz Feb 5, 2025
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 @@ -33,9 +33,10 @@ qx.Class.define("osparc.DownloadLinkTracker", {
downloadAnchorNode.setAttribute("href", url);
downloadAnchorNode.setAttribute("download", fileName);
downloadAnchorNode.setAttribute("osparc", "downloadFile");
document.body.appendChild(downloadAnchorNode);
this.setDownloading(true);
downloadAnchorNode.click();
downloadAnchorNode.remove();
document.body.removeChild(downloadAnchorNode);
// This is needed to make it work in Firefox
setTimeout(() => this.setDownloading(false), 100);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ qx.Class.define("osparc.admin.AdminCenter", {
const miniProfile = osparc.desktop.account.MyAccount.createMiniProfileView().set({
paddingRight: 10
});
this.addWidgetOnTopOfTheTabs(miniProfile);
this.addWidgetToTabs(miniProfile);

this.__addPricingPlansPage();
this.__addMaintenancePage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -963,8 +963,8 @@ qx.Class.define("osparc.dashboard.CardBase", {
},

openData: function() {
const moreOpts = this.__openMoreOptions();
moreOpts.openData();
const resourceData = this.getResourceData();
osparc.widget.StudyDataManager.popUpInWindow(resourceData["uuid"]);
},

openBilling: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
__resourceData: null,
__resourceModel: null,
__infoPage: null,
__dataPage: null,
__servicesUpdatePage: null,
__permissionsPage: null,
__tagsPage: null,
Expand Down Expand Up @@ -216,10 +215,6 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
this._openPage(this.__infoPage);
},

openData: function() {
this._openPage(this.__dataPage);
},

openUpdateServices: function() {
this._openPage(this.__servicesUpdatePage);
},
Expand Down Expand Up @@ -306,7 +301,6 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
this.__getBillingPage,
this.__getServicesUpdatePage,
this.__getServicesBootOptionsPage,
this.__getDataPage,
this.__getCommentsPage,
this.__getPermissionsPage,
this.__getSaveAsTemplatePage,
Expand All @@ -323,6 +317,28 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
}
});

const resourceData = this.__resourceData;
if (!osparc.utils.Resources.isService(resourceData)) {
const title = osparc.product.Utils.getStudyAlias({firstUpperCase: true}) + this.tr(" Files...");
const iconSrc = "@FontAwesome5Solid/file/22";
const dataAccess = new qx.ui.basic.Atom().set({
label: title,
icon: iconSrc,
font: "text-14",
padding: 8,
paddingLeft: 12,
gap: 14,
cursor: "pointer",
});
dataAccess.addListener("tap", () => osparc.widget.StudyDataManager.popUpInWindow(resourceData["uuid"]));
this.addWidgetToTabs(dataAccess);

if (resourceData["resourceType"] === "study") {
const canShowData = osparc.study.Utils.canShowStudyData(resourceData);
dataAccess.setEnabled(canShowData);
}
}

if (selectedTabId) {
const pageFound = tabsView.getChildren().find(page => page.tabId === selectedTabId);
if (pageFound) {
Expand Down Expand Up @@ -486,33 +502,6 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
return page;
},

__getDataPage: function() {
const resourceData = this.__resourceData;
if (osparc.utils.Resources.isService(resourceData)) {
return null;
}

const id = "Data";
const title = osparc.product.Utils.getStudyAlias({firstUpperCase: true}) + this.tr(" Files");
const iconSrc = "@FontAwesome5Solid/file/22";
const page = this.__dataPage = new osparc.dashboard.resources.pages.BasePage(title, iconSrc, id);
this.__addOpenButton(page);

if (this.__resourceData["resourceType"] === "study") {
const studyData = this.__resourceData;
const canBeOpened = osparc.study.Utils.canShowStudyData(studyData);
page.setEnabled(canBeOpened);
}

const lazyLoadContent = () => {
const studyDataManager = new osparc.widget.NodeDataManager(resourceData["uuid"]);
page.addToContent(studyDataManager);
}
page.addListenerOnce("appear", lazyLoadContent, this);

return page;
},

__getPermissionsPage: function() {
const id = "Permissions";
const title = this.tr("Sharing");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ qx.Class.define("osparc.desktop.StudyEditor", {
this.__workbenchView.showPipeline();
} else {
const currentNodeId = this.getStudy().getUi().getCurrentNodeId();
if (currentNodeId) {
if (currentNodeId && this.getStudy().getWorkbench().getNode(currentNodeId)) {
const node = this.getStudy().getWorkbench().getNode(currentNodeId);
if (node && node.isDynamic()) {
this.__workbenchView.fullscreenNode(currentNodeId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,8 @@ qx.Class.define("osparc.desktop.WorkbenchView", {
});
},

openNodeDataManager: function(node) {
const nodeDataManager = new osparc.widget.NodeDataManager(null, node.getNodeId());
const win = osparc.ui.window.Window.popUpInWindow(nodeDataManager, node.getLabel(), 900, 600).set({
appearance: "service-window"
});
openStudyDataManager: function(node) {
const win = osparc.widget.StudyDataManager.popUpInWindow(null, node.getNodeId(), node.getLabel());
const closeBtn = win.getChildControl("close-button");
osparc.utils.Utils.setIdToWidget(closeBtn, "nodeDataManagerCloseBtn");
}
Expand Down Expand Up @@ -1049,7 +1046,7 @@ qx.Class.define("osparc.desktop.WorkbenchView", {
allowGrowY: false
});
osparc.utils.Utils.setIdToWidget(nodeFilesBtn, "nodeFilesBtn");
nodeFilesBtn.addListener("execute", () => this.self().openNodeDataManager(node));
nodeFilesBtn.addListener("execute", () => this.self().openStudyDataManager(node));
outputsBox.add(nodeFilesBtn);

const outputs = new osparc.desktop.PanelView(this.tr("Outputs"), outputsBox);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ qx.Class.define("osparc.desktop.account.MyAccount", {
const miniProfile = osparc.desktop.account.MyAccount.createMiniProfileView().set({
paddingRight: 10
});
this.addWidgetOnTopOfTheTabs(miniProfile);
this.addWidgetToTabs(miniProfile);

this.__profilePage = this.__addProfilePage();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ qx.Class.define("osparc.desktop.credits.BillingCenter", {
const miniWallet = this.self().createMiniWalletView().set({
paddingRight: 10
});
this.addWidgetOnTopOfTheTabs(miniWallet);
this.addWidgetToTabs(miniWallet);

this.__walletsPage = this.__addWalletsPage();
this.__paymentMethodsPage = this.__addPaymentMethodsPage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,11 @@ qx.Class.define("osparc.file.FileLabelWithActions", {

setItemSelected: function(selectedItem) {
if (selectedItem) {
this.__selection = [selectedItem];
const isFile = osparc.file.FilesTree.isFile(selectedItem);
this.getChildControl("download-button").setEnabled(isFile);
this.getChildControl("delete-button").setEnabled(isFile);
const selectedLabel = this.getChildControl("selected-label");
if (isFile) {
this.__selection = [selectedItem];
selectedLabel.set({
value: selectedItem.getLabel(),
toolTipText: selectedItem.getFileId()
});
} else {
this.__selection = [];
selectedLabel.set({
value: "",
toolTipText: ""
});
}
this.getChildControl("delete-button").setEnabled(true); // folders can also be deleted
this.getChildControl("selected-label").setValue(selectedItem.getLabel());
} else {
this.resetSelection();
}
Expand All @@ -138,7 +126,7 @@ qx.Class.define("osparc.file.FileLabelWithActions", {
} else {
const selectedLabel = this.getChildControl("selected-label");
selectedLabel.set({
value: multiSelectionData.length + " files"
value: multiSelectionData.length + " items"
});
}
} else {
Expand Down Expand Up @@ -168,60 +156,86 @@ qx.Class.define("osparc.file.FileLabelWithActions", {
}
},

__retrieveURLAndDownloadFile: function(file) {
const fileId = file.getFileId();
const locationId = file.getLocation();
osparc.utils.Utils.retrieveURLAndDownload(locationId, fileId)
.then(data => {
if (data) {
osparc.DownloadLinkTracker.getInstance().downloadLinkUnattended(data.link, data.fileName);
}
});
},

__deleteSelected: function() {
const toBeDeleted = [];
let isFolderSelected = false;
if (this.isMultiSelect()) {
const requests = [];
this.__selection.forEach(selection => {
if (selection && osparc.file.FilesTree.isFile(selection)) {
const request = this.__deleteFile(selection);
if (request) {
requests.push(request);
if (selection) {
toBeDeleted.push(selection);
if (osparc.file.FilesTree.isDir(selection)) {
isFolderSelected = true;
}
}
});
Promise.all(requests)
.then(datas => {
if (datas.length) {
this.fireDataEvent("fileDeleted", datas[0]);
osparc.FlashMessenger.getInstance().logAs(this.tr("Files successfully deleted"), "INFO");
}
});
requests
} else if (this.__selection.length) {
const selection = this.__selection[0];
if (selection && osparc.file.FilesTree.isFile(selection)) {
const request = this.__deleteFile(selection);
if (request) {
request
.then(data => {
this.fireDataEvent("fileDeleted", data);
osparc.FlashMessenger.getInstance().logAs(this.tr("File successfully deleted"), "INFO");
});
if (selection) {
if (osparc.file.FilesTree.isDir(selection)) {
isFolderSelected = true;
}
}
}

let msg = this.tr("This operation cannot be undone.");
msg += isFolderSelected ? ("<br>"+this.tr("All the content of the folders will be deleted.")) : "";
msg += "<br>" + this.tr("Do you want to proceed?");
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
caption: this.tr("Delete"),
confirmText: this.tr("Delete"),
confirmAction: "delete"
});
confirmationWin.center();
confirmationWin.open();
confirmationWin.addListener("close", () => {
if (confirmationWin.getConfirmed()) {
this.__doDeleteSelected(toBeDeleted);
}
}, this);
},

__retrieveURLAndDownloadFile: function(file) {
const fileId = file.getFileId();
const locationId = file.getLocation();
osparc.utils.Utils.retrieveURLAndDownload(locationId, fileId)
.then(data => {
if (data) {
osparc.DownloadLinkTracker.getInstance().downloadLinkUnattended(data.link, data.fileName);
__doDeleteSelected: function(toBeDeleted) {
const requests = [];
toBeDeleted.forEach(selection => {
if (selection) {
let request = null;
if (osparc.file.FilesTree.isFile(selection)) {
request = this.__deleteItem(selection.getFileId(), selection.getLocation());
} else {
request = this.__deleteItem(selection.getPath(), selection.getLocation());
}
if (request) {
requests.push(request);
}
}
});
Promise.all(requests)
.then(datas => {
if (datas.length) {
this.fireDataEvent("fileDeleted", datas[0]);
osparc.FlashMessenger.getInstance().logAs(this.tr("Items successfully deleted"), "INFO");
}
});
},

__deleteFile: function(file) {
const fileId = file.getFileId();
const locationId = file.getLocation();
__deleteItem: function(itemId, locationId) {
if (locationId !== 0 && locationId !== "0") {
osparc.FlashMessenger.getInstance().logAs(this.tr("Only files in simcore.s3 can be deleted"));
osparc.FlashMessenger.getInstance().logAs(this.tr("Only items in simcore.s3 can be deleted"));
return null;
}
const dataStore = osparc.store.Data.getInstance();
return dataStore.deleteFile(locationId, fileId);
return dataStore.deleteFile(locationId, itemId);
},
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ qx.Class.define("osparc.file.FileTreeItem", {
itemId: {
check: "String",
event: "changeItemId",
apply: "_applyItemId",
apply: "__applyItemId",
nullable: true
},

Expand Down Expand Up @@ -144,7 +144,6 @@ qx.Class.define("osparc.file.FileTreeItem", {

// Add lastModified
const lastModifiedWidget = new qx.ui.basic.Label().set({
width: 140,
maxWidth: 140,
textAlign: "right"
});
Expand All @@ -162,7 +161,6 @@ qx.Class.define("osparc.file.FileTreeItem", {

// Add size
const sizeWidget = new qx.ui.basic.Label().set({
width: 70,
maxWidth: 70,
textAlign: "right"
});
Expand All @@ -175,39 +173,13 @@ qx.Class.define("osparc.file.FileTreeItem", {
}
});
this.addWidget(sizeWidget);


const permissions = osparc.data.Permissions.getInstance();
// Add Path
const pathWidget = new qx.ui.basic.Label().set({
width: 300,
maxWidth: 300,
textAlign: "right"
});
this.bind("path", pathWidget, "value");
this.addWidget(pathWidget);
permissions.bind("role", pathWidget, "visibility", {
converter: () => permissions.canDo("study.nodestree.uuid.read") ? "visible" : "excluded"
});

// Add NodeId
const fileIdWidget = new qx.ui.basic.Label().set({
width: 300,
maxWidth: 300,
textAlign: "right"
});
this.bind("fileId", fileIdWidget, "value");
this.addWidget(fileIdWidget);
permissions.bind("role", fileIdWidget, "visibility", {
converter: () => permissions.canDo("study.nodestree.uuid.read") ? "visible" : "excluded"
});
},

// override
_applyItemId: function(value, old) {
__applyItemId: function(value, old) {
osparc.utils.Utils.setIdToWidget(this, "fileTreeItem_" + value);
},

// override
_applyIcon: function(value, old) {
this.base(arguments, value, old);
const icon = this.getChildControl("icon", true);
Expand Down
Loading
Loading