ui_migration fix(bugfix): eventBus undefined found caused by not importing eventBus at autofocus comp, removing eventBus usage on child/parent this. events for task polling func

This commit is contained in:
Antonio Anaya 2026-02-09 00:06:48 -06:00
parent 9992ca642c
commit a16a86f361
2 changed files with 14 additions and 13 deletions

View file

@ -137,7 +137,7 @@ export default {
progress: { progress: {
handler(newval) { handler(newval) {
//this.$emit("update:progress", newval); //this.$emit("update:progress", newval);
eventBus.emit("update:progress", newval); this.$emit("update:progress", newval);
//eventBus.emit("beforeUpdate:progress", newval); //eventBus.emit("beforeUpdate:progress", newval);
}, },
deep: true, deep: true,
@ -146,7 +146,7 @@ export default {
taskStarted: { taskStarted: {
handler(newval) { handler(newval) {
//this.$emit("update:taskStarted", newval); //this.$emit("update:taskStarted", newval);
eventBus.emit("update:taskStarted", newval); this.$emit("update:taskStarted", newval);
//eventBus.emit("beforeUpdate:taskStarted", newval); //eventBus.emit("beforeUpdate:taskStarted", newval);
}, },
deep: true deep: true
@ -154,7 +154,7 @@ export default {
taskRunning: { taskRunning: {
handler(newval) { handler(newval) {
//this.$emit("update:taskRunning", newval); //this.$emit("update:taskRunning", newval);
eventBus.emit("update:taskRunning", newval); this.$emit("update:taskRunning", newval);
//eventBus.emit("beforeUpdate:taskRunning", newval); //eventBus.emit("beforeUpdate:taskRunning", newval);
}, },
deep: true deep: true
@ -162,7 +162,7 @@ export default {
log: { log: {
handler(newval) { handler(newval) {
//this.$emit("update:log", newval); //this.$emit("update:log", newval);
eventBus.emit("update:log", newval); this.$emit("update:log", newval);
//eventBus.emit("beforeUpdate:log", newval); //eventBus.emit("beforeUpdate:log", newval);
}, },
deep: true deep: true
@ -170,7 +170,7 @@ export default {
taskStatus: { taskStatus: {
handler(newval) { handler(newval) {
//this.$emit("update:taskStatus", newval); //this.$emit("update:taskStatus", newval);
eventBus.emit("update:taskStatus", newval); this.$emit("update:taskStatus", newval);
//eventBus.emit("beforeUpdate:taskStatus", newval); //eventBus.emit("beforeUpdate:taskStatus", newval);
}, },
deep: true deep: true
@ -230,7 +230,7 @@ export default {
if (ongoingTask) { if (ongoingTask) {
// There is a started task // There is a started task
this.taskStarted = true; this.taskStarted = true;
eventBus.emit("taskStarted"); this.$emit("taskStarted");
// Find its URL // Find its URL
const taskUrl = ongoingTask.links.find((t) => t.rel == "self").href; const taskUrl = ongoingTask.links.find((t) => t.rel == "self").href;
this.startPollingTask(ongoingTask.id, taskUrl); this.startPollingTask(ongoingTask.id, taskUrl);
@ -254,10 +254,10 @@ export default {
async startTask() { async startTask() {
// Starts a new Action task // Starts a new Action task
console.log("Starting task with data:", this.submitData); console.log("Starting task with data:", this.submitData);
eventBus.emit("submit", this.submitData); this.$emit("submit", this.submitData);
// Send a request to start a task // Send a request to start a task
this.taskStarted = true; this.taskStarted = true;
eventBus.emit("taskStarted"); this.$emit("taskStarted");
let response; let response;
try { try {
response = await this.invokeAction( response = await this.invokeAction(
@ -267,7 +267,7 @@ export default {
false, // Stop invokeAction handling the error. false, // Stop invokeAction handling the error.
); );
} catch (error) { } catch (error) {
eventBus.emit("error", error); this.$emit("error", error);
this.onTaskEnd(); this.onTaskEnd();
return; return;
} }
@ -285,7 +285,7 @@ export default {
this.taskUrl = taskUrl; this.taskUrl = taskUrl;
// Start the store polling TaskId for success // Start the store polling TaskId for success
this.taskRunning = true; this.taskRunning = true;
eventBus.emit("taskRunning", taskId); this.$emit("taskRunning", taskId);
this.pollUntilComplete( this.pollUntilComplete(
taskUrl, taskUrl,
this.onPollingResponse, this.onPollingResponse,
@ -299,10 +299,10 @@ export default {
this.taskStatus = response.data.status; this.taskStatus = response.data.status;
this.log = response.data.log; this.log = response.data.log;
if (response.data.status == "completed") { if (response.data.status == "completed") {
eventBus.emit("response", response.data); this.$emit("response", response.data);
eventBus.emit("completed", response.data.output); this.$emit("completed", response.data.output);
} else if (response.data.status == "cancelled") { } else if (response.data.status == "cancelled") {
eventBus.emit("cancelled", response.data); this.$emit("cancelled", response.data);
this.modalNotify(`The action '${this.submitLabel}' was cancelled.`); this.modalNotify(`The action '${this.submitLabel}' was cancelled.`);
} }
} }

View file

@ -20,6 +20,7 @@
import ActionButton from "../../labThingsComponents/actionButton.vue"; import ActionButton from "../../labThingsComponents/actionButton.vue";
// vue3 migration // vue3 migration
import { markRaw } from "vue"; import { markRaw } from "vue";
import { eventBus } from "../../../eventBus.js";
export default { export default {
name: "AutofocusControl", name: "AutofocusControl",