Skip to content

Commit d954f2d

Browse files
authored
Merge branch 'master' into mai/enhance-auth
2 parents 1478c27 + 3148d13 commit d954f2d

36 files changed

+77
-311
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2656,7 +2656,7 @@ jobs:
26562656
if: ${{ always() }}
26572657
needs:
26582658
[
2659-
system-test-e2e,
2659+
# system-test-e2e, NOTE: not required, until Odei will have a look
26602660
system-test-e2e-playwright,
26612661
system-test-environment-setup,
26622662
system-test-public-api,

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

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
405405
services: {
406406
check: "Array",
407407
init: true,
408-
nullable: false,
408+
nullable: true,
409409
apply: "__applyServices",
410410
event: "changeServices",
411411
},
@@ -567,7 +567,11 @@ qx.Class.define("osparc.dashboard.CardBase", {
567567
resourceData["services"] = services;
568568
this.setServices(services);
569569
})
570-
.catch(err => console.error(err));
570+
.catch(err => {
571+
resourceData["services"] = null;
572+
this.setServices(null);
573+
console.error(err);
574+
});
571575

572576
osparc.study.Utils.guessIcon(resourceData)
573577
.then(iconSource => this.setIcon(iconSource));
@@ -688,27 +692,38 @@ qx.Class.define("osparc.dashboard.CardBase", {
688692
},
689693

690694
__applyServices: function(services) {
691-
this.setEmptyWorkbench(services.length === 0);
692-
693-
// Updatable study
694-
if (osparc.study.Utils.anyServiceRetired(services)) {
695-
this.setUpdatable("retired");
696-
} else if (osparc.study.Utils.anyServiceDeprecated(services)) {
697-
this.setUpdatable("deprecated");
698-
} else if (osparc.study.Utils.anyServiceUpdatable(services)) {
699-
this.setUpdatable("updatable");
700-
}
701-
702-
// Block card
703-
const cantReadServices = osparc.study.Utils.getCantReadServices(services);
704-
if (cantReadServices.length) {
695+
const unknownServices = cantReadServices => {
696+
// Block card
705697
this.setBlocked("UNKNOWN_SERVICES");
706698
const image = "@FontAwesome5Solid/ban/";
707-
let toolTipText = this.tr("Inaccessible service(s):");
708-
cantReadServices.forEach(unSrv => {
709-
toolTipText += "<br>" + unSrv.key + ":" + osparc.service.Utils.extractVersionDisplay(unSrv.release);
710-
});
699+
let toolTipText = this.tr("Unknown service(s)");
700+
if (cantReadServices && cantReadServices.length) {
701+
toolTipText = this.tr("Inaccessible service(s)");
702+
cantReadServices.forEach(unSrv => {
703+
toolTipText += "<br>" + unSrv.key + ":" + osparc.service.Utils.extractVersionDisplay(unSrv.release);
704+
});
705+
}
711706
this.__showBlockedCard(image, toolTipText);
707+
};
708+
709+
if (services) {
710+
this.setEmptyWorkbench(services.length === 0);
711+
712+
// Updatable study
713+
if (osparc.study.Utils.anyServiceRetired(services)) {
714+
this.setUpdatable("retired");
715+
} else if (osparc.study.Utils.anyServiceDeprecated(services)) {
716+
this.setUpdatable("deprecated");
717+
} else if (osparc.study.Utils.anyServiceUpdatable(services)) {
718+
this.setUpdatable("updatable");
719+
}
720+
721+
const cantReadServices = osparc.study.Utils.getCantReadServices(services);
722+
if (cantReadServices.length) {
723+
unknownServices(cantReadServices);
724+
}
725+
} else {
726+
unknownServices();
712727
}
713728

714729
this.evaluateMenuButtons();

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ qx.Class.define("osparc.dashboard.DataBrowser", {
4343
let control;
4444
switch (id) {
4545
case "tree-folder-view":
46-
control = new osparc.file.TreeFolderView();
46+
control = new osparc.file.TreeFolderView().set({
47+
paddingBottom: 15,
48+
});
4749
this._addToLayout(control, {
4850
flex: 1
4951
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
804804
__getCreateTemplatePage: function() {
805805
if (
806806
!osparc.utils.Resources.isStudy(this.__resourceData) ||
807-
osparc.product.Utils.showTemplates()
807+
!osparc.product.Utils.showTemplates()
808808
) {
809809
return null;
810810
}

services/static-webserver/client/source/class/osparc/data/Resources.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ qx.Class.define("osparc.data.Resources", {
151151
},
152152
postToTemplate: {
153153
method: "POST",
154-
url: statics.API + "/projects?from_study={study_id}&as_template=true&copy_data={copy_data}"
154+
url: statics.API + "/projects?from_study={study_id}&as_template=true&copy_data={copy_data}&hidden={hidden}"
155155
},
156156
open: {
157157
method: "POST",
@@ -303,6 +303,10 @@ qx.Class.define("osparc.data.Resources", {
303303
method: "POST",
304304
url: statics.API + "/projects/{studyId}/workspaces/{workspaceId}:move"
305305
},
306+
updateMetadata: {
307+
method: "PATCH",
308+
url: statics.API + "/projects/{studyId}/metadata"
309+
},
306310
}
307311
},
308312
"conversations": {

services/static-webserver/client/source/class/osparc/desktop/MainPage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ qx.Class.define("osparc.desktop.MainPage", {
240240
const params = {
241241
url: {
242242
"study_id": studyId,
243-
"copy_data": copyData
243+
"copy_data": copyData,
244+
"hidden": false,
244245
},
245246
};
246247
const options = {

services/static-webserver/client/source/class/osparc/study/CreateFunction.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,12 @@ qx.Class.define("osparc.study.CreateFunction", {
282282
__createFunction: function(exposedInputs, exposedOutputs) {
283283
this.__createFunctionBtn.setFetching(true);
284284

285-
// first publish it as a template
285+
// first publish it as a hidden template
286286
const params = {
287287
url: {
288288
"study_id": this.__studyData["uuid"],
289289
"copy_data": true,
290+
"hidden": true,
290291
},
291292
};
292293
const options = {
@@ -298,7 +299,8 @@ qx.Class.define("osparc.study.CreateFunction", {
298299
.then(task => {
299300
task.addListener("resultReceived", e => {
300301
const templateData = e.getData();
301-
this.__doCreateFunction(templateData, exposedInputs, exposedOutputs);
302+
this.__updateTemplateMetadata(templateData);
303+
this.__registerFunction(templateData, exposedInputs, exposedOutputs);
302304
});
303305
})
304306
.catch(err => {
@@ -307,13 +309,27 @@ qx.Class.define("osparc.study.CreateFunction", {
307309
});
308310
},
309311

310-
__doCreateFunction: function(templateData, exposedInputs, exposedOutputs) {
312+
__updateTemplateMetadata: function(templateData) {
313+
const patchData = {
314+
"custom" : {
315+
"hidden": "Base template for function",
316+
}
317+
};
318+
const params = {
319+
url: {
320+
"studyId": templateData["uuid"],
321+
},
322+
data: patchData
323+
};
324+
osparc.data.Resources.fetch("studies", "updateMetadata", params)
325+
.catch(err => console.error(err));
326+
},
327+
328+
__registerFunction: function(templateData, exposedInputs, exposedOutputs) {
311329
const nameField = this.__form.getItem("name");
312330
const descriptionField = this.__form.getItem("description");
313331

314332
const functionData = this.self().createFunctionData(templateData, nameField.getValue(), descriptionField.getValue(), exposedInputs, exposedOutputs);
315-
console.log("functionData", functionData);
316-
317333
const params = {
318334
data: functionData,
319335
};

services/static-webserver/client/source/class/osparc/study/Utils.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,9 @@ qx.Class.define("osparc.study.Utils", {
355355
},
356356

357357
__getBlockedState: function(studyData) {
358-
if (studyData["services"]) {
358+
if (studyData["services"] === null) {
359+
return "UNKNOWN_SERVICES";
360+
} else if (studyData["services"]) {
359361
const cantReadServices = osparc.study.Utils.getCantReadServices(studyData["services"]);
360362
const inaccessibleServices = osparc.store.Services.getInaccessibleServices(studyData["workbench"]);
361363
if (cantReadServices.length || inaccessibleServices.length) {

services/web/server/src/simcore_service_webserver/projects/_controller/projects_rest.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from servicelib.redis import get_project_locked_state
2929

3030
from ..._meta import API_VTAG as VTAG
31-
from ...catalog import catalog_service
3231
from ...login.decorators import login_required
3332
from ...redis import get_redis_lock_manager_client_sdk
3433
from ...resource_manager.user_sessions import PROJECT_ID_KEY, managed_resource
@@ -39,7 +38,6 @@
3938
from .. import _crud_api_create, _crud_api_read, _projects_service
4039
from .._permalink_service import update_or_pop_permalink_in_project
4140
from ..models import ProjectDict
42-
from ..utils import are_project_services_available, get_project_unavailable_services
4341
from . import _rest_utils
4442
from ._rest_exceptions import handle_plugin_requests_exceptions
4543
from ._rest_schemas import (
@@ -271,10 +269,6 @@ async def get_project(request: web.Request):
271269
req_ctx = AuthenticatedRequestContext.model_validate(request)
272270
path_params = parse_request_path_parameters_as(ProjectPathParams, request)
273271

274-
user_available_services = await catalog_service.get_services_for_user_in_product(
275-
request.app, user_id=req_ctx.user_id, product_name=req_ctx.product_name
276-
)
277-
278272
project = await _projects_service.get_project_for_user(
279273
request.app,
280274
project_uuid=f"{path_params.project_id}",
@@ -283,21 +277,6 @@ async def get_project(request: web.Request):
283277
include_trashed_by_primary_gid=True,
284278
)
285279

286-
if not are_project_services_available(project, user_available_services):
287-
unavilable_services = get_project_unavailable_services(
288-
project, user_available_services
289-
)
290-
formatted_services = ", ".join(
291-
f"{service}:{version}" for service, version in unavilable_services
292-
)
293-
# TODO: lack of permissions should be notified with https://httpstatuses.com/403 web.HTTPForbidden
294-
raise web.HTTPNotFound(
295-
reason=(
296-
f"Project '{path_params.project_id}' uses unavailable services. Please ask "
297-
f"for permission for the following services {formatted_services}"
298-
)
299-
)
300-
301280
# Adds permalink
302281
await update_or_pop_permalink_in_project(request, project)
303282

services/web/server/src/simcore_service_webserver/projects/_crud_api_read.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
)
2323
from simcore_postgres_database.webserver_models import ProjectType as ProjectTypeDB
2424

25-
from ..catalog import catalog_service
2625
from ..folders import _folders_repository
2726
from ..workspaces.api import check_user_workspace_access
2827
from . import _projects_service
@@ -120,10 +119,6 @@ async def list_projects( # pylint: disable=too-many-arguments
120119
) -> tuple[list[ProjectDict], int]:
121120
db = ProjectDBAPI.get_from_app_context(app)
122121

123-
user_available_services = await catalog_service.get_services_for_user_in_product(
124-
app, user_id=user_id, product_name=product_name
125-
)
126-
127122
workspace_is_private = True
128123
if workspace_id:
129124
await check_user_workspace_access(
@@ -165,7 +160,6 @@ async def list_projects( # pylint: disable=too-many-arguments
165160
filter_by_template_type=(
166161
ProjectTemplateTypeDB(template_type) if template_type else None
167162
),
168-
filter_by_services=user_available_services,
169163
filter_trashed=trashed,
170164
filter_hidden=show_hidden,
171165
# composed attrs
@@ -202,17 +196,12 @@ async def list_projects_full_depth(
202196
) -> tuple[list[ProjectDict], int]:
203197
db = ProjectDBAPI.get_from_app_context(app)
204198

205-
user_available_services = await catalog_service.get_services_for_user_in_product(
206-
app, user_id=user_id, product_name=product_name
207-
)
208-
209199
db_projects, db_project_types, total_number_projects = await db.list_projects_dicts(
210200
product_name=product_name,
211201
user_id=user_id,
212202
workspace_query=WorkspaceQuery(workspace_scope=WorkspaceScope.ALL),
213203
folder_query=FolderQuery(folder_scope=FolderScope.ALL),
214204
filter_trashed=trashed,
215-
filter_by_services=user_available_services,
216205
filter_by_project_type=ProjectType.STANDARD,
217206
search_by_multi_columns=search_by_multi_columns,
218207
search_by_project_name=search_by_project_name,

0 commit comments

Comments
 (0)