Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
cea3e34
refactor
odeimaiz Jul 9, 2025
582491c
getOne
odeimaiz Jul 9, 2025
cefb0a9
move Study
odeimaiz Jul 9, 2025
a695559
trash and untrash
odeimaiz Jul 9, 2025
35f9409
more deleteStudy
odeimaiz Jul 9, 2025
5057505
patch
odeimaiz Jul 9, 2025
d971ba2
more patching
odeimaiz Jul 9, 2025
76be64b
add and remove tag
odeimaiz Jul 9, 2025
e3e6af6
updateMetadata
odeimaiz Jul 9, 2025
cfbbba9
singleton
odeimaiz Jul 9, 2025
17dfc14
get and select wallet
odeimaiz Jul 10, 2025
3d1ce86
Merge branch 'master' into enh/study-store
odeimaiz Jul 10, 2025
c11225c
Merge branch 'enh/study-store' of github.com:odeimaiz/osparc-simcore …
odeimaiz Jul 10, 2025
1b5cec5
bubble up error
odeimaiz Jul 10, 2025
9aec3f3
minor fix
odeimaiz Jul 10, 2025
55da9e1
Merge branch 'master' into enh/study-store
odeimaiz Jul 10, 2025
d4fa25e
less error handling in store
odeimaiz Jul 10, 2025
c4392f6
Merge branch 'enh/study-store' of github.com:odeimaiz/osparc-simcore …
odeimaiz Jul 10, 2025
554d5c4
Merge branch 'master' into enh/study-store
odeimaiz Jul 10, 2025
2e06220
Merge branch 'master' into enh/study-store
odeimaiz Jul 10, 2025
46f2575
Merge branch 'enh/study-store' of github.com:odeimaiz/osparc-simcore …
odeimaiz Jul 10, 2025
46d5ff5
Study State and debt moved to StudyStore
odeimaiz Jul 10, 2025
53434ef
Merge branch 'master' into enh/state-through-store
odeimaiz Jul 10, 2025
5781237
Merge branch 'enh/state-through-store' of github.com:odeimaiz/osparc-…
odeimaiz Jul 10, 2025
f793097
bad merge
odeimaiz Jul 10, 2025
b8b545b
bad merge II
odeimaiz Jul 10, 2025
8f47eee
bad merge III
odeimaiz Jul 10, 2025
f77a94e
payDebt
odeimaiz Jul 10, 2025
cc10263
createStudyPromise
odeimaiz Jul 10, 2025
60ed586
createStudyFromTemplate
odeimaiz Jul 10, 2025
efed10c
Merge branch 'master' into enh/state-through-store
odeimaiz Jul 11, 2025
b725a4c
Merge branch 'enh/state-through-store' of github.com:odeimaiz/osparc-…
odeimaiz Jul 11, 2025
007cd8a
Access main Store
odeimaiz Jul 11, 2025
e6d703b
invalidateStudies
odeimaiz Jul 11, 2025
80bbbc1
createTemplate
odeimaiz Jul 11, 2025
50c9efc
createTemplate
odeimaiz Jul 11, 2025
7882d3c
invalidateStudies
odeimaiz Jul 11, 2025
dc988a9
duplicateStudy
odeimaiz Jul 11, 2025
680e748
openStudy
odeimaiz Jul 11, 2025
f883996
closeStudy
odeimaiz Jul 11, 2025
7c5b1db
robot is right
odeimaiz Jul 11, 2025
9b4686a
renaming
odeimaiz Jul 11, 2025
ed8bba0
minor
odeimaiz Jul 11, 2025
8031bad
Merge branch 'master' into enh/state-through-store
odeimaiz Jul 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
case "function":
// when getting the latest study data, the debt information was lost
if (osparc.study.Utils.isInDebt(this.__resourceData)) {
const mainStore = osparc.store.Store.getInstance();
this.__resourceData["debt"] = mainStore.getStudyDebt(this.__resourceData["uuid"]);
const studyStore = osparc.store.Study.getInstance();
this.__resourceData["debt"] = studyStore.getStudyDebt(this.__resourceData["uuid"]);
}
osparc.store.Services.getStudyServicesMetadata(latestResourceData)
.finally(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -742,15 +742,15 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
this.__reloadStudies();
}, this);

const store = osparc.store.Store.getInstance();
store.addListener("studyStateChanged", e => {
const studyStore = osparc.store.Study.getInstance();
studyStore.addListener("studyStateChanged", e => {
const {
studyId,
state,
} = e.getData();
this.__studyStateChanged(studyId, state);
});
store.addListener("studyDebtChanged", e => {
studyStore.addListener("studyDebtChanged", e => {
const {
studyId,
debt,
Expand Down Expand Up @@ -924,7 +924,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
},

invalidateStudies: function() {
osparc.store.Store.getInstance().invalidate("studies");
osparc.store.Study.getInstance().invalidateStudies();
this.__resetStudiesList();
if (this._resourcesContainer.getFlatList()) {
this._resourcesContainer.getFlatList().nextRequest = null;
Expand Down Expand Up @@ -1506,7 +1506,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
// LAYOUT //

__studyStateReceived: function(studyId, state, errors) {
osparc.store.Store.getInstance().setStudyState(studyId, state);
osparc.store.Study.getInstance().setStudyState(studyId, state);
if (errors && errors.length) {
console.error(errors);
}
Expand Down Expand Up @@ -1542,10 +1542,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
minStudyData["workspaceId"] = this.getCurrentWorkspaceId();
minStudyData["folderId"] = this.getCurrentFolderId();
this._showLoadingPage(this.tr("Creating ") + (minStudyData.name || osparc.product.Utils.getStudyAlias()));
const params = {
data: minStudyData
};
osparc.study.Utils.createStudyAndPoll(params)
osparc.study.Utils.createStudyAndPoll(minStudyData)
.then(studyData => this.__startStudyAfterCreating(studyData["uuid"]))
.catch(err => {
this._hideLoadingPage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ qx.Class.define("osparc.data.Resources", {
method: "GET",
url: statics.API + "/projects:search?filters={%22trashed%22:%22true%22}&offset={offset}&limit={limit}&order_by={orderBy}&type=user"
},
postToTemplate: {
method: "POST",
url: statics.API + "/projects?from_study={study_id}&as_template=true&copy_data={copy_data}&hidden={hidden}"
},
open: {
method: "POST",
url: statics.API + "/projects/{studyId}:open"
Expand Down Expand Up @@ -620,6 +616,10 @@ qx.Class.define("osparc.data.Resources", {
method: "GET",
url: statics.API + "/projects:search?type=template&offset={offset}&limit={limit}&order_by={orderBy}&template_type={templateType}&text={text}"
},
postToTemplate: {
method: "POST",
url: statics.API + "/projects?from_study={study_id}&as_template=true&copy_data={copy_data}&hidden={hidden}"
},
}
},
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,21 +587,14 @@ qx.Class.define("osparc.data.model.Study", {
if ("disableServiceAutoStart" in this.getDev()) {
return this.getDev()["disableServiceAutoStart"];
}
return null;
return false;
},

openStudy: function() {
const params = {
url: {
"studyId": this.getUuid()
},
data: osparc.utils.Utils.getClientSessionID()
};
if (this.getDisableServiceAutoStart() !== null) {
params["url"]["disableServiceAutoStart"] = this.getDisableServiceAutoStart();
return osparc.data.Resources.fetch("studies", "openDisableAutoStart", params);
if (this.getDisableServiceAutoStart()) {
return osparc.store.Study.getInstance().openStudy(this.getUuid(), false);
}
return osparc.data.Resources.fetch("studies", "open", params);
return osparc.store.Study.getInstance().openStudy(this.getUuid());
},

stopStudy: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,22 +236,13 @@ qx.Class.define("osparc.desktop.MainPage", {
const studyId = data["studyData"].uuid;
const studyName = data["studyData"].name;
const copyData = data["copyData"];
const hidden = false;
const templateAccessRights = data["accessRights"];
const templateType = data["templateType"];

const params = {
url: {
"study_id": studyId,
"copy_data": copyData,
"hidden": false,
},
};
const options = {
pollTask: true
};
const fetchPromise = osparc.data.Resources.fetch("studies", "postToTemplate", params, options);
const pollPromise = osparc.store.Templates.createTemplate(studyId, copyData, hidden);
const pollTasks = osparc.store.PollTasks.getInstance();
pollTasks.createPollingTask(fetchPromise)
pollTasks.createPollingTask(pollPromise)
.then(task => {
const tutorialBrowser = this.__dashboard.getTutorialBrowser();
if (tutorialBrowser && templateType === osparc.data.model.StudyUI.TUTORIAL_TYPE) {
Expand Down Expand Up @@ -318,7 +309,7 @@ qx.Class.define("osparc.desktop.MainPage", {
const currentStudy = store.getCurrentStudy();
while (currentStudy.isLocked()) {
await osparc.utils.Utils.sleep(1000);
store.getStudyState(studyId);
osparc.store.Study.getInstance().getStudyState(studyId);
}
this.__loadingPage.setMessages([]);
this.__openSnapshot(studyId, snapshotId);
Expand Down Expand Up @@ -364,7 +355,7 @@ qx.Class.define("osparc.desktop.MainPage", {
const currentStudy = store.getCurrentStudy();
while (currentStudy.isLocked()) {
await osparc.utils.Utils.sleep(1000);
store.getStudyState(studyId);
osparc.store.Study.getInstance().getStudyState(studyId);
}
this.__loadingPage.setMessages([]);
this.__openIteration(iterationUuid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ qx.Class.define("osparc.desktop.StudyEditor", {
/* If no projectStateUpdated comes in 60 seconds, client must
check state of pipeline and update button accordingly. */
const timer = setTimeout(() => {
osparc.store.Store.getInstance().getStudyState(pipelineId);
osparc.store.Study.getInstance().getStudyState(pipelineId);
}, 60000);
const socket = osparc.wrapper.WebSocket.getInstance();
socket.getSocket().once("projectStateUpdated", ({ "project_uuid": projectUuid }) => {
Expand Down Expand Up @@ -928,13 +928,7 @@ qx.Class.define("osparc.desktop.StudyEditor", {
},

__closeStudy: function() {
const params = {
url: {
"studyId": this.getStudy().getUuid()
},
data: osparc.utils.Utils.getClientSessionID()
};
osparc.data.Resources.fetch("studies", "close", params)
osparc.store.Study.getInstance().closeStudy(this.getStudy().getUuid())
.catch(err => console.error(err));
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,7 @@ qx.Class.define("osparc.store.Store", {
},
},

events: {
"studyStateChanged": "qx.event.type.Data",
"studyDebtChanged": "qx.event.type.Data",
},

members: {
__studiesInDebt: null,

// fetch resources that do not require log in
preloadCalls: async function() {
await osparc.data.Resources.get("config");
Expand Down Expand Up @@ -436,73 +429,6 @@ qx.Class.define("osparc.store.Store", {
return null;
},

getStudyState: function(studyId) {
osparc.data.Resources.fetch("studies", "state", {
url: {
"studyId": studyId
}
})
.then(({state}) => {
this.setStudyState(studyId, state);
});
},

setStudyState: function(studyId, state) {
const studiesWStateCache = this.getStudies();
const idx = studiesWStateCache.findIndex(studyWStateCache => studyWStateCache["uuid"] === studyId);
if (idx !== -1) {
studiesWStateCache[idx]["state"] = state;
}

const currentStudy = this.getCurrentStudy();
if (currentStudy && currentStudy.getUuid() === studyId) {
currentStudy.setState(state);
}

this.fireDataEvent("studyStateChanged", {
studyId,
state,
});
},

setStudyDebt: function(studyId, debt) {
// init object if it does not exist
if (this.__studiesInDebt === null) {
this.__studiesInDebt = {};
}
if (debt) {
this.__studiesInDebt[studyId] = debt;
} else {
delete this.__studiesInDebt[studyId];
}

const studiesWStateCache = this.getStudies();
const idx = studiesWStateCache.findIndex(studyWStateCache => studyWStateCache["uuid"] === studyId);
if (idx !== -1) {
if (debt) {
studiesWStateCache[idx]["debt"] = debt;
} else {
delete studiesWStateCache[idx]["debt"];
}
}

this.fireDataEvent("studyDebtChanged", {
studyId,
debt,
});
},

getStudyDebt: function(studyId) {
if (this.__studiesInDebt && studyId in this.__studiesInDebt) {
return this.__studiesInDebt[studyId];
}
return null;
},

isStudyInDebt: function(studyId) {
return Boolean(this.getStudyDebt(studyId));
},

reloadCreditPrice: function() {
const store = osparc.store.Store.getInstance();
store.setCreditPrice(null);
Expand Down
Loading
Loading