1
0
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:
Amir Raminfar
2020-05-22 16:49:23 -07:00
committed by GitHub
parent a7241b6fbe
commit bae3ecca7b
2 changed files with 30 additions and 0 deletions

View File

@@ -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
View 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>