Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementierung_Einrichtungsassistent unter System->Einrichtungsassis #432

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export default {
this.client.options.clientId,
);
this.doSubscribe(["openWB/system/usage_terms_acknowledged"]); // required for route guard
this.doSubscribe(["openWB/system/installWizard"]);
});
this.client.on("error", (error) => {
console.error("Connection failed", error);
Expand Down
7 changes: 7 additions & 0 deletions src/components/OpenwbPageNavbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@
System
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<router-link
to="/System/InstallAssistant"
class="dropdown-item"
active-class="active disabled"
>
Einrichtungsassistent
</router-link>
<router-link
to="/System/CloudConfiguration"
class="dropdown-item"
Expand Down
15 changes: 15 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ const routes = [
},
component: () => import("../views/DataManagement.vue"),
},
{
path: "/System/InstallAssistant",
name: "InstallAssistant",
meta: {
heading: "System - Einrichtungsassistent",
},
component: () => import("../views/InstallAssistant.vue"),
},
];
/* examples for development only start here */
if (import.meta.env.MODE !== "production") {
Expand Down Expand Up @@ -201,6 +209,13 @@ router.beforeEach(async (to) => {
return { name: "LegalSettings" };
}
}
if (to.name !== "InstallAssistant"){
const wizardDone =
await store.getters.installWizard;
if (!wizardDone) {
return { name: "InstallAssistant" };
}
}
});

router.afterEach((to) => {
Expand Down
27 changes: 27 additions & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,32 @@ export default createStore({
}
});
},
installWizard(state) {
return new Promise((resolve) => {

if (state.mqtt["openWB/system/installWizard"] !== undefined) {
resolve(state.mqtt["openWB/system/installWizard"],
);
} else {
var timer, interval;
// add general timeout if topic not set
timer = setTimeout(() => {
clearInterval(interval);
resolve(false);
}, 5000);
// check until we received valid data
interval = setInterval(() => {
if (
state.mqtt["openWB/system/installWizard"] !==
undefined
) {
clearTimeout(timer);
clearInterval(interval);
resolve(state.mqtt["openWB/system/installWizard"]);
}
}, 100);
}
});
},
},
});
Loading
Loading