mirror of
https://github.com/hanzo-io/press.git
synced 2026-10-30 18:56:50 +00:00
* refactor: group analytics, jobs, logs and reports * fix: double import and remove unused code * fix: tab highlight on navigating using browser controls * refactor: move inner sidebar to right with fw like design * fix: option to view job from backup * fix: navigation buttons * fix: highlight inner sidebar item for children as well * refactor: add bottom border for inner sidebar items * fix: wrong params while routing * refactor: add padding per page * fix: add childroute for reports * fix: switch type of error from String to Error * fix(SiteActivity): show relevant job on click * fix(SiteActivity): add filters * fix(SiteActivity): filter width * fix(SiteTags): show tags in overview * refactor: separate advanced and basic charts * fix(SiteInsights): mobile view * fix: fetch advanced analytics only once * fix: add schedule backup action * fix: use proper route for site job list * fix: don't allow duplicate tags * fix: remove slow query variable * fix: revert complexity reduction change * fix(Charts): loading state for charts without card * refactor: add tag dialog * refactor: group logs - better heading for charts - link some charts to logs * chore: remove unused code * fix: typo
72 lines
1.8 KiB
JavaScript
72 lines
1.8 KiB
JavaScript
import objects from './index.js';
|
|
|
|
export default function generateRoutes() {
|
|
let routes = [];
|
|
for (let objectType in objects) {
|
|
let object = objects[objectType];
|
|
if (object.list) {
|
|
let routeName = `${object.doctype} List`;
|
|
object.list.routeName = routeName;
|
|
routes.push({
|
|
name: routeName,
|
|
path: object.list.route,
|
|
component: () => import('../pages/ListPage.vue'),
|
|
props: route => {
|
|
return { objectType, ...route.params };
|
|
}
|
|
});
|
|
}
|
|
if (object.detail) {
|
|
let children = object.detail.tabs.map(tab => {
|
|
const routeName = `${object.doctype} Detail ${tab.label}`;
|
|
tab.routeName = routeName;
|
|
const nestedChildren = [];
|
|
|
|
// nested children shouldn't be added to the main children array
|
|
for (let route of tab.nestedChildrenRoutes || []) {
|
|
nestedChildren.push({
|
|
...route,
|
|
props: route => {
|
|
return { objectType, ...route.params };
|
|
}
|
|
});
|
|
}
|
|
|
|
return {
|
|
name: routeName,
|
|
path: tab.route,
|
|
component: () => import('../pages/DetailTab.vue'),
|
|
props: route => {
|
|
return { ...route.params };
|
|
},
|
|
redirect: nestedChildren.length ? { name: tab.redirectTo } : null,
|
|
children: nestedChildren
|
|
};
|
|
});
|
|
if (object.routes) {
|
|
for (let route of object.routes) {
|
|
children.push({
|
|
...route,
|
|
props: route => {
|
|
return { objectType, ...route.params };
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
object.detail.routeName = `${object.doctype} Detail`;
|
|
routes.push({
|
|
name: object.detail.routeName,
|
|
path: object.detail.route,
|
|
component: () => import('../pages/DetailPage.vue'),
|
|
props: route => {
|
|
return { objectType, ...route.params };
|
|
},
|
|
redirect: children.length ? { name: children[0].name } : null,
|
|
children
|
|
});
|
|
}
|
|
}
|
|
return routes;
|
|
}
|