debian-mirror-gitlab/app/assets/javascripts/registry/explorer/router.js

37 lines
801 B
JavaScript
Raw Normal View History

2020-03-13 15:44:24 +05:30
import Vue from 'vue';
import VueRouter from 'vue-router';
import List from './pages/list.vue';
import Details from './pages/details.vue';
import { decodeAndParse } from './utils';
2020-06-23 00:09:42 +05:30
import { CONTAINER_REGISTRY_TITLE } from './constants/index';
2020-03-13 15:44:24 +05:30
Vue.use(VueRouter);
2020-05-24 23:13:21 +05:30
export default function createRouter(base) {
2020-03-13 15:44:24 +05:30
const router = new VueRouter({
base,
mode: 'history',
routes: [
{
name: 'list',
path: '/',
component: List,
meta: {
2020-06-23 00:09:42 +05:30
nameGenerator: () => CONTAINER_REGISTRY_TITLE,
2020-03-13 15:44:24 +05:30
root: true,
},
},
{
name: 'details',
path: '/:id',
component: Details,
meta: {
nameGenerator: route => decodeAndParse(route.params.id).name,
},
},
],
});
return router;
}