You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
autoflow-web-console/src/router/index.js

156 lines
3.7 KiB

import { createRouter, createWebHistory } from "vue-router";
import { storage } from "@/utils/storage";
const rootPath = import.meta.env.VITE_ROOT_PATH;
const routes = [
{
path: `/`,
component: () => import("@/layouts/default.vue"),
redirect: { name: "signin" },
children: [
{
name: "main",
path: `/main`,
meta: {
title: "",
requiresAuth: false,
},
component: () => import("@/pages/MainView.vue"),
},
{
name: "home",
path: `/home`,
meta: {
title: "Home",
requiresAuth: false,
},
component: () => import("@/pages/HomeView.vue"),
},
{
name: "select",
path: `/select`,
meta: {
title: "select",
requiresAuth: false,
},
component: () => import("@/views/Select.vue"),
},
{
name: "workflows",
path: `/workflows`,
meta: {
title: "Workflows",
requiresAuth: false,
},
component: () => import("@/pages/WorkflowView.vue"),
},
{
name: "workflow-step-config",
path: `/workflow-step-config`,
meta: {
title: "Workflow Step Config",
requiresAuth: false,
},
component: () => import("@/pages/WorkflowStepConfigView.vue"),
},
{
name: "run",
path: `/run/experiment`,
meta: {
title: "Run",
requiresAuth: false,
},
redirect: { name: "experiment" },
children: [
{
name: "experiment",
path: `/run/experiment`,
meta: {
title: "Experiment",
requiresAuth: false,
},
component: () => import("@/pages/ExperimentView.vue"),
},
{
name: "Excutions",
path: `/run/excutions`,
meta: {
title: "Excutions",
requiresAuth: false,
},
component: () => import("@/pages/ExcutionsView.vue"),
},
],
},
{
name: "deployment",
path: `/deployment`,
meta: {
title: "Deployment",
requiresAuth: false,
},
component: () => import("@/pages/DeploymentView.vue"),
},
{
name: "training-script",
path: `/training-script`,
meta: {
title: "Training Script",
requiresAuth: true,
},
component: () => import("@/pages/TrainingScriptView.vue"),
},
{
name: "datasets",
path: `/datasets`,
meta: {
title: "Datasets",
requiresAuth: true,
},
component: () => import("@/pages/DatasetView.vue"),
},
],
},
{
name: "signin",
path: `/signin`,
meta: {
title: "로그인",
requiresAuth: false,
},
component: () => import("@/pages/LoginView.vue"),
},
];
const router = createRouter({
history: createWebHistory(import.meta.env.VITE_ROOT_PATH),
routes,
});
// router.beforeEach((to) => {
// if (!storage.getAuth() && to.name !== "signin") {
// return { name: "signin" };
// } else if (storage.getAuth() && to.name === "signin") {
// return { name: "main" };
// }
//
// // 권한 검사
// if (to.meta.requiresAuth) {
// if (storage.getAuth().auth !== "ADMIN") {
// // const store = commonStore();
// // store.setSnackbarMsg({
// // text: "접근 권한이 없습니다.",
// // result: 500,
// // color: "error",
// // });
// return { name: "main" };
// }
// }
//
// return true; // 허용된 경우 라우트 진행
// });
export default router;