mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-26 23:21:41 +01:00
Adds show page with name param (#474)
This commit is contained in:
@@ -9,6 +9,7 @@ import App from "./App.vue";
|
||||
import Container from "./pages/Container.vue";
|
||||
import Settings from "./pages/Settings.vue";
|
||||
import Index from "./pages/Index.vue";
|
||||
import Show from "./pages/Show.vue";
|
||||
|
||||
Vue.use(VueRouter);
|
||||
Vue.use(Meta);
|
||||
@@ -32,6 +33,11 @@ const routes = [
|
||||
component: Settings,
|
||||
name: "settings",
|
||||
},
|
||||
{
|
||||
path: "/show",
|
||||
component: Show,
|
||||
name: "show",
|
||||
},
|
||||
];
|
||||
|
||||
const router = new VueRouter({
|
||||
|
||||
24
assets/pages/Show.vue
Normal file
24
assets/pages/Show.vue
Normal file
@@ -0,0 +1,24 @@
|
||||
<template lang="html"> </template>
|
||||
|
||||
<script>
|
||||
import { mapActions, mapGetters, mapState } from "vuex";
|
||||
export default {
|
||||
props: [],
|
||||
name: "Show",
|
||||
computed: mapGetters(["visibleContainers"]),
|
||||
watch: {
|
||||
visibleContainers(newValue) {
|
||||
if (newValue) {
|
||||
if (this.$route.query.name) {
|
||||
const [container, _] = this.visibleContainers.filter((c) => c.name.includes(this.$route.query.name));
|
||||
this.$router.push({ name: "container", params: { id: container.id } });
|
||||
} else {
|
||||
console.error(`Expection query parameter name to be set. Redirecting to /`);
|
||||
this.$router.push({ name: "default" });
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped></style>
|
||||
Reference in New Issue
Block a user