Skip to content

Commit 7471c05

Browse files
committed
batch delete and callback
1 parent 297041d commit 7471c05

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

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

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -228,22 +228,18 @@ qx.Class.define("osparc.file.FileLabelWithActions", {
228228
});
229229
}
230230
} else if (toBeDeleted.length > 1) {
231-
const dataStore = osparc.store.Data.getInstance();
232231
const paths = toBeDeleted.map(item => item.getPath());
233-
const promise = dataStore.deleteFiles(paths);
232+
const dataStore = osparc.store.Data.getInstance();
233+
const fetchPromise = dataStore.deleteFiles(paths);
234234
const pollTasks = osparc.store.PollTasks.getInstance();
235235
const interval = 1000;
236-
pollTasks.createPollingTask(promise, interval)
236+
pollTasks.createPollingTask(fetchPromise, interval)
237237
.then(task => {
238238
task.addListener("resultReceived", e => {
239-
console.log("deleted");
239+
this.fireDataEvent("fileDeleted", toBeDeleted[0]);
240240
});
241241
})
242-
.catch(errMsg => {
243-
console.log(errMsg);
244-
const msg = this.tr("Something went wrong while deleting the files");
245-
osparc.FlashMessenger.logError(msg);
246-
});
242+
.catch(err => osparc.FlashMessenger.logError(err, this.tr("Unsuccessful files deletion")));
247243
}
248244
},
249245

@@ -255,8 +251,5 @@ qx.Class.define("osparc.file.FileLabelWithActions", {
255251
const dataStore = osparc.store.Data.getInstance();
256252
return dataStore.deleteFile(locationId, itemId);
257253
},
258-
259-
__deleteItems: function(items) {
260-
},
261254
}
262255
});

services/static-webserver/client/source/class/osparc/store/Data.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,7 @@ qx.Class.define("osparc.store.Data", {
272272
paths,
273273
}
274274
};
275-
return osparc.data.Resources.fetch("storagePaths", "batchDelete", params)
276-
.then(resp => console.log(resp))
277-
.catch(err => osparc.FlashMessenger.logError(err, this.tr("Unsuccessful files deletion")));
275+
return osparc.data.Resources.fetch("storagePaths", "batchDelete", params);
278276
},
279277
}
280278
});

0 commit comments

Comments
 (0)