Skip to content

Commit 12f54aa

Browse files
authored
Merge branch 'master' into feature/wallets-direct-link
2 parents dd5d21f + 9c5e641 commit 12f54aa

File tree

13 files changed

+151
-207
lines changed

13 files changed

+151
-207
lines changed

packages/models-library/src/models_library/api_schemas_webserver/catalog.py

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pydantic import Extra, Field
55
from pydantic.main import BaseModel
66

7-
from ..api_schemas_catalog import services
7+
from ..api_schemas_catalog import services as api_schemas_catalog_services
88
from ..services import ServiceInput, ServiceOutput, ServicePortKey
99
from ..utils.change_case import snake_to_camel
1010
from ._base import InputSchema, OutputSchema
@@ -19,21 +19,6 @@ def _orjson_dumps(v, *, default=None) -> str:
1919
return dump
2020

2121

22-
class ServiceGet(services.ServiceGet): # pylint: disable=too-many-ancestors
23-
class Config(OutputSchema.Config):
24-
...
25-
26-
27-
class ServiceUpdate(services.ServiceUpdate):
28-
class Config(InputSchema.Config):
29-
...
30-
31-
32-
class ServiceResourcesGet(services.ServiceResourcesGet):
33-
class Config(OutputSchema.Config):
34-
...
35-
36-
3722
class _BaseCommonApiExtension(BaseModel):
3823
unit_long: str | None = Field(
3924
None,
@@ -53,6 +38,8 @@ class Config:
5338

5439

5540
class ServiceInputGet(ServiceInput, _BaseCommonApiExtension):
41+
"""Extends fields of api_schemas_catalog.services.ServiceGet.outputs[*]"""
42+
5643
key_id: ServiceInputKey = Field(
5744
..., description="Unique name identifier for this input"
5845
)
@@ -91,6 +78,8 @@ class Config(_BaseCommonApiExtension.Config):
9178

9279

9380
class ServiceOutputGet(ServiceOutput, _BaseCommonApiExtension):
81+
"""Extends fields of api_schemas_catalog.services.ServiceGet.outputs[*]"""
82+
9483
key_id: ServiceOutputKey = Field(
9584
..., description="Unique name identifier for this input"
9685
)
@@ -108,3 +97,65 @@ class Config(_BaseCommonApiExtension.Config):
10897
"keyId": "output_2",
10998
}
11099
}
100+
101+
102+
ServiceInputsGetDict: TypeAlias = dict[ServicePortKey, ServiceInputGet]
103+
ServiceOutputsGetDict: TypeAlias = dict[ServicePortKey, ServiceOutputGet]
104+
105+
106+
class ServiceGet(api_schemas_catalog_services.ServiceGet):
107+
# pylint: disable=too-many-ancestors
108+
inputs: ServiceInputsGetDict = Field( # type: ignore[assignment]
109+
..., description="inputs with extended information"
110+
)
111+
outputs: ServiceOutputsGetDict = Field( # type: ignore[assignment]
112+
..., description="outputs with extended information"
113+
)
114+
115+
class Config(OutputSchema.Config):
116+
schema_extra: ClassVar[dict[str, Any]] = {
117+
"example": {
118+
"name": "File Picker",
119+
"thumbnail": None,
120+
"description": "description",
121+
"classifiers": [],
122+
"quality": {},
123+
"accessRights": {
124+
"1": {"execute_access": True, "write_access": False},
125+
"4": {"execute_access": True, "write_access": True},
126+
},
127+
"key": "simcore/services/frontend/file-picker",
128+
"version": "1.0.0",
129+
"integration-version": None,
130+
"type": "dynamic",
131+
"badges": None,
132+
"authors": [
133+
{
134+
"name": "Red Pandas",
135+
"email": "[email protected]",
136+
"affiliation": None,
137+
}
138+
],
139+
"contact": "[email protected]",
140+
"inputs": {
141+
f"input{i}": example
142+
for i, example in enumerate(
143+
ServiceInputGet.Config.schema_extra["examples"]
144+
)
145+
},
146+
"outputs": {
147+
"outFile": ServiceOutputGet.Config.schema_extra["example"],
148+
},
149+
"owner": "[email protected]",
150+
}
151+
}
152+
153+
154+
class ServiceUpdate(api_schemas_catalog_services.ServiceUpdate):
155+
class Config(InputSchema.Config):
156+
...
157+
158+
159+
class ServiceResourcesGet(api_schemas_catalog_services.ServiceResourcesGet):
160+
class Config(OutputSchema.Config):
161+
...

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import re
22
from datetime import datetime
33
from enum import Enum
4-
from typing import Any, ClassVar, Final
4+
from typing import Any, ClassVar, Final, TypeAlias
55
from uuid import uuid4
66

77
import arrow
@@ -476,8 +476,8 @@ def validate_thumbnail(cls, value): # pylint: disable=no-self-argument,no-self-
476476
return value
477477

478478

479-
ServiceInputsDict = dict[ServicePortKey, ServiceInput]
480-
ServiceOutputsDict = dict[ServicePortKey, ServiceOutput]
479+
ServiceInputsDict: TypeAlias = dict[ServicePortKey, ServiceInput]
480+
ServiceOutputsDict: TypeAlias = dict[ServicePortKey, ServiceOutput]
481481

482482

483483
class ServiceDockerData(ServiceKeyVersion, _BaseServiceCommonDataModel):

packages/postgres-database/src/simcore_postgres_database/models/projects.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
""" Projects table
22
3-
- Every row fits a project document schemed as api/specs/webserver/v0/components/schemas/project-v0.0.1.json
4-
53
"""
64
import enum
75

packages/postgres-database/tests/products/test_utils_products.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ async def test_get_or_create_group_product(
101101
assert product_group_id is None
102102

103103

104+
@pytest.mark.skip(
105+
reason="Not relevant. Will review in https://github.com/ITISFoundation/osparc-simcore/issues/3754"
106+
)
104107
async def test_get_or_create_group_product_concurrent(
105108
pg_engine: Engine, make_products_table: Callable
106109
):

packages/pytest-simcore/src/pytest_simcore/schemas.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ def _run_diff(schema_lhs: dict, schema_rhs: dict) -> subprocess.CompletedProcess
105105

106106
# NOTE: When debugging the differences, as of now both schemas come from
107107
# pydantic model, now it is possible to visually compare the difference. To do so,
108-
# just dereference the current pydantic schema. Example can be seen here:
109-
# /osparc-simcore/api/specs/webserver/scripts/openapi_project.py
108+
# just dereference the current pydantic schema.
110109

111110
return subprocess.run(
112111
[json_diff_script, schema_lhs_path, schema_rhs_path],

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

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -578,18 +578,6 @@ qx.Class.define("osparc.data.model.Node", {
578578
});
579579
},
580580

581-
__deleteInBackend: function() {
582-
// remove node in the backend
583-
const params = {
584-
url: {
585-
studyId: this.getStudy().getUuid(),
586-
nodeId: this.getNodeId()
587-
}
588-
};
589-
osparc.data.Resources.fetch("studies", "deleteNode", params)
590-
.catch(err => console.error(err));
591-
},
592-
593581
__applyPropsForm: function() {
594582
const checkIsPipelineRunning = () => {
595583
const isPipelineRunning = this.getStudy().isPipelineRunning();
@@ -1503,8 +1491,28 @@ qx.Class.define("osparc.data.model.Node", {
15031491
},
15041492

15051493
removeNode: function() {
1506-
this.__deleteInBackend();
1507-
this.removeIFrame();
1494+
return new Promise(resolve => {
1495+
this.__deleteInBackend()
1496+
.then(() => {
1497+
resolve(true);
1498+
this.removeIFrame();
1499+
})
1500+
.catch(err => {
1501+
console.error(err);
1502+
resolve(false);
1503+
});
1504+
});
1505+
},
1506+
1507+
__deleteInBackend: function() {
1508+
// remove node in the backend
1509+
const params = {
1510+
url: {
1511+
studyId: this.getStudy().getUuid(),
1512+
nodeId: this.getNodeId()
1513+
}
1514+
};
1515+
return osparc.data.Resources.fetch("studies", "deleteNode", params);
15081516
},
15091517

15101518
stopRequestingStatus: function() {

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

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -503,34 +503,35 @@ qx.Class.define("osparc.data.model.Workbench", {
503503
this.fireEvent("pipelineChanged");
504504
},
505505

506-
removeNode: function(nodeId) {
506+
removeNode: async function(nodeId) {
507507
if (!osparc.data.Permissions.getInstance().canDo("study.node.delete", true)) {
508508
return false;
509509
}
510510

511-
// remove first the connected edges
512-
const connectedEdges = this.getConnectedEdges(nodeId);
513-
connectedEdges.forEach(connectedEdgeId => {
514-
this.removeEdge(connectedEdgeId);
515-
});
516-
517511
let node = this.getNode(nodeId);
518512
if (node) {
519-
node.removeNode();
513+
const removed = await node.removeNode();
514+
if (removed) {
515+
// remove first the connected edges
516+
const connectedEdges = this.getConnectedEdges(nodeId);
517+
connectedEdges.forEach(connectedEdgeId => {
518+
this.removeEdge(connectedEdgeId);
519+
});
520520

521-
const isTopLevel = Object.prototype.hasOwnProperty.call(this.__rootNodes, nodeId);
522-
if (isTopLevel) {
523-
delete this.__rootNodes[nodeId];
524-
}
521+
const isTopLevel = Object.prototype.hasOwnProperty.call(this.__rootNodes, nodeId);
522+
if (isTopLevel) {
523+
delete this.__rootNodes[nodeId];
524+
}
525525

526-
// remove it from slideshow
527-
if (this.getStudy()) {
528-
this.getStudy().getUi().getSlideshow()
529-
.removeNode(nodeId);
530-
}
526+
// remove it from slideshow
527+
if (this.getStudy()) {
528+
this.getStudy().getUi().getSlideshow()
529+
.removeNode(nodeId);
530+
}
531531

532-
this.fireEvent("pipelineChanged");
533-
return true;
532+
this.fireEvent("pipelineChanged");
533+
return true;
534+
}
534535
}
535536
return false;
536537
},

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,10 +1276,11 @@ qx.Class.define("osparc.desktop.WorkbenchView", {
12761276
}
12771277
},
12781278

1279-
__doRemoveNode: function(nodeId) {
1279+
__doRemoveNode: async function(nodeId) {
12801280
const workbench = this.getStudy().getWorkbench();
12811281
const connectedEdges = workbench.getConnectedEdges(nodeId);
1282-
if (workbench.removeNode(nodeId)) {
1282+
const removed = await workbench.removeNode(nodeId);
1283+
if (removed) {
12831284
// remove first the connected edges
12841285
for (let i = 0; i < connectedEdges.length; i++) {
12851286
const edgeId = connectedEdges[i];

services/web/server/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ requirements: ## compiles pip requirements (.in -> .txt)
1515

1616
.PHONY: openapi-specs
1717
openapi-specs: ## updates and validates openapi specifications
18-
$(MAKE_C) $(CURDIR)/src/simcore_service_${APP_NAME}/api $@
18+
$(MAKE_C) $(REPO_BASE_DIR)/api/specs/web-server all

services/web/server/setup.cfg

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ commit_args = --no-verify
77

88
[bumpversion:file:VERSION]
99

10-
[bumpversion:file:../../../api/specs/webserver/openapi.yaml]
11-
1210
[bumpversion:file:./src/simcore_service_webserver/api/v0/openapi.yaml]
1311

1412
[tool:pytest]
1513
addopts = --strict-markers
1614
asyncio_mode = auto
17-
markers =
15+
markers =
1816
slow: marks tests as slow (deselect with '-m "not slow"')
1917
acceptance_test: "marks tests as 'acceptance tests' i.e. does the system do what the user expects? Typically those are workflows."
2018
testit: "marks test to run during development"

services/web/server/src/simcore_service_webserver/api/Makefile

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
To modify the OpenAPI Specs, please do it in api/specs/webserver and then run `make openapi-specs` in the current dir
1+
To modify the OpenAPI Specs, please run
2+
```cmd
3+
cd api/specs/web-server
4+
make install
5+
make all
6+
```

0 commit comments

Comments
 (0)