stash
This commit is contained in:
parent
3cd9200d87
commit
e88dc898b3
18 changed files with 298 additions and 84 deletions
|
|
@ -51,35 +51,39 @@ export function decodeHandleFromUrl(segment) {
|
|||
|
||||
// See docs/implementation.md#owner-filtered-overview-routes-use-path-segments-not-query-strings.
|
||||
export function ownerOverviewRoute(item) {
|
||||
return item.owner_group ? `/inventory/${encodeHandleForUrl(item.owner_group)}` : '/inventory';
|
||||
return item.owner_group
|
||||
? {name: 'inventory', params: {owner: encodeHandleForUrl(item.owner_group)}}
|
||||
: {name: 'inventory'};
|
||||
}
|
||||
|
||||
export function ownerLocationOverviewRoute(location) {
|
||||
return location.owner_group ? `/storage-location/${encodeHandleForUrl(location.owner_group)}` : '/storage-location';
|
||||
return location.owner_group
|
||||
? {name: 'locations', params: {owner: encodeHandleForUrl(location.owner_group)}}
|
||||
: {name: 'locations'};
|
||||
}
|
||||
|
||||
const EXPANDED_ROUTE_BUILDERS = {
|
||||
item: ({owner_identity_id, item_local_id}) => {
|
||||
const handle = store.getters.identityHandleById[owner_identity_id];
|
||||
return handle ? `/inventory/${encodeHandleForUrl(handle)}/${item_local_id}` : null;
|
||||
return handle ? {name: 'inventory-detail', params: {handle: encodeHandleForUrl(handle), id: item_local_id}} : null;
|
||||
},
|
||||
group_item: ({owner_group_id, item_local_id}) => {
|
||||
const handle = store.getters.groupHandleById[owner_group_id];
|
||||
return handle ? `/inventory/${encodeHandleForUrl(handle)}/${item_local_id}` : null;
|
||||
return handle ? {name: 'inventory-detail', params: {handle: encodeHandleForUrl(handle), id: item_local_id}} : null;
|
||||
},
|
||||
group: ({group_id}) => {
|
||||
const handle = store.getters.groupHandleById[group_id];
|
||||
return handle ? `/groups/${encodeHandleForUrl(handle)}` : null;
|
||||
return handle ? {name: 'group-detail', params: {handle: encodeHandleForUrl(handle)}} : null;
|
||||
},
|
||||
storage_location: ({owner_identity_id, storage_location_id}) => {
|
||||
const handle = store.getters.identityHandleById[owner_identity_id];
|
||||
return handle ? `/storage-locations/${encodeHandleForUrl(handle)}/${storage_location_id}` : null;
|
||||
return handle ? {name: 'locations-detail', params: {handle: encodeHandleForUrl(handle), id: storage_location_id}} : null;
|
||||
},
|
||||
group_storage_location: ({owner_group_id, storage_location_id}) => {
|
||||
const handle = store.getters.groupHandleById[owner_group_id];
|
||||
return handle ? `/storage-locations/${encodeHandleForUrl(handle)}/${storage_location_id}` : null;
|
||||
return handle ? {name: 'locations-detail', params: {handle: encodeHandleForUrl(handle), id: storage_location_id}} : null;
|
||||
},
|
||||
workflow: ({workflow_id}) => `/workflows/${workflow_id}`,
|
||||
workflow: ({workflow_id}) => ({name: 'workflow-detail', params: {id: workflow_id}}),
|
||||
};
|
||||
|
||||
// Kinds whose route needs identityHandleById/groupHandleById (from state.idmap); ShortId.vue only waits on an idmap fetch for these.
|
||||
|
|
@ -121,30 +125,33 @@ export async function domainQualifiedRoute(domain, ints) {
|
|||
return undefined;
|
||||
}
|
||||
return owned.isLocation
|
||||
? `/storage-locations/${encodeHandleForUrl(resolved.handle)}/${resolved.id}`
|
||||
: `/inventory/${encodeHandleForUrl(resolved.handle)}/${resolved.id}`;
|
||||
? {name: 'locations-detail', params: {handle: encodeHandleForUrl(resolved.handle), id: resolved.id}}
|
||||
: {name: 'inventory-detail', params: {handle: encodeHandleForUrl(resolved.handle), id: resolved.id}};
|
||||
}
|
||||
|
||||
const routes = [{path: '/', component: Dashboard, meta: {requiresAuth: true}}, {
|
||||
const routes = [{path: '/', name: 'dashboard', component: Dashboard, meta: {requiresAuth: true}}, {
|
||||
// See docs/implementation.md#owner-filtered-overview-routes-use-path-segments-not-query-strings.
|
||||
path: '/inventory/:owner?',
|
||||
name: 'inventory',
|
||||
component: Inventory,
|
||||
meta: {requiresAuth: true},
|
||||
props: true
|
||||
}, {
|
||||
path: '/inventory/:handle/:id',
|
||||
name: 'inventory-detail',
|
||||
component: InventoryDetail,
|
||||
meta: {requiresAuth: true},
|
||||
props: true
|
||||
}, {
|
||||
path: '/inventory/:handle/:id/edit',
|
||||
name: 'inventory-edit',
|
||||
component: InventoryEdit,
|
||||
meta: {requiresAuth: true},
|
||||
props: true
|
||||
}, {
|
||||
// Label/short-link entry point; alias of /inventory/:handle/:id. See docs/implementation.md#item-short-link-redirect-route.
|
||||
path: '/i/:handle/:id',
|
||||
redirect: to => `/inventory/${to.params.handle}/${to.params.id}`
|
||||
redirect: to => ({name: 'inventory-detail', params: to.params})
|
||||
}, {
|
||||
// beforeEnter, not redirect: falls through to ShortId.vue when the route can't resolve synchronously. See docs/implementation.md#beforeenter-guard-vs-redirect-for-short_id.
|
||||
path: '/:short_id',
|
||||
|
|
@ -160,28 +167,34 @@ const routes = [{path: '/', component: Dashboard, meta: {requiresAuth: true}}, {
|
|||
}, {
|
||||
// See docs/implementation.md#owner-filtered-overview-routes-use-path-segments-not-query-strings.
|
||||
path: '/inventory/new/:group?',
|
||||
name: 'inventory-new',
|
||||
component: InventoryNew,
|
||||
meta: {requiresAuth: true},
|
||||
props: true
|
||||
}, {
|
||||
path: '/friends',
|
||||
name: 'friends',
|
||||
component: Friends,
|
||||
meta: {requiresAuth: true}
|
||||
}, {
|
||||
path: '/groups',
|
||||
name: 'groups',
|
||||
component: Groups,
|
||||
meta: {requiresAuth: true}
|
||||
}, {
|
||||
path: '/groups/new',
|
||||
name: 'groups-new',
|
||||
component: GroupNew,
|
||||
meta: {requiresAuth: true}
|
||||
}, {
|
||||
path: '/groups/:handle',
|
||||
name: 'group-detail',
|
||||
component: GroupDetail,
|
||||
meta: {requiresAuth: true},
|
||||
props: true
|
||||
}, {path: '/files', component: Files, meta: {requiresAuth: true}
|
||||
}, {path: '/files', name: 'files', component: Files, meta: {requiresAuth: true}
|
||||
}, {path: '/workflows',
|
||||
name: 'workflows',
|
||||
component: Workflows,
|
||||
meta: {requiresAuth: true},
|
||||
}, {path: '/workflows/:id/:step?',
|
||||
|
|
@ -190,10 +203,12 @@ const routes = [{path: '/', component: Dashboard, meta: {requiresAuth: true}}, {
|
|||
meta: {requiresAuth: true},
|
||||
props: true
|
||||
}, {path: '/admin',
|
||||
name: 'admin',
|
||||
component: Admin,
|
||||
meta: {requiresAuth: true}
|
||||
}, {path: '/swatch', component: Swatch, meta: {requiresAuth: true}}, {
|
||||
}, {path: '/swatch', name: 'swatch', component: Swatch, meta: {requiresAuth: true}}, {
|
||||
path: '/print',
|
||||
name: 'print',
|
||||
component: Print,
|
||||
meta: {requiresAuth: true},
|
||||
props: route => {
|
||||
|
|
@ -204,23 +219,27 @@ const routes = [{path: '/', component: Dashboard, meta: {requiresAuth: true}}, {
|
|||
}
|
||||
}, {
|
||||
path: '/scan',
|
||||
name: 'scan',
|
||||
component: Scan,
|
||||
meta: {requiresAuth: true},
|
||||
}, {
|
||||
path: '/search/:query',
|
||||
name: 'search',
|
||||
component: Search,
|
||||
meta: {requiresAuth: true},
|
||||
props: true
|
||||
}, {path: '/login', component: Login, meta: {requiresAuth: false}}, {
|
||||
}, {path: '/login', name: 'login', component: Login, meta: {requiresAuth: false}}, {
|
||||
path: '/register',
|
||||
name: 'register',
|
||||
component: Register,
|
||||
meta: {requiresAuth: false}
|
||||
}, {path: '/pairing', component: Pairing, meta: {requiresAuth: false}}, {
|
||||
}, {path: '/pairing', name: 'pairing', component: Pairing, meta: {requiresAuth: false}}, {
|
||||
path: '/profile',
|
||||
name: 'profile',
|
||||
component: Profile,
|
||||
meta: {requiresAuth: true}
|
||||
}, {
|
||||
path: '/settings', component: Settings, meta: {requiresAuth: true}, children: [{
|
||||
path: '/settings', name: 'settings', component: Settings, meta: {requiresAuth: true}, children: [{
|
||||
path: '', name: 'account', component: Account, meta: {requiresAuth: true}
|
||||
},{
|
||||
path: 'password/', name: 'password', component: Password, meta: {requiresAuth: true}
|
||||
|
|
@ -237,27 +256,31 @@ const routes = [{path: '/', component: Dashboard, meta: {requiresAuth: true}}, {
|
|||
}]
|
||||
}, {
|
||||
// See docs/implementation.md#owner-filtered-overview-routes-use-path-segments-not-query-strings.
|
||||
path: '/storage-location/:owner?',
|
||||
path: '/locations/:owner?',
|
||||
name: 'locations',
|
||||
component: StorageLocation,
|
||||
meta: {requiresAuth: true},
|
||||
props: true
|
||||
}, {
|
||||
path: '/storage-locations/:handle/:id',
|
||||
path: '/locations/:handle/:id',
|
||||
name: 'locations-detail',
|
||||
component: StorageLocationDetail,
|
||||
meta: {requiresAuth: true},
|
||||
props: true
|
||||
}, {
|
||||
path: '/storage-locations/:handle/:id/edit',
|
||||
path: '/locations/:handle/:id/edit',
|
||||
name: 'locations-edit',
|
||||
component: StorageLocationEdit,
|
||||
meta: {requiresAuth: true},
|
||||
props: true
|
||||
}, {
|
||||
// Label/short-link entry point for storage locations, the counterpart of /i/:handle/:id. See docs/implementation.md#item-short-link-redirect-route.
|
||||
path: '/s/:handle/:id',
|
||||
redirect: to => `/storage-locations/${to.params.handle}/${to.params.id}`
|
||||
redirect: to => ({name: 'locations-detail', params: to.params})
|
||||
}, {
|
||||
// See docs/implementation.md#owner-filtered-overview-routes-use-path-segments-not-query-strings.
|
||||
path: '/storage-locations/new/:group?',
|
||||
path: '/locations/new/:group?',
|
||||
name: 'locations-new',
|
||||
component: StorageLocationNew,
|
||||
meta: {requiresAuth: true},
|
||||
props: true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue