Skip to content

🎨 [Frontend] Improve blocked card's UX #6207

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 39 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
34cf072
minor
odeimaiz Aug 19, 2024
3002f73
locked -> blocked
odeimaiz Aug 19, 2024
df5f6f7
it's not Boolean anymore
odeimaiz Aug 19, 2024
342d544
block card
odeimaiz Aug 19, 2024
8af9637
Merge branch 'master' into enh/blocked-studies
odeimaiz Aug 19, 2024
548afad
Merge branch 'enh/blocked-studies' of github.com:odeimaiz/osparc-simc…
odeimaiz Aug 19, 2024
df0a470
remove dummy
odeimaiz Aug 19, 2024
d01851b
open Study Details in some blocked scenarios
odeimaiz Aug 19, 2024
24f5107
minor
odeimaiz Aug 19, 2024
cd7c584
minor
odeimaiz Aug 19, 2024
c91816b
refactor
odeimaiz Aug 19, 2024
5436c42
minor
odeimaiz Aug 19, 2024
259e96f
minor
odeimaiz Aug 19, 2024
6295c79
atomic operations
odeimaiz Aug 19, 2024
206f1c8
minor
odeimaiz Aug 19, 2024
9ad9198
enable menu button
odeimaiz Aug 19, 2024
f6bc4ab
evaluateMenuButtons
odeimaiz Aug 19, 2024
d2d74c4
Merge branch 'master' into enh/blocked-studies
odeimaiz Aug 20, 2024
67dfed3
__getBlockedState
odeimaiz Aug 20, 2024
a4a6131
Merge branch 'enh/blocked-studies' of github.com:odeimaiz/osparc-simc…
odeimaiz Aug 20, 2024
29e1231
refactoring
odeimaiz Aug 20, 2024
7693f7a
minor
odeimaiz Aug 20, 2024
a1f018d
minor
odeimaiz Aug 20, 2024
85b3cdf
minor
odeimaiz Aug 20, 2024
7d305af
minor
odeimaiz Aug 20, 2024
a3911c9
minor
odeimaiz Aug 20, 2024
352d82e
__infoPage
odeimaiz Aug 20, 2024
c588d35
minor
odeimaiz Aug 20, 2024
a3c5767
Increase Maintenance notice
odeimaiz Aug 21, 2024
3f11ed1
comments
odeimaiz Aug 21, 2024
6bf8533
more checks
odeimaiz Aug 21, 2024
535f236
list billableServices in finally
odeimaiz Aug 21, 2024
dad25dd
increase tooltip's showTimeout number
odeimaiz Aug 21, 2024
38d9241
Disable some pages
odeimaiz Aug 21, 2024
890c134
cleanup
odeimaiz Aug 21, 2024
6eed267
catch error
odeimaiz Aug 21, 2024
6239444
canMoveToFolder
odeimaiz Aug 21, 2024
8fb5a57
tooltip timeouts
odeimaiz Aug 21, 2024
f33f4e6
Merge branch 'master' into enh/blocked-studies
odeimaiz Aug 21, 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 @@ -41,8 +41,8 @@ qx.Class.define("osparc.MaintenanceTracker", {

statics: {
CHECK_INTERVAL: 15*60*1000, // Check every 15'
CLOSABLE_WARN_IN_ADVANCE: 24*60*60*1000, // Show Ribbon Closable Message 24h in advance
PERMANENT_WARN_IN_ADVANCE: 30*60*1000 // Show Ribbon Permanent Message 30' in advance
CLOSABLE_WARN_IN_ADVANCE: 48*60*60*1000, // Show Closable Ribbon Message 48h in advance
PERMANENT_WARN_IN_ADVANCE: 60*60*1000 // Show Permanent Ribbon Message 60' in advance
},

members: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
state: {
check: "Object",
nullable: false,
apply: "_applyState"
apply: "__applyState"
},

projectState: {
Expand All @@ -359,11 +359,11 @@ qx.Class.define("osparc.dashboard.CardBase", {
apply: "_applyProjectState"
},

locked: {
check: "Boolean",
blocked: {
check: [true, "UNKNOWN_SERVICES", "IN_USE", false],
init: false,
nullable: false,
apply: "_applyLocked"
apply: "__applyBlocked"
},

menu: {
Expand Down Expand Up @@ -515,7 +515,6 @@ qx.Class.define("osparc.dashboard.CardBase", {
uiModeIcon.set({
source,
toolTipText,
alignY: "bottom"
});
}
},
Expand Down Expand Up @@ -552,7 +551,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
// Block card
const unaccessibleServices = osparc.study.Utils.getInaccessibleServices(workbench)
if (unaccessibleServices.length) {
this.__enableCard(false);
this.setBlocked("UNKNOWN_SERVICES");
const image = "@FontAwesome5Solid/ban/";
let toolTipText = this.tr("Service info missing");
unaccessibleServices.forEach(unSrv => {
Expand Down Expand Up @@ -600,16 +599,17 @@ qx.Class.define("osparc.dashboard.CardBase", {
}
},

_applyState: function(state) {
__applyState: function(state) {
const locked = ("locked" in state) ? state["locked"]["value"] : false;
const projectState = ("state" in state) ? state["state"]["value"] : undefined;
this.setBlocked(locked ? "IN_USE" : false);
if (locked) {
this.__showBlockedCardFromStatus(state["locked"]);
}

const projectState = ("state" in state) ? state["state"]["value"] : undefined;
if (projectState) {
this._applyProjectState(state["state"]);
}
this.setLocked(locked);
},

_applyProjectState: function(projectStatus) {
Expand Down Expand Up @@ -722,46 +722,70 @@ qx.Class.define("osparc.dashboard.CardBase", {
}
},

_applyLocked: function(locked) {
this.__enableCard(!locked);
__applyBlocked: function(blocked) {
const enabled = !blocked;
if (enabled) {
this.resetToolTipText();
}

this._getChildren().forEach(item => {
if (item) {
item.setOpacity(enabled ? 1.0 : 0.7);
}
});

this.getChildControl("lock-status").set({
appearance: "form-button-outlined/disabled",
textColor: "text-disabled",
opacity: 1.0,
visibility: locked ? "visible" : "excluded"
visibility: enabled ? "excluded" : "visible"
});

// let the "pointer" cursor for IN_USE or UNKNOWN_SERVICE
this.set({
cursor: locked ? "not-allowed" : "pointer"
cursor: blocked === true ? "not-allowed" : "pointer"
});

[
"tick-selected",
"tick-unselected",
"menu-button"
// "menu-button"
].forEach(childName => {
const child = this.getChildControl(childName);
child.set({
enabled: !locked
});
child.setEnabled(enabled);
});

this.evaluateMenuButtons();
},

__enableCard: function(enabled) {
if (enabled) {
this.resetToolTipText();
}
evaluateMenuButtons: function() {
if (this.getMenu()) {
const menuButtons = this.getMenu().getChildren();
const resourceData = this.getResourceData();

this._getChildren().forEach(item => {
if (item) {
item.setOpacity(enabled ? 1.0 : 0.7);
}
});

if (this.getMenu() && this.getMenu().getChildren()) {
const openButton = this.getMenu().getChildren().find(menuBtn => "openResource" in menuBtn);
const openButton = menuButtons.find(menuBtn => "openResourceButton" in menuBtn);
if (openButton) {
openButton.setEnabled(enabled);
openButton.setEnabled(osparc.study.Utils.canBeOpened(resourceData));
}
const duplicateButton = menuButtons.find(menuBtn => "duplicateButton" in menuBtn);
if (duplicateButton) {
duplicateButton.setEnabled(osparc.study.Utils.canBeDuplicated(resourceData));
}
const exportCMISButton = menuButtons.find(menuBtn => "exportCMISButton" in menuBtn);
if (exportCMISButton) {
exportCMISButton.setEnabled(osparc.study.Utils.canBeExported(resourceData));
}
const studyDataButton = menuButtons.find(menuBtn => "studyDataButton" in menuBtn);
if (studyDataButton) {
studyDataButton.setEnabled(osparc.study.Utils.canShowStudyData(resourceData));
}
const moveToFolderButton = menuButtons.find(menuBtn => "moveToFolderButton" in menuBtn);
if (moveToFolderButton) {
moveToFolderButton.setEnabled(osparc.study.Utils.canMoveToFolder(resourceData));
}
const deleteButton = menuButtons.find(menuBtn => "deleteButton" in menuBtn);
if (deleteButton) {
deleteButton.setEnabled(osparc.study.Utils.canBeDeleted(resourceData));
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
},

__itemSelected: function() {
if (this.isLocked()) {
// It could be blocked by IN_USE or UNKNOWN_SERVICE
if (this.getBlocked() === true) {
this.setValue(false);
return;
}
Expand Down Expand Up @@ -279,6 +280,7 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
menu.setPosition("top-left");
osparc.utils.Utils.prettifyMenu(menu);
osparc.utils.Utils.setIdToWidget(menu, "studyItemMenuMenu");
this.evaluateMenuButtons();
}
menuButton.setVisibility(menu ? "visible" : "excluded");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ qx.Class.define("osparc.dashboard.GridButtonPlaceholder", {
});
},

isLocked: function() {
getBlocked: function() {
return true;
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ qx.Class.define("osparc.dashboard.ListButtonBase", {
TITLE: 2,
PROGRESS: 3,
DESCRIPTION: 4,
UPDATES: 5,
UI_MODE: 6,
TAGS: 7,
TAGS: 5,
UPDATES: 6,
UI_MODE: 7,
STATUS: 8,
PERMISSION: 9,
TSR: 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,20 @@ qx.Class.define("osparc.dashboard.ListButtonItem", {
},

__itemSelected: function() {
// It could be blocked by IN_USE or UNKNOWN_SERVICE
if (this.getBlocked() === true) {
this.setValue(false);
return;
}

if (this.isResourceType("study") && this.isMultiSelectionMode()) {
const selected = this.getValue();

if (this.isLocked() && selected) {
this.setValue(false);
}

const tick = this.getChildControl("tick-selected");
tick.setVisibility(selected ? "visible" : "excluded");

const untick = this.getChildControl("tick-unselected");
this.getChildControl("menu-selection-stack").setSelection([selected ? tick : untick]);
untick.setVisibility(selected ? "excluded" : "visible");
} else {
this.__showMenuOnly();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ qx.Class.define("osparc.dashboard.ListButtonPlaceholder", {
});
},

isLocked: function() {
getBlocked: function() {
return true;
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {

_getOpenMenuButton: function(resourceData) {
const openButton = new qx.ui.menu.Button(this.tr("Open"));
openButton.openResource = true;
openButton["openResourceButton"] = true;
openButton.addListener("execute", () => {
switch (resourceData["resourceType"]) {
case "study": {
Expand Down
Loading
Loading