2021-09-12 17:23:51 +00:00
|
|
|
import { createRouter, createWebHistory } from "vue-router";
|
|
|
|
import EmptyLayout from "./layouts/EmptyLayout.vue";
|
|
|
|
import Layout from "./layouts/Layout.vue";
|
|
|
|
import Dashboard from "./pages/Dashboard.vue";
|
|
|
|
import DashboardHome from "./pages/DashboardHome.vue";
|
|
|
|
import Details from "./pages/Details.vue";
|
|
|
|
import EditMonitor from "./pages/EditMonitor.vue";
|
|
|
|
import List from "./pages/List.vue";
|
2021-09-29 16:16:15 +00:00
|
|
|
const Settings = () => import("./pages/Settings.vue");
|
2021-09-12 17:23:51 +00:00
|
|
|
import Setup from "./pages/Setup.vue";
|
2021-09-29 16:16:15 +00:00
|
|
|
const StatusPage = () => import("./pages/StatusPage.vue");
|
2021-09-23 05:57:24 +00:00
|
|
|
import Entry from "./pages/Entry.vue";
|
2021-09-12 17:23:51 +00:00
|
|
|
|
|
|
|
const routes = [
|
|
|
|
{
|
|
|
|
path: "/",
|
2021-09-23 05:57:24 +00:00
|
|
|
component: Entry,
|
|
|
|
},
|
|
|
|
{
|
2021-09-24 07:00:52 +00:00
|
|
|
// If it is "/dashboard", the active link is not working
|
|
|
|
// If it is "", it overrides the "/" unexpectedly
|
|
|
|
// Give a random name to solve the problem.
|
|
|
|
path: "/empty",
|
2021-09-12 17:23:51 +00:00
|
|
|
component: Layout,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: "",
|
|
|
|
component: Dashboard,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
name: "DashboardHome",
|
2021-09-24 07:00:52 +00:00
|
|
|
path: "/dashboard",
|
2021-09-12 17:23:51 +00:00
|
|
|
component: DashboardHome,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: "/dashboard/:id",
|
|
|
|
component: EmptyLayout,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: "",
|
|
|
|
component: Details,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/edit/:id",
|
|
|
|
component: EditMonitor,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/add",
|
|
|
|
component: EditMonitor,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/list",
|
|
|
|
component: List,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/settings",
|
|
|
|
component: Settings,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/setup",
|
|
|
|
component: Setup,
|
|
|
|
},
|
2021-09-14 06:19:23 +00:00
|
|
|
{
|
|
|
|
path: "/status-page",
|
|
|
|
component: StatusPage,
|
|
|
|
},
|
2021-09-25 14:44:29 +00:00
|
|
|
{
|
|
|
|
path: "/status",
|
|
|
|
component: StatusPage,
|
|
|
|
},
|
2021-09-14 06:19:23 +00:00
|
|
|
];
|
2021-09-12 17:23:51 +00:00
|
|
|
|
|
|
|
export const router = createRouter({
|
|
|
|
linkActiveClass: "active",
|
|
|
|
history: createWebHistory(),
|
|
|
|
routes,
|
|
|
|
});
|