Skip to content

Commit 690aacb

Browse files
author
Andrei Neagu
committed
Merge remote-tracking branch 'upstream/master' into pr-osparc-speedup-lrt-result
2 parents 7397724 + 7913c04 commit 690aacb

File tree

50 files changed

+723
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+723
-194
lines changed

.github/workflows/ci-pact-master.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
PACT_BROKER_PASSWORD: ${{ secrets.PACT_BROKER_PASSWORD }}
2323
steps:
2424
- name: setup python environment
25-
uses: actions/setup-python@v5
25+
uses: actions/setup-python@v6
2626
with:
2727
python-version: "3.11"
2828
- name: install uv

.github/workflows/ci-testing-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ jobs:
861861
with:
862862
driver: docker-container
863863
- name: setup python environment
864-
uses: actions/setup-python@v5
864+
uses: actions/setup-python@v6
865865
with:
866866
python-version: ${{ matrix.python }}
867867
- name: install uv
@@ -1851,7 +1851,7 @@ jobs:
18511851
with:
18521852
python-version: ${{ matrix.python }}
18531853
cache-dependency-glob: "**/e2e/requirements/requirements.txt"
1854-
- uses: actions/setup-node@v4.4.0
1854+
- uses: actions/setup-node@v5.0.0
18551855
with:
18561856
node-version: ${{ matrix.node }}
18571857
cache: "npm"

.github/workflows/ci-testing-pull-request.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ubuntu-latest
3636
steps:
3737
- name: setup python environment
38-
uses: actions/setup-python@v5
38+
uses: actions/setup-python@v6
3939
with:
4040
python-version: "3.11"
4141
- name: install uv
@@ -65,7 +65,7 @@ jobs:
6565
runs-on: ubuntu-latest
6666
steps:
6767
- name: setup python environment
68-
uses: actions/setup-python@v5
68+
uses: actions/setup-python@v6
6969
with:
7070
python-version: "3.11"
7171
- name: checkout
@@ -93,7 +93,7 @@ jobs:
9393
runs-on: ubuntu-latest
9494
steps:
9595
- name: setup python environment
96-
uses: actions/setup-python@v5
96+
uses: actions/setup-python@v6
9797
with:
9898
python-version: "3.11"
9999
- name: checkout

api/specs/web-server/_functions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
FunctionGroupPathParams,
2424
)
2525
from simcore_service_webserver.functions._controller._functions_rest_schemas import (
26+
FunctionDeleteQueryParams,
2627
FunctionGetQueryParams,
2728
FunctionPathParams,
2829
FunctionsListQueryParams,
@@ -80,6 +81,7 @@ async def update_function(
8081
)
8182
async def delete_function(
8283
_path: Annotated[FunctionPathParams, Depends()],
84+
_query: Annotated[as_query(FunctionDeleteQueryParams), Depends()],
8385
): ...
8486

8587

packages/models-library/src/models_library/functions_errors.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ class FunctionIDNotFoundError(FunctionBaseError):
1717
status_code: int = 404 # Not Found
1818

1919

20+
class FunctionHasJobsCannotDeleteError(FunctionBaseError):
21+
msg_template: str = (
22+
"Cannot delete function {function_id} because it has {jobs_count} associated job(s)."
23+
)
24+
status_code: int = 409 # Conflict
25+
26+
2027
class FunctionJobIDNotFoundError(FunctionBaseError):
2128
msg_template: str = "Function job {function_job_id} not found"
2229
status_code: int = 404 # Not Found

services/static-webserver/client/source/class/osparc/auth/Data.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ qx.Class.define("osparc.auth.Data", {
7575
check: "Number"
7676
},
7777

78-
username: {
78+
userName: {
7979
check: "String",
8080
init: null,
8181
nullable: false,
82-
event: "changeUsername",
82+
event: "changeUserName",
8383
},
8484

8585
email: {
@@ -139,12 +139,12 @@ qx.Class.define("osparc.auth.Data", {
139139
return osparc.utils.Utils.cookie.getCookie("user") === "logout";
140140
},
141141

142-
getFriendlyUsername: function() {
142+
getFriendlyUserName: function() {
143143
const firstName = this.getFirstName();
144144
if (firstName) {
145145
return firstName;
146146
}
147-
return this.getUsername();
147+
return this.getUserName();
148148
},
149149

150150
getFullName: function() {

services/static-webserver/client/source/class/osparc/auth/Manager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ qx.Class.define("osparc.auth.Manager", {
258258
const authData = osparc.auth.Data.getInstance();
259259
authData.set({
260260
email: profile["login"],
261-
username: profile["userName"],
261+
userName: profile["userName"],
262262
firstName: profile["first_name"],
263263
lastName: profile["last_name"],
264264
expirationDate: profile["expirationDate"] ? new Date(profile["expirationDate"]) : null

services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ qx.Class.define("osparc.auth.ui.LoginView", {
7373
const email = new qx.ui.form.TextField().set({
7474
required: true
7575
});
76-
email.getContentElement().setAttribute("autocomplete", "username");
76+
email.getContentElement().setAttribute("autocomplete", "userName");
7777
osparc.utils.Utils.setIdToWidget(email, "loginUserEmailFld");
7878
this._form.add(email, " Email", qx.util.Validate.email(), "email");
7979
const focusEmail = () => {

services/static-webserver/client/source/class/osparc/dashboard/CardBase.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -914,13 +914,13 @@ qx.Class.define("osparc.dashboard.CardBase", {
914914
const currentUserGroupIds = osparc.study.Utils.state.getCurrentGroupIds(state);
915915
const usersStore = osparc.store.Users.getInstance();
916916
const userPromises = currentUserGroupIds.map(userGroupId => usersStore.getUser(userGroupId));
917-
const usernames = [];
917+
const userNames = [];
918918
let toolTip = "";
919919
let image = null;
920920
Promise.all(userPromises)
921921
.then(usersResult => {
922922
usersResult.forEach(user => {
923-
usernames.push(user.getUsername());
923+
userNames.push(user.getUserName());
924924
});
925925
})
926926
.catch(error => {
@@ -952,8 +952,8 @@ qx.Class.define("osparc.dashboard.CardBase", {
952952
image = "@FontAwesome5Solid/lock/";
953953
break;
954954
}
955-
usernames.forEach(username => {
956-
toolTip += "<br>" + username;
955+
userNames.forEach(userName => {
956+
toolTip += "<br>" + userName;
957957
});
958958
this.__showBlockedCard(image, toolTip);
959959
});

services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js

Lines changed: 64 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,8 +1640,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
16401640
return deleteButton;
16411641
},
16421642

1643-
1644-
16451643
__createSelectButton: function() {
16461644
const selectButton = new qx.ui.form.ToggleButton().set({
16471645
appearance: "form-button-outlined",
@@ -1794,12 +1792,12 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
17941792
this._reloadCards();
17951793
},
17961794

1797-
__removeFromStudyList: function(studyId) {
1798-
const idx = this._resourcesList.findIndex(study => study["uuid"] === studyId);
1795+
__removeFromList: function(resourceUuid) {
1796+
const idx = this._resourcesList.findIndex(resource => resource["uuid"] === resourceUuid);
17991797
if (idx > -1) {
18001798
this._resourcesList.splice(idx, 1);
18011799
}
1802-
this._resourcesContainer.removeCard(studyId);
1800+
this._resourcesContainer.removeCard(resourceUuid);
18031801
},
18041802

18051803
_populateCardMenu: function(card) {
@@ -1812,7 +1810,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
18121810
this._populateTemplateCardMenu(card);
18131811
break;
18141812
case "function":
1815-
card.getChildControl("menu-selection-stack").exclude();
1813+
this.__populateFunctionCardMenu(card);
18161814
break;
18171815
}
18181816
},
@@ -1919,6 +1917,14 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
19191917
card.evaluateMenuButtons();
19201918
},
19211919

1920+
__populateFunctionCardMenu: function(card) {
1921+
const menu = card.getMenu();
1922+
const functionData = card.getResourceData();
1923+
1924+
const deleteButton = this.__getDeleteFunctionMenuButton(functionData);
1925+
menu.add(deleteButton);
1926+
},
1927+
19221928
__getOpenLocationMenuButton: function(studyData) {
19231929
const openLocationButton = new qx.ui.menu.Button(this.tr("Open location"), "@FontAwesome5Solid/external-link-alt/12");
19241930
openLocationButton.addListener("execute", () => {
@@ -1994,7 +2000,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
19942000
__doMoveStudy: function(studyData, destWorkspaceId, destFolderId) {
19952001
this.__moveStudyToWorkspace(studyData, destWorkspaceId) // first move to workspace
19962002
.then(() => this.__moveStudyToFolder(studyData, destFolderId)) // then move to folder
1997-
.then(() => this.__removeFromStudyList(studyData["uuid"]))
2003+
.then(() => this.__removeFromList(studyData["uuid"]))
19982004
.catch(err => osparc.FlashMessenger.logError(err));
19992005
},
20002006

@@ -2192,6 +2198,54 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
21922198
return deleteButton;
21932199
},
21942200

2201+
__getDeleteFunctionMenuButton: function(functionData) {
2202+
const deleteButton = new qx.ui.menu.Button(this.tr("Delete"), "@FontAwesome5Solid/trash/12");
2203+
deleteButton.set({
2204+
appearance: "menu-button"
2205+
});
2206+
osparc.utils.Utils.setIdToWidget(deleteButton, "functionItemMenuDelete");
2207+
deleteButton.addListener("execute", () => {
2208+
this.__popUpDeleteFunctionWindow(functionData, false);
2209+
}, this);
2210+
return deleteButton;
2211+
},
2212+
2213+
__popUpDeleteFunctionWindow: function(functionData, force, message) {
2214+
const win = this.__createConfirmDeleteWindow([functionData.title]);
2215+
win.setCaption(this.tr("Delete function"));
2216+
if (force) {
2217+
if (message) {
2218+
win.setMessage(message);
2219+
} else {
2220+
const msg = this.tr("The function has associated jobs. Are you sure you want to delete it?");
2221+
win.setMessage(msg);
2222+
}
2223+
}
2224+
win.center();
2225+
win.open();
2226+
win.addListener("close", () => {
2227+
if (win.getConfirmed()) {
2228+
this.__doDeleteFunction(functionData, force);
2229+
}
2230+
}, this);
2231+
},
2232+
2233+
__doDeleteFunction: function(functionData, force = false) {
2234+
osparc.store.Functions.deleteFunction(functionData.uuid, force)
2235+
.then(() => {
2236+
this.__removeFromList(functionData.uuid);
2237+
const msg = this.tr("Successfully deleted");
2238+
osparc.FlashMessenger.logAs(msg, "INFO");
2239+
})
2240+
.catch(err => {
2241+
if (err && err.status && err.status === 409) {
2242+
this.__popUpDeleteFunctionWindow(functionData, true, err.message);
2243+
} else {
2244+
osparc.FlashMessenger.logError(err);
2245+
}
2246+
});
2247+
},
2248+
21952249
__getStudyData: function(id) {
21962250
return this._resourcesList.find(study => study.uuid === id);
21972251
},
@@ -2303,7 +2357,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
23032357
__untrashStudy: function(studyData) {
23042358
osparc.store.Study.getInstance().untrashStudy(studyData.uuid)
23052359
.then(() => {
2306-
this.__removeFromStudyList(studyData.uuid);
2360+
this.__removeFromList(studyData.uuid);
23072361
const msg = this.tr("Successfully restored");
23082362
osparc.FlashMessenger.logAs(msg, "INFO");
23092363
this._resourceFilter.evaluateTrashEmpty();
@@ -2315,7 +2369,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
23152369
__trashStudy: function(studyData) {
23162370
osparc.store.Study.getInstance().trashStudy(studyData.uuid)
23172371
.then(() => {
2318-
this.__removeFromStudyList(studyData.uuid);
2372+
this.__removeFromList(studyData.uuid);
23192373
const msg = this.tr("Successfully deleted");
23202374
osparc.FlashMessenger.logAs(msg, "INFO");
23212375
this._resourceFilter.setTrashEmpty(false);
@@ -2353,7 +2407,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
23532407
operationPromise = osparc.store.Study.getInstance().deleteStudy(studyData.uuid);
23542408
}
23552409
operationPromise
2356-
.then(() => this.__removeFromStudyList(studyData.uuid))
2410+
.then(() => this.__removeFromList(studyData.uuid))
23572411
.catch(err => osparc.FlashMessenger.logError(err))
23582412
.finally(() => this.resetSelection());
23592413
},

0 commit comments

Comments
 (0)