Skip to content

Commit 1426f32

Browse files
committed
Merge branch 'add-template-type-filtering' of github.com:matusdrobuliak66/osparc-simcore into enh/filter-types
2 parents 22717a8 + 2e3cd1f commit 1426f32

File tree

18 files changed

+284
-57
lines changed

18 files changed

+284
-57
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
from datetime import datetime
6-
from enum import Enum, auto
6+
from enum import Enum
77
from typing import Annotated, Any, Final, TypeAlias
88
from uuid import UUID
99

@@ -54,9 +54,9 @@ class ProjectType(str, Enum):
5454

5555

5656
class ProjectTemplateType(StrAutoEnum):
57-
TEMPLATE = auto()
58-
TUTORIAL = auto()
59-
HYPERTOOL = auto()
57+
TEMPLATE = "TEMPLATE"
58+
TUTORIAL = "TUTORIAL"
59+
HYPERTOOL = "HYPERTOOL"
6060

6161

6262
class BaseProjectModel(BaseModel):

packages/postgres-database/src/simcore_postgres_database/webserver_models.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
""" Facade for webserver service
1+
"""Facade for webserver service
22
3-
Facade to direct access to models in the database by
4-
the webserver service
3+
Facade to direct access to models in the database by
4+
the webserver service
55
66
"""
7+
78
from .models.api_keys import api_keys
89
from .models.classifiers import group_classifiers
910
from .models.comp_pipeline import StateType, comp_pipeline
1011
from .models.comp_tasks import DB_CHANNEL_NAME, NodeClass, comp_tasks
1112
from .models.confirmations import ConfirmationAction, confirmations
1213
from .models.groups import GroupType, groups, user_to_groups
1314
from .models.products import products
14-
from .models.projects import ProjectType, projects
15+
from .models.projects import ProjectTemplateType, ProjectType, projects
1516
from .models.projects_nodes import projects_nodes
1617
from .models.projects_tags import projects_tags
1718
from .models.projects_to_wallet import projects_to_wallet
@@ -35,6 +36,7 @@
3536
"projects",
3637
"projects_nodes",
3738
"ProjectType",
39+
"ProjectTemplateType",
3840
"scicrunch_resources",
3941
"StateType",
4042
"projects_tags",

services/efs-guardian/requirements/_base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ mako==1.3.5
262262
# alembic
263263
markdown-it-py==3.0.0
264264
# via rich
265-
markupsafe==3.0.1
265+
markupsafe==3.0.2
266266
# via mako
267267
mdurl==0.1.2
268268
# via markdown-it-py

services/efs-guardian/requirements/_test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ lazy-object-proxy==1.10.0
164164
# via openapi-spec-validator
165165
lupa==2.4
166166
# via fakeredis
167-
markupsafe==3.0.1
167+
markupsafe==3.0.2
168168
# via
169169
# -c requirements/_base.txt
170170
# jinja2

services/resource-usage-tracker/requirements/_base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ mako==1.3.2
278278
# alembic
279279
markdown-it-py==3.0.0
280280
# via rich
281-
markupsafe==2.1.5
281+
markupsafe==3.0.2
282282
# via mako
283283
matplotlib==3.8.3
284284
# via prometheus-api-client

services/resource-usage-tracker/requirements/_test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ mako==1.3.2
149149
# -c requirements/../../../requirements/constraints.txt
150150
# -c requirements/_base.txt
151151
# alembic
152-
markupsafe==2.1.5
152+
markupsafe==3.0.2
153153
# via
154154
# -c requirements/_base.txt
155155
# jinja2

services/web/server/requirements/_base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ mako==1.2.2
402402
# alembic
403403
markdown-it-py==3.0.0
404404
# via rich
405-
markupsafe==2.1.1
405+
markupsafe==3.0.2
406406
# via
407407
# jinja2
408408
# mako

services/web/server/requirements/_test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ markdown-it-py==3.0.0
149149
# via
150150
# -c requirements/_base.txt
151151
# rich
152-
markupsafe==2.1.1
152+
markupsafe==3.0.2
153153
# via
154154
# -c requirements/_base.txt
155155
# jinja2

services/web/server/src/simcore_service_webserver/application_settings.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
# NOTE: to mark a plugin as a DEV-FEATURE annotated it with
5757
# `Field(json_schema_extra={_X_DEV_FEATURE_FLAG: True})`
5858
# This will force it to be disabled when WEBSERVER_DEV_FEATURES_ENABLED=False
59-
_X_DEV_FEATURE_FLAG: Final[str] = "x-dev-feature"
59+
_X_FEATURE_UNDER_DEVELOPMENT: Final[str] = "x-dev-feature"
6060

6161

6262
class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
@@ -108,10 +108,9 @@ class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
108108
WEBSERVER_FUNCTIONS: Annotated[
109109
bool,
110110
Field(
111-
validation_alias=AliasChoices("WEBSERVER_FUNCTIONS"),
112-
json_schema_extra={_X_DEV_FEATURE_FLAG: True},
111+
json_schema_extra={_X_FEATURE_UNDER_DEVELOPMENT: True},
113112
),
114-
] = False
113+
] = True
115114

116115
WEBSERVER_LOGLEVEL: Annotated[
117116
LogLevel,
@@ -406,8 +405,8 @@ def _build_vcs_release_url_if_unset(cls, values):
406405

407406
@model_validator(mode="before")
408407
@classmethod
409-
def _enable_only_if_dev_features_allowed(cls, data: Any) -> Any:
410-
"""Force disables plugins marked 'under development' when WEBSERVER_DEV_FEATURES_ENABLED=False"""
408+
def _disable_features_under_development_in_production(cls, data: Any) -> Any:
409+
"""Force disables plugins marked '_X_FEATURE_UNDER_DEVELOPMENT' when WEBSERVER_DEV_FEATURES_ENABLED=False"""
411410

412411
dev_features_allowed = TypeAdapter(bool).validate_python(
413412
data.get("WEBSERVER_DEV_FEATURES_ENABLED", False)
@@ -423,7 +422,8 @@ def _enable_only_if_dev_features_allowed(cls, data: Any) -> Any:
423422
field.json_schema_extra(json_schema)
424423

425424
assert isinstance(json_schema, dict) # nosec
426-
if json_schema.get(_X_DEV_FEATURE_FLAG):
425+
if json_schema.get(_X_FEATURE_UNDER_DEVELOPMENT):
426+
assert not dev_features_allowed # nosec
427427
_logger.warning(
428428
"'%s' is still under development and will be forcibly disabled [WEBSERVER_DEV_FEATURES_ENABLED=%s].",
429429
field_name,

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from ..exceptions import (
2828
ClustersKeeperNotAvailableError,
2929
DefaultPricingUnitNotFoundError,
30+
InsufficientRoleForProjectTemplateTypeUpdateError,
3031
NodeNotFoundError,
3132
ParentNodeNotFoundError,
3233
ProjectDeleteError,
@@ -40,6 +41,7 @@
4041
ProjectOwnerNotFoundInTheProjectAccessRightsError,
4142
ProjectStartsTooManyDynamicNodesError,
4243
ProjectTooManyProjectOpenedError,
44+
ProjectTypeAndTemplateIncompatibilityError,
4345
ProjectWalletPendingTransactionError,
4446
WrongTagIdsInQueryError,
4547
)
@@ -88,6 +90,10 @@
8890
status.HTTP_403_FORBIDDEN,
8991
"Do not have sufficient access rights on project {project_uuid} for this action",
9092
),
93+
InsufficientRoleForProjectTemplateTypeUpdateError: HttpErrorInfo(
94+
status.HTTP_403_FORBIDDEN,
95+
"Do not have sufficient access rights on updating project template type",
96+
),
9197
ProjectInvalidUsageError: HttpErrorInfo(
9298
status.HTTP_422_UNPROCESSABLE_ENTITY,
9399
"Invalid usage for project",
@@ -124,6 +130,10 @@
124130
status.HTTP_400_BAD_REQUEST,
125131
"Wrong tag IDs in query",
126132
),
133+
ProjectTypeAndTemplateIncompatibilityError: HttpErrorInfo(
134+
status.HTTP_400_BAD_REQUEST,
135+
"Wrong project type and template type combination: {reason}",
136+
),
127137
}
128138

129139

0 commit comments

Comments
 (0)