Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
qx.Class.define("osparc.data.PollTask", {
extend: qx.core.Object,

construct: function(taskData, interval) {
construct: function(taskData, interval = 1000) {
this.base(arguments);

interval ? this.setPollInterval(interval) : this.initPollInterval();
this.setPollInterval(interval);

if (taskData && "task_id" in taskData) {
this.set({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1241,26 +1241,6 @@ qx.Class.define("osparc.data.Resources", {
}
}
},
/*
* STORAGE ASYNC
*/
"storageAsyncJobs": {
useCache: false,
endpoints: {
jobStatus: {
method: "GET",
url: statics.API + "/storage/async-jobs/{jobId}/status"
},
jobResult: {
method: "GET",
url: statics.API + "/storage/async-jobs/{jobId}/result"
},
abortJob: {
method: "POST",
url: statics.API + "/storage/async-jobs/{jobId}/abort"
},
}
},
/*
* ACTIVITY
*/
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -160,22 +160,18 @@ qx.Class.define("osparc.file.TreeFolderView", {
const totalSize = this.getChildControl("total-size-label");
totalSize.getChildControl("icon").getContentElement().addClass("rotate");

osparc.data.Resources.fetch("storagePaths", "requestSize", { url: { pathId } })
.then(resp => {
const jobId = resp["job_id"];
if (jobId) {
const asyncJob = new osparc.file.StorageAsyncJob(jobId);
asyncJob.addListener("resultReceived", e => {
const size = e.getData();
totalSize.set({
icon: null,
label: this.tr("Total size: ") + osparc.utils.Utils.bytesToSize(size),
});
const pollTasks = osparc.store.PollTasks.getInstance();
const fetchPromise = osparc.data.Resources.fetch("storagePaths", "requestSize", { url: { pathId } })
pollTasks.createPollingTask(fetchPromise)
.then(task => {
task.addListener("resultReceived", e => {
const size = e.getData();
totalSize.set({
icon: null,
label: this.tr("Total size: ") + osparc.utils.Utils.bytesToSize(size),
});
asyncJob.addListener("pollingError", e => {
totalSize.hide();
});
}
});
task.addListener("pollingError", e => totalSize.hide());
})
.catch(err => {
console.error(err);
Expand Down
Loading