Skip to content

Commit 59f66ef

Browse files
committed
merge master into 7199-create-storage-workhorse-mode
2 parents 5b99737 + d432c6c commit 59f66ef

File tree

27 files changed

+508
-107
lines changed

27 files changed

+508
-107
lines changed

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from .utils.enums import StrAutoEnum
1414

1515
LicensedItemID: TypeAlias = UUID
16+
LicensedResourceID: TypeAlias = UUID
1617

1718

1819
class LicensedResourceType(StrAutoEnum):
@@ -90,6 +91,28 @@ class LicensedItemUpdateDB(BaseModel):
9091
trash: bool | None = None
9192

9293

94+
class LicensedResourceDB(BaseModel):
95+
licensed_resource_id: LicensedResourceID
96+
display_name: str
97+
98+
licensed_resource_name: str
99+
licensed_resource_type: LicensedResourceType
100+
licensed_resource_data: dict[str, Any] | None
101+
102+
# states
103+
created: datetime
104+
modified: datetime
105+
trashed: datetime | None
106+
107+
model_config = ConfigDict(from_attributes=True)
108+
109+
110+
class LicensedResourcePatchDB(BaseModel):
111+
display_name: str | None = None
112+
licensed_resource_name: str | None = None
113+
trash: bool | None = None
114+
115+
93116
class LicensedItem(BaseModel):
94117
licensed_item_id: LicensedItemID
95118
display_name: str
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
"""add licensed resources
2+
3+
Revision ID: 68777fdf9539
4+
Revises: 061607911a22
5+
Create Date: 2025-02-09 10:24:50.533653+00:00
6+
7+
"""
8+
import sqlalchemy as sa
9+
from alembic import op
10+
from sqlalchemy.dialects import postgresql
11+
12+
# revision identifiers, used by Alembic.
13+
revision = "68777fdf9539"
14+
down_revision = "061607911a22"
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
# Reuse the existing Enum type
20+
existing_enum = sa.Enum("VIP_MODEL", name="licensedresourcetype", native_enum=False)
21+
22+
23+
def upgrade():
24+
# ### commands auto generated by Alembic - please adjust! ###
25+
op.create_table(
26+
"licensed_resources",
27+
sa.Column(
28+
"licensed_resource_id",
29+
postgresql.UUID(as_uuid=True),
30+
server_default=sa.text("gen_random_uuid()"),
31+
nullable=False,
32+
),
33+
sa.Column("display_name", sa.String(), nullable=False),
34+
sa.Column("licensed_resource_name", sa.String(), nullable=False),
35+
sa.Column(
36+
"licensed_resource_type",
37+
existing_enum, # Reuse existing Enum instead of redefining it
38+
nullable=False,
39+
),
40+
sa.Column(
41+
"licensed_resource_data",
42+
postgresql.JSONB(astext_type=sa.Text()),
43+
nullable=True,
44+
),
45+
sa.Column(
46+
"created",
47+
sa.DateTime(timezone=True),
48+
server_default=sa.text("now()"),
49+
nullable=False,
50+
),
51+
sa.Column(
52+
"modified",
53+
sa.DateTime(timezone=True),
54+
server_default=sa.text("now()"),
55+
nullable=False,
56+
),
57+
sa.Column(
58+
"trashed",
59+
sa.DateTime(timezone=True),
60+
nullable=True,
61+
comment="The date and time when the licensed_resources was marked as trashed. Null if the licensed_resources has not been trashed [default].",
62+
),
63+
sa.PrimaryKeyConstraint("licensed_resource_id"),
64+
sa.UniqueConstraint(
65+
"licensed_resource_name",
66+
"licensed_resource_type",
67+
name="uq_licensed_resource_name_type2",
68+
),
69+
)
70+
# ### end Alembic commands ###
71+
72+
# Migration of licensed resources from licensed_items table to new licensed_resources table
73+
op.execute(
74+
sa.DDL(
75+
"""
76+
INSERT INTO licensed_resources (display_name, licensed_resource_name, licensed_resource_type, licensed_resource_data, created, modified)
77+
SELECT
78+
display_name,
79+
licensed_resource_name,
80+
licensed_resource_type,
81+
licensed_resource_data,
82+
CURRENT_TIMESTAMP as created,
83+
CURRENT_TIMESTAMP as modified
84+
FROM licensed_items
85+
"""
86+
)
87+
)
88+
89+
90+
def downgrade():
91+
# ### commands auto generated by Alembic - please adjust! ###
92+
op.drop_table("licensed_resources")
93+
# ### end Alembic commands ###
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
""" resource_tracker_service_runs table
2+
"""
3+
4+
5+
import sqlalchemy as sa
6+
from sqlalchemy.dialects import postgresql
7+
8+
from ._common import (
9+
column_created_datetime,
10+
column_modified_datetime,
11+
column_trashed_datetime,
12+
)
13+
from .base import metadata
14+
from .licensed_items import LicensedResourceType
15+
16+
licensed_resources = sa.Table(
17+
"licensed_resources",
18+
metadata,
19+
sa.Column(
20+
"licensed_resource_id",
21+
postgresql.UUID(as_uuid=True),
22+
nullable=False,
23+
primary_key=True,
24+
server_default=sa.text("gen_random_uuid()"),
25+
),
26+
sa.Column(
27+
"display_name",
28+
sa.String,
29+
nullable=False,
30+
doc="Display name for front-end",
31+
),
32+
sa.Column(
33+
"licensed_resource_name",
34+
sa.String,
35+
nullable=False,
36+
doc="Resource name identifier",
37+
),
38+
sa.Column(
39+
"licensed_resource_type",
40+
sa.Enum(LicensedResourceType),
41+
nullable=False,
42+
doc="Resource type, ex. VIP_MODEL",
43+
),
44+
sa.Column(
45+
"licensed_resource_data",
46+
postgresql.JSONB,
47+
nullable=True,
48+
doc="Resource metadata. Used for read-only purposes",
49+
),
50+
column_created_datetime(timezone=True),
51+
column_modified_datetime(timezone=True),
52+
column_trashed_datetime("licensed_resources"),
53+
sa.UniqueConstraint(
54+
"licensed_resource_name",
55+
"licensed_resource_type",
56+
name="uq_licensed_resource_name_type2",
57+
),
58+
)

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,9 @@ qx.Class.define("osparc.data.model.Node", {
549549
return this.getIframeHandler() ? this.getIframeHandler().getLoadingPage() : null;
550550
},
551551

552-
__applyPropsForm: function() {
552+
__applyPropsForm: function(propsForm) {
553+
osparc.utils.Utils.setIdToWidget(propsForm, "settingsForm_" + this.getNodeId());
554+
553555
const checkIsPipelineRunning = () => {
554556
const isPipelineRunning = this.getStudy().isPipelineRunning();
555557
this.getPropsForm().setEnabled(!isPipelineRunning);

services/static-webserver/client/source/class/osparc/node/slideshow/NodeView.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ qx.Class.define("osparc.node.slideshow.NodeView", {
3838

3939
statics: {
4040
LOGGER_HEIGHT: 28,
41-
42-
isPropsFormShowable: function(node) {
43-
if (node && ("getPropsForm" in node) && node.getPropsForm()) {
44-
return node.getPropsForm().hasVisibleInputs();
45-
}
46-
return false;
47-
}
4841
},
4942

5043
members: {
@@ -135,8 +128,8 @@ qx.Class.define("osparc.node.slideshow.NodeView", {
135128
},
136129

137130
isSettingsGroupShowable: function() {
138-
const node = this.getNode();
139-
return this.self().isPropsFormShowable(node);
131+
// do not show Settings in App Mode
132+
return false;
140133
},
141134

142135
__iFrameChanged: function() {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ qx.Class.define("osparc.study.Utils", {
401401
// the was to guess the TI type is to check the boot mode of the ti-postpro in the pipeline
402402
const tiPostpro = Object.values(studyData["workbench"]).find(srv => srv.key.includes("ti-postpro"));
403403
if (tiPostpro && tiPostpro["bootOptions"]) {
404-
console.log(tiPostpro);
405404
switch (tiPostpro["bootOptions"]["boot_mode"]) {
406405
case "0":
407406
// classic TI

services/static-webserver/client/source/class/osparc/ui/basic/DateAndBy.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,12 @@ qx.Class.define("osparc.ui.basic.DateAndBy", {
9696
const atom = this.getChildControl("last-touching");
9797
const myGroupId = osparc.auth.Data.getInstance().getGroupId();
9898
if (groupId === myGroupId) {
99-
atom.setLabel("by me");
99+
atom.set({
100+
label: "by me",
101+
icon: null,
102+
})
100103
} else {
101-
atom.setLabel("by");
104+
atom.setLabel("by ");
102105
osparc.dashboard.CardBase.addHintFromGids(atom, [groupId]);
103106
}
104107
}

services/static-webserver/client/source/class/osparc/vipMarket/AnatomicalModelDetails.js

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -73,29 +73,39 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
7373
}
7474
},
7575

76-
__createModelInfo: function(anatomicalModelsData) {
77-
const cardGrid = new qx.ui.layout.Grid(16, 16);
78-
const cardLayout = new qx.ui.container.Composite(cardGrid);
76+
__createModelInfo: function(anatomicalModelsDataSource) {
77+
const cardLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(16));
7978

80-
const description = anatomicalModelsData["description"] || "";
81-
description.split(" - ").forEach((desc, idx) => {
79+
const description = anatomicalModelsDataSource["description"] || "";
80+
const delimiter = " - ";
81+
let titleAndSubtitle = description.split(delimiter);
82+
if (titleAndSubtitle.length > 0) {
8283
const titleLabel = new qx.ui.basic.Label().set({
83-
value: desc,
84+
value: titleAndSubtitle[0],
8485
font: "text-16",
85-
alignX: "center",
8686
alignY: "middle",
8787
allowGrowX: true,
8888
allowGrowY: true,
8989
});
90-
cardLayout.add(titleLabel, {
91-
column: 0,
92-
row: idx,
93-
colSpan: 2,
90+
cardLayout.add(titleLabel);
91+
titleAndSubtitle.shift();
92+
}
93+
if (titleAndSubtitle.length > 0) {
94+
titleAndSubtitle = titleAndSubtitle.join(delimiter);
95+
const subtitleLabel = new qx.ui.basic.Label().set({
96+
value: titleAndSubtitle,
97+
font: "text-16",
98+
alignY: "middle",
99+
allowGrowX: true,
100+
allowGrowY: true,
94101
});
95-
});
102+
cardLayout.add(subtitleLabel);
103+
}
104+
96105

106+
const middleLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(16));
97107
const thumbnail = new qx.ui.basic.Image().set({
98-
source: anatomicalModelsData["thumbnail"],
108+
source: anatomicalModelsDataSource["thumbnail"],
99109
alignY: "middle",
100110
scale: true,
101111
allowGrowX: true,
@@ -105,12 +115,9 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
105115
maxWidth: 256,
106116
maxHeight: 256,
107117
});
108-
cardLayout.add(thumbnail, {
109-
column: 0,
110-
row: 2,
111-
});
118+
middleLayout.add(thumbnail);
112119

113-
const features = anatomicalModelsData["features"];
120+
const features = anatomicalModelsDataSource["features"];
114121
const featuresGrid = new qx.ui.layout.Grid(8, 8);
115122
const featuresLayout = new qx.ui.container.Composite(featuresGrid);
116123
let idx = 0;
@@ -176,15 +183,14 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
176183
}
177184
return doiLabel;
178185
};
179-
featuresLayout.add(doiToLink(anatomicalModelsData["doi"]), {
186+
featuresLayout.add(doiToLink(anatomicalModelsDataSource["doi"]), {
180187
column: 1,
181188
row: idx,
182189
});
183190

184-
cardLayout.add(featuresLayout, {
185-
column: 1,
186-
row: 2,
187-
});
191+
middleLayout.add(featuresLayout);
192+
193+
cardLayout.add(middleLayout);
188194

189195
return cardLayout;
190196
},

services/static-webserver/client/source/class/osparc/vipMarket/VipMarket.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,15 @@ qx.Class.define("osparc.vipMarket.VipMarket", {
182182
this.__anatomicalModels = [];
183183
licensedItems.forEach(licensedItem => {
184184
const anatomicalModel = osparc.utils.Utils.deepCloneObject(licensedItem);
185-
anatomicalModel["modelId"] = anatomicalModel["licensedResourceData"]["source"]["id"];
185+
const anatomicalModelDataSource = anatomicalModel["licensedResourceData"]["source"];
186+
anatomicalModel["modelId"] = anatomicalModelDataSource["id"];
186187
anatomicalModel["thumbnail"] = "";
187188
anatomicalModel["date"] = null;
188-
if (anatomicalModel["licensedResourceData"] && anatomicalModel["licensedResourceData"]["source"]) {
189-
const anatomicalModelSource = anatomicalModel["licensedResourceData"]["source"];
190-
if (anatomicalModelSource["thumbnail"]) {
191-
anatomicalModel["thumbnail"] = anatomicalModelSource["thumbnail"];
192-
}
193-
if (anatomicalModelSource["features"] && anatomicalModelSource["features"]["date"]) {
194-
anatomicalModel["date"] = new Date(anatomicalModelSource["features"]["date"]);
195-
}
189+
if (anatomicalModelDataSource["thumbnail"]) {
190+
anatomicalModel["thumbnail"] = anatomicalModelDataSource["thumbnail"];
191+
}
192+
if (anatomicalModelDataSource["features"] && anatomicalModelDataSource["features"]["date"]) {
193+
anatomicalModel["date"] = new Date(anatomicalModelDataSource["features"]["date"]);
196194
}
197195
// attach license data
198196
anatomicalModel["licensedItemId"] = licensedItem["licensedItemId"];

0 commit comments

Comments
 (0)