mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-05 12:59:44 +00:00
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { createApp } from "vue";
|
|
import App from "./App.vue";
|
|
|
|
function mountApp(): void {
|
|
const el = document.querySelector<HTMLDivElement>(".screen-wait");
|
|
if (!el) {
|
|
console.error(
|
|
"WaitPostProcessWorkflow: mount element .screen-wait not found",
|
|
);
|
|
return;
|
|
}
|
|
|
|
const workflowIdAttr = el.getAttribute("data-workflow-id");
|
|
const expectedStep = el.getAttribute("data-expected-step") || "";
|
|
|
|
if (!workflowIdAttr) {
|
|
console.error(
|
|
"WaitPostProcessWorkflow: data-workflow-id attribute missing on mount element",
|
|
);
|
|
return;
|
|
}
|
|
|
|
if (!expectedStep) {
|
|
console.error(
|
|
"WaitPostProcessWorkflow: data-expected-step attribute missing on mount element",
|
|
);
|
|
return;
|
|
}
|
|
|
|
const workflowId = Number(workflowIdAttr);
|
|
if (Number.isNaN(workflowId)) {
|
|
console.error(
|
|
"WaitPostProcessWorkflow: data-workflow-id is not a valid number:",
|
|
workflowIdAttr,
|
|
);
|
|
return;
|
|
}
|
|
|
|
const app = createApp(App, {
|
|
workflowId,
|
|
expectedStep,
|
|
});
|
|
|
|
app.mount(el);
|
|
}
|
|
|
|
if (document.readyState === "loading") {
|
|
document.addEventListener("DOMContentLoaded", mountApp);
|
|
} else {
|
|
mountApp();
|
|
}
|