Skip to content

Commit 297041d

Browse files
committed
createPollingTask
1 parent 6763e0b commit 297041d

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,21 @@ qx.Class.define("osparc.file.FileLabelWithActions", {
228228
});
229229
}
230230
} else if (toBeDeleted.length > 1) {
231-
this.__deleteItems(toBeDeleted)
232-
.then(resp => {
233-
// It returns a long running task
234-
console.log(resp);
231+
const dataStore = osparc.store.Data.getInstance();
232+
const paths = toBeDeleted.map(item => item.getPath());
233+
const promise = dataStore.deleteFiles(paths);
234+
const pollTasks = osparc.store.PollTasks.getInstance();
235+
const interval = 1000;
236+
pollTasks.createPollingTask(promise, interval)
237+
.then(task => {
238+
task.addListener("resultReceived", e => {
239+
console.log("deleted");
240+
});
241+
})
242+
.catch(errMsg => {
243+
console.log(errMsg);
244+
const msg = this.tr("Something went wrong while deleting the files");
245+
osparc.FlashMessenger.logError(msg);
235246
});
236247
}
237248
},
@@ -246,9 +257,6 @@ qx.Class.define("osparc.file.FileLabelWithActions", {
246257
},
247258

248259
__deleteItems: function(items) {
249-
const dataStore = osparc.store.Data.getInstance();
250-
const paths = items.map(item => item.getPath());
251-
return dataStore.deleteFiles(paths);
252260
},
253261
}
254262
});

0 commit comments

Comments
 (0)