ui_migration fix(deps): --preliminary-- added stronger type checking on things properties

This commit is contained in:
Antonio Anaya 2026-02-13 19:23:07 -06:00
parent f4a10ec897
commit 5bbe88c9f7
6 changed files with 75 additions and 40 deletions

View file

@ -236,19 +236,24 @@ export default {
*
*/
async checkExistingTasks() {
console.log("Checking for existing tasks for action ", this.action);
let response = await this.findOngoingActions(this.thing, this.action);
// Exit if response is null, due to an error.
if (response == null) return;
// Check for a task that is ongoing.
// We can't handle multiple tasks ongoing, so this picks the first.
const ongoingTask = response.data.find((t) => ["pending", "running"].includes(t.status));
console.log("Existing tasks: ", response.data, "Ongoing task: ", ongoingTask);
if (ongoingTask) {
// There is a started task
console.log("Found ongoing task, resuming polling: ", ongoingTask);
this.taskStarted = true;
this.$emit("taskStarted");
// Find its URL
console.log("Task links: ", ongoingTask.links);
const taskUrl = ongoingTask.links.find((t) => t.rel == "self").href;
this.startPollingTask(ongoingTask.id, taskUrl);
console.log("Resumed polling on existing task with URL: ", taskUrl);
}
},
@ -324,6 +329,7 @@ export default {
this.taskUrl = null;
this.taskRunning = false;
this.taskStarted = false;
console.log("Task ended with status: ", this.taskStatus);
this.$emit("finished");
},