Skip to content

Commit d6acc6b

Browse files
authored
Merge branch 'master' into is1771/share-tags
2 parents 97d4408 + 92ff5d5 commit d6acc6b

File tree

8 files changed

+105
-45
lines changed

8 files changed

+105
-45
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""add deprecated submit column
2+
3+
Revision ID: 307017ee1a49
4+
Revises: 1e3c9c804fec
5+
Create Date: 2025-01-06 12:53:51.604189+00:00
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
11+
12+
# revision identifiers, used by Alembic.
13+
revision = '307017ee1a49'
14+
down_revision = '1e3c9c804fec'
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade():
20+
# ### commands auto generated by Alembic - please adjust! ###
21+
op.add_column('comp_tasks', sa.Column('submit', sa.DateTime(timezone=True), server_default=sa.text("'1900-01-01T00:00:00Z'::timestamptz"), nullable=True))
22+
# ### end Alembic commands ###
23+
24+
25+
def downgrade():
26+
# ### commands auto generated by Alembic - please adjust! ###
27+
op.drop_column('comp_tasks', 'submit')
28+
# ### end Alembic commands ###

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
""" Computational Tasks Table
2-
3-
"""
1+
"""Computational Tasks Table"""
42

53
import enum
64

@@ -102,6 +100,14 @@ class NodeClass(enum.Enum):
102100
nullable=True,
103101
doc="Harware information of this task",
104102
),
103+
# deprecated columns must be kept due to legacy services
104+
# utc timestamps for submission/start/end
105+
sa.Column(
106+
"submit",
107+
sa.DateTime(timezone=True),
108+
server_default=sa.text("'1900-01-01T00:00:00Z'::timestamptz"),
109+
doc="[DEPRECATED unused but kept for legacy services and must be filled with a default value of 1 January 1900]",
110+
),
105111
# ------
106112
sa.UniqueConstraint("project_id", "node_id", name="project_node_uniqueness"),
107113
)

services/director-v2/src/simcore_service_director_v2/models/comp_tasks.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ class CompTaskAtDB(BaseModel):
150150
pricing_info: dict | None
151151
hardware_info: HardwareInfo
152152

153+
submit: dt.datetime | None = Field(
154+
default=None, deprecated=True, description="Required for legacy services"
155+
)
156+
153157
@field_validator("state", mode="before")
154158
@classmethod
155159
def _convert_state_from_state_type_enum_if_needed(cls, v):
@@ -238,7 +242,9 @@ def to_db_model(self, **exclusion_rules) -> dict[str, Any]:
238242
"pricing_unit_id": 1,
239243
"pricing_unit_cost_id": 1,
240244
},
241-
"hardware_info": next(iter(HardwareInfo.model_config["json_schema_extra"]["examples"])), # type: ignore
245+
"hardware_info": next(
246+
iter(HardwareInfo.model_config["json_schema_extra"]["examples"]) # type: ignore
247+
),
242248
}
243249
for image_example in Image.model_config["json_schema_extra"]["examples"] # type: ignore
244250
]

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

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
576576
const data = e.getData();
577577
const destWorkspaceId = data["workspaceId"];
578578
const destFolderId = data["folderId"];
579-
this._folderToFolderRequested(folderId, currentWorkspaceId, destWorkspaceId, destFolderId);
579+
this.__folderToFolderRequested(folderId, currentWorkspaceId, destWorkspaceId, destFolderId);
580580
});
581581
moveFolderTo.addListener("cancel", () => win.close());
582582
},
@@ -591,7 +591,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
591591
});
592592
},
593593

594-
_folderToFolderRequested: function(folderId, workspaceId, destWorkspaceId, destFolderId) {
594+
__folderToFolderRequested: function(folderId, workspaceId, destWorkspaceId, destFolderId) {
595595
if (destWorkspaceId === workspaceId) {
596596
this.__doMoveFolder(folderId, destWorkspaceId, destFolderId);
597597
} else {
@@ -1183,7 +1183,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
11831183
destWorkspaceId,
11841184
destFolderId,
11851185
} = e.getData();
1186-
this._moveStudyToFolderReqested(studyData, destWorkspaceId, destFolderId);
1186+
this.__studyToFolderRequested(studyData, destWorkspaceId, destFolderId);
11871187
});
11881188
workspacesAndFoldersTree.addListener("folderToFolderRequested", e => {
11891189
const {
@@ -1192,17 +1192,38 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
11921192
destWorkspaceId,
11931193
destFolderId,
11941194
} = e.getData();
1195-
this._folderToFolderRequested(folderId, workspaceId, destWorkspaceId, destFolderId);
1195+
this.__folderToFolderRequested(folderId, workspaceId, destWorkspaceId, destFolderId);
11961196
});
11971197

11981198
this._resourceFilter.addListener("trashStudyRequested", e => {
1199-
this.__trashStudyRequested(e.getData());
1199+
const studyData = e.getData();
1200+
this.__trashStudyRequested(studyData);
12001201
});
12011202
this._resourceFilter.addListener("trashFolderRequested", e => {
1202-
this._trashFolderRequested(e.getData());
1203+
const folderId = e.getData();
1204+
this._trashFolderRequested(folderId);
12031205
});
12041206
},
12051207

1208+
_studyToFolderRequested: function(data) {
1209+
const {
1210+
studyData,
1211+
destWorkspaceId,
1212+
destFolderId,
1213+
} = data;
1214+
this.__studyToFolderRequested(studyData, destWorkspaceId, destFolderId);
1215+
},
1216+
1217+
_folderToFolderRequested: function(data) {
1218+
const {
1219+
folderId,
1220+
workspaceId,
1221+
destWorkspaceId,
1222+
destFolderId,
1223+
} = data;
1224+
this.__folderToFolderRequested(folderId, workspaceId, destWorkspaceId, destFolderId);
1225+
},
1226+
12061227
__addSortByButton: function() {
12071228
const sortByButton = new osparc.dashboard.SortedByMenuButton();
12081229
sortByButton.set({
@@ -1686,7 +1707,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
16861707
});
16871708
},
16881709

1689-
_moveStudyToFolderReqested: function(studyData, destWorkspaceId, destFolderId) {
1710+
__studyToFolderRequested: function(studyData, destWorkspaceId, destFolderId) {
16901711
if (studyData["workspaceId"] === destWorkspaceId) {
16911712
this.__doMoveStudy(studyData, destWorkspaceId, destFolderId);
16921713
} else {
@@ -1713,7 +1734,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
17131734
const data = e.getData();
17141735
const destWorkspaceId = data["workspaceId"];
17151736
const destFolderId = data["folderId"];
1716-
this._moveStudyToFolderReqested(studyData, destWorkspaceId, destFolderId);
1737+
this.__studyToFolderRequested(studyData, destWorkspaceId, destFolderId);
17171738
}, this);
17181739
moveStudyTo.addListener("cancel", () => win.close());
17191740
}, this);

services/static-webserver/client/source/class/osparc/file/FilesTree.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ qx.Class.define("osparc.file.FilesTree", {
181181
newChildren[0].children[0].children.length) { // node
182182
const nodeData = newChildren[0].children[0].children[0];
183183
const nodeTreeName = nodeData.label;
184-
this.__resetTree(nodeTreeName);
184+
this.__resetTree(nodeTreeName, nodeId);
185185
const rootNodeModel = this.getModel();
186186
if (nodeData.children.length) {
187187
const nodeItemsOnly = nodeData.children;
@@ -253,12 +253,12 @@ qx.Class.define("osparc.file.FilesTree", {
253253
}
254254
},
255255

256-
__resetTree: function(treeName) {
257-
// FIXME: It is not resetting the model
256+
__resetTree: function(treeName, itemId) {
257+
itemId = itemId || treeName.replace(/\s/g, ""); // default to tree name without white spaces
258258
this.resetModel();
259259
const rootData = {
260260
label: treeName,
261-
itemId: treeName.replace(/\s/g, ""), // remove all white spaces
261+
itemId,
262262
location: null,
263263
path: null,
264264
pathLabel: [treeName],

services/static-webserver/client/source/class/osparc/file/TreeFolderView.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,14 @@ qx.Class.define("osparc.file.TreeFolderView", {
119119
let found = false;
120120
while (!found && path.length) {
121121
found = foldersTree.findItemId(path.join("/"));
122-
if (found) {
123-
foldersTree.openNodeAndParents(found);
124-
foldersTree.setSelection(new qx.data.Array([found]));
125-
foldersTree.fireEvent("selectionChanged");
126-
}
127122
// look for next parent
128123
path.pop();
129124
}
130-
if (!found) {
125+
if (found) {
126+
foldersTree.openNodeAndParents(found);
127+
foldersTree.setSelection(new qx.data.Array([found]));
128+
foldersTree.fireEvent("selectionChanged");
129+
} else {
131130
folderViewer.resetFolder();
132131
}
133132
}

services/static-webserver/client/source/class/osparc/widget/NodeDataManager.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ qx.Class.define("osparc.widget.NodeDataManager", {
125125
foldersTree.resetCache();
126126

127127
const openSameFolder = () => {
128+
if (!this.getStudyId()) {
129+
// drop first, which is the study id
130+
path.shift();
131+
}
128132
// drop last, which is the file
129133
path.pop();
130134
treeFolderView.openPath(path);

services/static-webserver/client/source/class/osparc/workbench/WorkbenchUI.js

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
129129
__selectedItemId: null,
130130
__startHint: null,
131131
__toolHint: null,
132-
__dropHereNodeUI: null,
132+
__dropHereUI: null,
133133
__selectionRectInitPos: null,
134134
__selectionRectRepr: null,
135135
__panning: null,
@@ -1685,7 +1685,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
16851685
this.setDroppable(true);
16861686
const stopDragging = e => {
16871687
this.__isDraggingLink = null;
1688-
this.__updateWidgets(false);
1688+
this.__updateDropHere(false);
16891689
};
16901690
const startDragging = e => {
16911691
this.addListenerOnce("dragleave", stopDragging, this);
@@ -1786,7 +1786,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
17861786

17871787
const posX = e.offsetX + 2;
17881788
const posY = e.offsetY + 2;
1789-
this.__updateWidgets(dragging, posX, posY);
1789+
this.__updateDropHere(dragging, posX, posY);
17901790
},
17911791

17921792
__draggingLink: function(e, dragging) {
@@ -1802,34 +1802,36 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
18021802
}
18031803

18041804
const pos = this.__pointerEventToWorkbenchPos(e);
1805-
this.__updateWidgets(dragging, pos.x, pos.y);
1805+
this.__updateDropHere(dragging, pos.x, pos.y);
18061806
},
18071807

1808-
__updateWidgets: function(dragging, posX, posY) {
1808+
__updateDropHere: function(show, posX, posY) {
18091809
const boxWidth = 120;
18101810
const boxHeight = 60;
1811-
if (this.__dropHereNodeUI === null) {
1812-
const dropHereNodeUI = this.__dropHereNodeUI = new qx.ui.basic.Label(this.tr("Drop here")).set({
1811+
if (this.__dropHereUI === null) {
1812+
const dropHereNodeUI = this.__dropHereUI = new qx.ui.basic.Label(this.tr("Drop here")).set({
18131813
font: "workbench-start-hint",
18141814
textColor: "workbench-start-hint"
18151815
});
18161816
dropHereNodeUI.exclude();
18171817
this.__workbenchLayout.add(dropHereNodeUI);
18181818
dropHereNodeUI.rect = this.__svgLayer.drawDashedRect(boxWidth, boxHeight);
18191819
}
1820-
const dropMe = this.__dropHereNodeUI;
1821-
if (dragging) {
1822-
dropMe.show();
1823-
const dropMeBounds = dropMe.getBounds() || dropMe.getSizeHint();
1824-
dropMe.setLayoutProperties({
1820+
let dropHere = this.__dropHereUI;
1821+
if (show) {
1822+
dropHere.show();
1823+
const dropMeBounds = dropHere.getBounds() || dropHere.getSizeHint();
1824+
dropHere.setLayoutProperties({
18251825
left: posX - parseInt(dropMeBounds.width/2) - parseInt(boxWidth/2),
18261826
top: posY - parseInt(dropMeBounds.height/2)- parseInt(boxHeight/2)
18271827
});
1828-
if ("rect" in dropMe) {
1829-
osparc.wrapper.Svg.updateItemPos(dropMe.rect, posX - boxWidth, posY - boxHeight);
1828+
if ("rect" in dropHere) {
1829+
osparc.wrapper.Svg.updateItemPos(dropHere.rect, posX - boxWidth, posY - boxHeight);
18301830
}
18311831
} else {
1832-
this.__removeDropHint();
1832+
dropHere.exclude();
1833+
osparc.wrapper.Svg.removeItem(dropHere.rect);
1834+
dropHere = null;
18331835
}
18341836
},
18351837

@@ -2017,14 +2019,14 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
20172019
this.__draggingLink(e, false);
20182020

20192021
if (this.__isDraggingLink && "dragData" in this.__isDraggingLink) {
2022+
const data = this.__isDraggingLink["dragData"];
2023+
this.__isDraggingLink = null;
20202024
const pos = this.__pointerEventToWorkbenchPos(e, false);
20212025
const service = qx.data.marshal.Json.createModel(osparc.service.Utils.getFilePicker());
20222026
const nodeUI = await this.__addNode(service, pos);
20232027
if (nodeUI) {
20242028
const node = nodeUI.getNode();
2025-
const data = this.__isDraggingLink["dragData"];
20262029
osparc.file.FilePicker.setOutputValueFromStore(node, data.getLocation(), data.getDatasetId(), data.getFileId(), data.getLabel());
2027-
this.__isDraggingLink = null;
20282030
}
20292031
}
20302032
},
@@ -2047,11 +2049,5 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
20472049
});
20482050
}
20492051
},
2050-
2051-
__removeDropHint: function() {
2052-
this.__dropHereNodeUI.setVisibility("excluded");
2053-
osparc.wrapper.Svg.removeItem(this.__dropHereNodeUI.rect);
2054-
this.__dropHereNodeUI = null;
2055-
}
20562052
}
20572053
});

0 commit comments

Comments
 (0)