2022-03-30 15:09:00 +00:00
|
|
|
import Vue from 'vue';
|
|
|
|
import VueRouter from 'vue-router';
|
|
|
|
import { HARBOR_REGISTRY_TITLE } from './constants/index';
|
|
|
|
import List from './pages/list.vue';
|
|
|
|
import Details from './pages/details.vue';
|
2022-09-15 00:14:10 +00:00
|
|
|
import HarborTags from './pages/harbor_tags.vue';
|
2022-03-30 15:09:00 +00:00
|
|
|
|
|
|
|
Vue.use(VueRouter);
|
|
|
|
|
|
|
|
export default function createRouter(base, breadCrumbState) {
|
|
|
|
const router = new VueRouter({
|
|
|
|
base,
|
|
|
|
mode: 'history',
|
|
|
|
routes: [
|
|
|
|
{
|
|
|
|
name: 'list',
|
|
|
|
path: '/',
|
|
|
|
component: List,
|
|
|
|
meta: {
|
|
|
|
nameGenerator: () => HARBOR_REGISTRY_TITLE,
|
|
|
|
root: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'details',
|
2022-09-01 18:09:55 +00:00
|
|
|
path: '/:project/:image',
|
2022-03-30 15:09:00 +00:00
|
|
|
component: Details,
|
|
|
|
meta: {
|
|
|
|
nameGenerator: () => breadCrumbState.name,
|
2022-09-01 18:09:55 +00:00
|
|
|
hrefGenerator: () => breadCrumbState.href,
|
2022-03-30 15:09:00 +00:00
|
|
|
},
|
|
|
|
},
|
2022-09-15 00:14:10 +00:00
|
|
|
{
|
|
|
|
name: 'tags',
|
|
|
|
path: '/:project/:image/:digest',
|
|
|
|
component: HarborTags,
|
|
|
|
meta: {
|
|
|
|
nameGenerator: () => breadCrumbState.name,
|
|
|
|
hrefGenerator: () => breadCrumbState.href,
|
|
|
|
},
|
|
|
|
},
|
2022-03-30 15:09:00 +00:00
|
|
|
],
|
|
|
|
});
|
|
|
|
|
|
|
|
return router;
|
|
|
|
}
|