in ee/app/assets/javascripts/compliance_dashboard/router.js [27:144]
export function createRouter(basePath, props) {
const {
groupPath,
groupName,
groupComplianceCenterPath,
projectId,
projectPath,
projectName,
rootAncestorPath,
rootAncestorName,
rootAncestorComplianceCenterPath,
routes: availableRoutes,
} = props;
const availableTabRoutes = [
{
path: ROUTE_STANDARDS_ADHERENCE,
name: ROUTE_STANDARDS_ADHERENCE,
component: StandardsReport,
props: {
groupPath,
projectPath,
rootAncestorPath,
},
},
{
path: ROUTE_VIOLATIONS,
name: ROUTE_VIOLATIONS,
component: ViolationsReport,
props: {
groupPath,
projectPath,
},
},
{
path: ROUTE_FRAMEWORKS,
name: ROUTE_FRAMEWORKS,
component: FrameworksReport,
props: {
groupPath,
projectPath,
rootAncestor: {
path: rootAncestorPath,
name: rootAncestorName,
complianceCenterPath: rootAncestorComplianceCenterPath,
},
},
},
{
path: ROUTE_PROJECTS,
name: ROUTE_PROJECTS,
component: ProjectsReport,
props: {
groupPath,
groupName,
groupComplianceCenterPath,
projectId,
projectPath,
projectName,
rootAncestor: {
path: rootAncestorPath,
name: rootAncestorName,
complianceCenterPath: rootAncestorComplianceCenterPath,
},
},
},
].filter(({ name }) => availableRoutes.includes(name));
const defaultRoute = availableTabRoutes[0].name;
const routes = [
{
path: `/${ROUTE_FRAMEWORKS}/new`,
name: ROUTE_NEW_FRAMEWORK,
component: NewFramework,
},
{
path: '/frameworks/blank',
name: ROUTE_BLANK_FRAMEWORK,
component: EditFramework,
},
{
path: `/${ROUTE_FRAMEWORKS}/new/success`,
name: ROUTE_NEW_FRAMEWORK_SUCCESS,
component: NewFrameworkSuccess,
},
{
path: `/${ROUTE_FRAMEWORKS}/:id`,
name: ROUTE_EDIT_FRAMEWORK,
component: EditFramework,
},
{
path: '/',
component: MainLayout,
props: {
availableTabs: availableRoutes,
projectPath,
groupPath,
rootAncestor: {
path: rootAncestorPath,
name: rootAncestorName,
complianceCenterPath: rootAncestorComplianceCenterPath,
},
},
children: [...availableTabRoutes, { path: '*', redirect: { name: defaultRoute } }],
},
{
name: ROUTE_EXPORT_FRAMEWORK,
path: '/frameworks/:id.json',
},
];
return new VueRouter({
mode: 'history',
base: joinPaths(gon.relative_url_root || '', basePath),
routes,
});
}