Skip to content

Commit

Permalink
🐛 [Frontend] Studies: list more than 5 studies in folder (#6813)
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Nov 25, 2024
1 parent 9870a85 commit ac1af68
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -631,16 +631,18 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
// check the entries in currentParams are the same as the reqParams
let sameContext = true;
Object.entries(currentParams).forEach(([key, value]) => {
sameContext &= key in reqParams && reqParams[key] === value;
// loose equality: will do a Number to String conversion if necessary
sameContext &= key in reqParams && reqParams[key] == value;
});
return !sameContext;
},

__getNextPageParams: function() {
if (this._resourcesContainer.getFlatList() && this._resourcesContainer.getFlatList().nextRequest) {
const studiesContainer = this._resourcesContainer.getFlatList();
if (studiesContainer && studiesContainer.nextRequest) {
// Context might have been changed while waiting for the response.
// The new call is on the way, therefore this response can be ignored.
const url = new URL(this._resourcesContainer.getFlatList().nextRequest);
const url = new URL(studiesContainer.nextRequest);
const urlSearchParams = new URLSearchParams(url.search);
const urlParams = {};
for (const [snakeKey, value] of urlSearchParams.entries()) {
Expand All @@ -650,12 +652,12 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
const contextChanged = this.__didContextChange(urlParams);
if (
!contextChanged &&
osparc.utils.Utils.hasParamFromURL(this._resourcesContainer.getFlatList().nextRequest, "offset") &&
osparc.utils.Utils.hasParamFromURL(this._resourcesContainer.getFlatList().nextRequest, "limit")
osparc.utils.Utils.hasParamFromURL(studiesContainer.nextRequest, "offset") &&
osparc.utils.Utils.hasParamFromURL(studiesContainer.nextRequest, "limit")
) {
return {
offset: osparc.utils.Utils.getParamFromURL(this._resourcesContainer.getFlatList().nextRequest, "offset"),
limit: osparc.utils.Utils.getParamFromURL(this._resourcesContainer.getFlatList().nextRequest, "limit")
offset: osparc.utils.Utils.getParamFromURL(studiesContainer.nextRequest, "offset"),
limit: osparc.utils.Utils.getParamFromURL(studiesContainer.nextRequest, "limit")
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,10 @@ qx.Class.define("osparc.data.model.Workbench", {
} else {
// patch only what was changed
Object.keys(workbenchDiffs[nodeId]).forEach(changedFieldKey => {
patchData[changedFieldKey] = nodeData[changedFieldKey];
if (nodeData[changedFieldKey] !== undefined) {
// do not patch if it's undefined
patchData[changedFieldKey] = nodeData[changedFieldKey];
}
});
}
const params = {
Expand All @@ -807,7 +810,9 @@ qx.Class.define("osparc.data.model.Workbench", {
},
data: patchData
};
promises.push(osparc.data.Resources.fetch("studies", "patchNode", params));
if (Object.keys(patchData).length) {
promises.push(osparc.data.Resources.fetch("studies", "patchNode", params));
}
})
return Promise.all(promises);
}
Expand Down

0 comments on commit ac1af68

Please sign in to comment.