Skip to content

Commit

Permalink
feat(ui): guided tour on instance without flows (#1028)
Browse files Browse the repository at this point in the history
close #821

Co-authored-by: Loïc Mathieu <[email protected]>
Co-authored-by: Ludovic DEHON <[email protected]>
  • Loading branch information
3 people authored Mar 1, 2023
1 parent fcd3f0c commit 2ef140c
Show file tree
Hide file tree
Showing 35 changed files with 1,896 additions and 50 deletions.
22 changes: 22 additions & 0 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"vue-material-design-icons": "^5.2.0",
"vue-router": "^4.1.6",
"vue-sidebar-menu": "^5.2.5",
"vue3-tour": "[email protected]:kestra-io/vue3-tour.git",
"vuex": "^4.1.0",
"xss": "^1.0.14",
"yaml": "^2.2.1"
Expand Down
63 changes: 36 additions & 27 deletions ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,36 @@
<left-menu @menu-collapse="onMenuCollapse" />
<error-toast v-if="message" :no-auto-hide="true" :message="message" />
<main :class="menuCollapsed" v-if="loaded">
<top-nav-bar :menu-collapsed="menuCollapsed" />
<top-nav-bar :menu-collapsed="menuCollapsed" v-if="displayNavBar" />
<router-view v-if="!error" />
<template v-else>
<errors :code="error" />
</template>
</main>
<VueTour />
</el-config-provider>
</template>

<script setup>
import Errors from "./components/errors/Errors.vue";
</script>

<script>
import LeftMenu from "override/components/LeftMenu.vue";
import TopNavBar from "./components/layout/TopNavBar.vue";
import ErrorToast from "./components/ErrorToast.vue";
import Errors from "./components/errors/Errors.vue";
import {mapState} from "vuex";
import {mapGetters, mapState} from "vuex";
import Utils from "./utils/utils";
import {pageFromRoute} from "./utils/eventsRouter";
import VueTour from "./components/onboarding/VueTour.vue";
export default {
name: "App",
components: {
LeftMenu,
TopNavBar,
ErrorToast,
Errors
VueTour
},
data() {
return {
Expand All @@ -37,7 +42,15 @@
};
},
computed: {
...mapState("core", ["message", "error"])
...mapState("core", ["message", "error"]),
...mapGetters("core", ["guidedProperties"]),
displayNavBar() {
if (this.$router) {
return this.$route.name !== "welcome";
}
return true;
}
},
created() {
if (this.created === false) {
Expand All @@ -51,7 +64,7 @@
},
displayApp() {
this.onMenuCollapse(localStorage.getItem("menuCollapsed") === "true");
this.switchTheme();
Utils.switchTheme();
document.getElementById("loader-wrapper").style.display = "none";
document.getElementById("app-container").style.display = "block";
Expand All @@ -78,30 +91,26 @@
uid: uid,
});
})
},
switchTheme(theme) {
// default theme
if (theme === undefined) {
if (localStorage.getItem("theme")) {
theme = localStorage.getItem("theme");
} else if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
theme = "dark";
} else {
theme = "light";
}
}
this.redirectToWelcome();
// class name
let htmlClass = document.getElementsByTagName("html")[0].classList;
},
redirectToWelcome() {
this.$store.dispatch("flow/findFlows", {limit: 1})
.then(flows => {
this.$store.commit("flow/setOverallTotal", flows.total);
if (flows.total === 0 && this.$route.name === "home" && localStorage.getItem("tourDoneOrSkip") !== "true") {
this.$router.push({name: "welcome"});
}
});
htmlClass.forEach((cls) => {
if (cls === "dark" || cls === "light") {
htmlClass.remove(cls);
}
})
htmlClass.add(theme);
localStorage.setItem("theme", theme);
}
},
watch: {
$route(to) {
if (to.name === "home" && localStorage.getItem("tourDoneOrSkip") !== "true") {
this.redirectToWelcome();
}
}
}
};
Expand Down
78 changes: 78 additions & 0 deletions ui/src/assets/onboarding/onboarding-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions ui/src/assets/onboarding/onboarding-demo-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions ui/src/assets/onboarding/onboarding-demo-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions ui/src/assets/onboarding/onboarding-execute-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2ef140c

Please sign in to comment.