Skip to content

Commit

Permalink
Re-org pages and routes
Browse files Browse the repository at this point in the history
- Add "/ingest" and "/storage" prefixes to routes.
- Rename "/packages" to "/sips".
- Rename "/locations/[id]/packages" to "/locations/[id]/aips".
- Update pages directory structure to match.
  • Loading branch information
jraddaoui committed Feb 10, 2025
1 parent c5d6175 commit 9adb28f
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 32 deletions.
6 changes: 3 additions & 3 deletions dashboard/src/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const menuItems = [
show: authStore.checkAttributes(["package:list"]),
},
{
route: router.resolve("/packages/"),
route: router.resolve("/ingest/sips/"),
icon: IconSIPs,
text: "SIPs",
show: authStore.checkAttributes(["package:list"]),
Expand All @@ -41,13 +41,13 @@ const menuItems = [
authStore.checkAttributes(["storage:aip:list"]),
},
{
route: router.resolve("/locations/"),
route: router.resolve("/storage/locations/"),
icon: IconLocations,
text: "Locations",
show: authStore.checkAttributes(["storage:location:list"]),
},
{
route: router.resolve("/aips/"),
route: router.resolve("/storage/aips/"),
icon: IconAIPs,
text: "AIPs",
show: authStore.checkAttributes(["storage:aip:list"]),
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useRoute, useRouter } from "vue-router/auto";
import IconSIPs from "~icons/octicon/package-dependencies-24";
import IconDetails from "~icons/clarity/details-line?raw&font-size=20px";
const route = useRoute("/packages/[id]");
const route = useRoute("/ingest/sips/[id]");
const router = useRouter();
const authStore = useAuthStore();
const packageStore = usePackageStore();
Expand All @@ -24,7 +24,7 @@ const tabs = [
icon: IconDetails,
text: "Summary",
route: router.resolve({
name: "/packages/[id]/",
name: "/ingest/sips/[id]/",
params: { id: route.params.id },
}),
show: authStore.checkAttributes(["package:read"]),
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const toggleLegend = () => {
const doSearch = () => {
router.push({
name: "/packages/",
name: "/ingest/sips/",
query: { ...route.query, name: packageStore.filters.name },
});
};
Expand All @@ -68,7 +68,7 @@ const tabs = computed(() => [
icon: IconAll,
text: "All",
route: router.resolve({
name: "/packages/",
name: "/ingest/sips/",
query: { ...route.query, status: undefined },
}),
show: true,
Expand All @@ -77,7 +77,7 @@ const tabs = computed(() => [
icon: IconDone,
text: "Done",
route: router.resolve({
name: "/packages/",
name: "/ingest/sips/",
query: { ...route.query, status: "done" },
}),
show: true,
Expand All @@ -86,7 +86,7 @@ const tabs = computed(() => [
icon: IconError,
text: "Error",
route: router.resolve({
name: "/packages/",
name: "/ingest/sips/",
query: { ...route.query, status: "error" },
}),
show: true,
Expand All @@ -95,7 +95,7 @@ const tabs = computed(() => [
icon: IconInProgress,
text: "In progress",
route: router.resolve({
name: "/packages/",
name: "/ingest/sips/",
query: { ...route.query, status: "in progress" },
}),
show: true,
Expand All @@ -104,7 +104,7 @@ const tabs = computed(() => [
icon: IconQueued,
text: "Queued",
route: router.resolve({
name: "/packages/",
name: "/ingest/sips/",
query: { ...route.query, status: "queued" },
}),
show: true,
Expand Down Expand Up @@ -215,7 +215,7 @@ watch(
<td>
<router-link
v-if="authStore.checkAttributes(['package:read'])"
:to="{ name: '/packages/[id]/', params: { id: pkg.id } }"
:to="{ name: '/ingest/sips/[id]/', params: { id: pkg.id } }"
>{{ pkg.name }}</router-link
>
<span v-else>{{ pkg.name }}</span>
Expand Down
3 changes: 3 additions & 0 deletions dashboard/src/pages/storage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<router-view></router-view>
</template>
3 changes: 3 additions & 0 deletions dashboard/src/pages/storage/locations.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<router-view></router-view>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import IconAIPs from "~icons/clarity/bundle-line?raw&font-size=20px";
import IconDetails from "~icons/clarity/details-line?raw&font-size=20px";
import IconLocations from "~icons/octicon/server-24";
const route = useRoute("/locations/[id]");
const route = useRoute("/storage/locations/[id]");
const router = useRouter();
const authStore = useAuthStore();
const storageStore = useStorageStore();
Expand All @@ -24,7 +24,7 @@ const tabs = [
icon: IconDetails,
text: "Summary",
route: router.resolve({
name: "/locations/[id]/",
name: "/storage/locations/[id]/",
params: { id: route.params.id },
}),
show: authStore.checkAttributes(["storage:location:read"]),
Expand All @@ -33,7 +33,7 @@ const tabs = [
icon: IconAIPs,
text: "AIPs",
route: router.resolve({
name: "/locations/[id]/packages",
name: "/storage/locations/[id]/aips",
params: { id: route.params.id },
}),
show: authStore.checkAttributes(["storage:location:listPackages"]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ const { execute, error } = useAsyncState(() => {
<td>
<router-link
v-if="authStore.checkAttributes(['storage:location:read'])"
:to="{ name: '/locations/[id]/', params: { id: item.uuid } }"
:to="{
name: '/storage/locations/[id]/',
params: { id: item.uuid },
}"
>{{ item.name }}</router-link
>
<span v-else>{{ item.name }}</span>
Expand Down
10 changes: 5 additions & 5 deletions dashboard/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const router = createRouter({

const signinRoutes: string[] = ["/user/signin", "/user/signin-callback"];
const protectedRoutes: Record<string, string[]> = {
"/packages/": ["package:list"],
"/packages/[id]/": ["package:read"],
"/locations/": ["storage:location:list"],
"/locations/[id]/": ["storage:location:read"],
"/locations/[id]/packages": ["storage:location:listPackages"],
"/ingest/sips/": ["package:list"],
"/ingest/sips/[id]/": ["package:read"],
"/storage/locations/": ["storage:location:list"],
"/storage/locations/[id]/": ["storage:location:read"],
"/storage/locations/[id]/aips": ["storage:location:listPackages"],
};

router.beforeEach(async (to, _, next) => {
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/stores/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const usePackageStore = defineStore("package", {

layoutStore.updateBreadcrumb([
{ text: "Ingest" },
{ route: router.resolve("/packages/"), text: "SIPs" },
{ route: router.resolve("/ingest/sips/"), text: "SIPs" },
{ text: this.current.name },
]);

Expand Down
5 changes: 4 additions & 1 deletion dashboard/src/stores/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export const useStorageStore = defineStore("storage", {
const layoutStore = useLayoutStore();
layoutStore.updateBreadcrumb([
{ text: "Storage" },
{ route: router.resolve({ name: "/locations/" }), text: "Locations" },
{
route: router.resolve({ name: "/storage/locations/" }),
text: "Locations",
},
{ text: this.current.name },
]);

Expand Down
20 changes: 11 additions & 9 deletions dashboard/typed-router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ declare module 'vue-router/auto-routes' {
export interface RouteNamedMap {
'/': RouteRecordInfo<'/', '/', Record<never, never>, Record<never, never>>,
'/[...path]': RouteRecordInfo<'/[...path]', '/:path(.*)', { path: ParamValue<true> }, { path: ParamValue<false> }>,
'/locations': RouteRecordInfo<'/locations', '/locations', Record<never, never>, Record<never, never>>,
'/locations/': RouteRecordInfo<'/locations/', '/locations', Record<never, never>, Record<never, never>>,
'/locations/[id]': RouteRecordInfo<'/locations/[id]', '/locations/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
'/locations/[id]/': RouteRecordInfo<'/locations/[id]/', '/locations/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
'/locations/[id]/packages': RouteRecordInfo<'/locations/[id]/packages', '/locations/:id/packages', { id: ParamValue<true> }, { id: ParamValue<false> }>,
'/packages': RouteRecordInfo<'/packages', '/packages', Record<never, never>, Record<never, never>>,
'/packages/': RouteRecordInfo<'/packages/', '/packages', Record<never, never>, Record<never, never>>,
'/packages/[id]': RouteRecordInfo<'/packages/[id]', '/packages/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
'/packages/[id]/': RouteRecordInfo<'/packages/[id]/', '/packages/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
'/ingest': RouteRecordInfo<'/ingest', '/ingest', Record<never, never>, Record<never, never>>,
'/ingest/sips': RouteRecordInfo<'/ingest/sips', '/ingest/sips', Record<never, never>, Record<never, never>>,
'/ingest/sips/': RouteRecordInfo<'/ingest/sips/', '/ingest/sips', Record<never, never>, Record<never, never>>,
'/ingest/sips/[id]': RouteRecordInfo<'/ingest/sips/[id]', '/ingest/sips/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
'/ingest/sips/[id]/': RouteRecordInfo<'/ingest/sips/[id]/', '/ingest/sips/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
'/storage': RouteRecordInfo<'/storage', '/storage', Record<never, never>, Record<never, never>>,
'/storage/locations': RouteRecordInfo<'/storage/locations', '/storage/locations', Record<never, never>, Record<never, never>>,
'/storage/locations/': RouteRecordInfo<'/storage/locations/', '/storage/locations', Record<never, never>, Record<never, never>>,
'/storage/locations/[id]': RouteRecordInfo<'/storage/locations/[id]', '/storage/locations/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
'/storage/locations/[id]/': RouteRecordInfo<'/storage/locations/[id]/', '/storage/locations/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
'/storage/locations/[id]/aips': RouteRecordInfo<'/storage/locations/[id]/aips', '/storage/locations/:id/aips', { id: ParamValue<true> }, { id: ParamValue<false> }>,
'/user': RouteRecordInfo<'/user', '/user', Record<never, never>, Record<never, never>>,
'/user/signin': RouteRecordInfo<'/user/signin', '/user/signin', Record<never, never>, Record<never, never>>,
'/user/signin-callback': RouteRecordInfo<'/user/signin-callback', '/user/signin-callback', Record<never, never>, Record<never, never>>,
Expand Down

0 comments on commit 9adb28f

Please sign in to comment.