diff --git a/frontend/src/components/admin/StatisticsCard.vue b/frontend/src/components/admin/StatisticsCard.vue
index 25b93f3..1bc5b1e 100644
--- a/frontend/src/components/admin/StatisticsCard.vue
+++ b/frontend/src/components/admin/StatisticsCard.vue
@@ -1,29 +1,25 @@
diff --git a/frontend/src/components/page/PageHeader.vue b/frontend/src/components/page/PageHeader.vue
index 9581d27..e99e1b7 100644
--- a/frontend/src/components/page/PageHeader.vue
+++ b/frontend/src/components/page/PageHeader.vue
@@ -1,5 +1,6 @@
@@ -7,7 +8,7 @@ const config = useConfigStore();
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index bf5a0fb..0394c0c 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -1,25 +1,38 @@
-import {createRouter, createWebHistory} from "vue-router";
+import {createRouter, createWebHistory, type LocationQueryRaw, type RouteLocationRaw} from "vue-router";
import AdminDashboardView from "@/views/AdminDashboardView.vue";
import AdminNodesView from "@/views/AdminNodesView.vue";
import HomeView from "@/views/HomeView.vue";
import {isNodesFilter, isNodeSortField, isSortDirection, type SearchTerm} from "@/types";
+export enum RouteName {
+ HOME = "home",
+ ADMIN = "admin",
+ ADMIN_NODES = "admin-nodes",
+}
+
+export function route(name: RouteName, query?: LocationQueryRaw): RouteLocationRaw {
+ return {
+ name,
+ query,
+ };
+}
+
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: "/",
- name: "home",
+ name: RouteName.HOME,
component: HomeView,
},
{
path: "/admin",
- name: "admin",
+ name: RouteName.ADMIN,
component: AdminDashboardView,
},
{
path: "/admin/nodes",
- name: "admin-nodes",
+ name: RouteName.ADMIN_NODES,
component: AdminNodesView,
props: route => {
let filter: any;
diff --git a/frontend/src/views/AdminDashboardView.vue b/frontend/src/views/AdminDashboardView.vue
index 35a1217..a3d607b 100644
--- a/frontend/src/views/AdminDashboardView.vue
+++ b/frontend/src/views/AdminDashboardView.vue
@@ -2,6 +2,7 @@
import StatisticsCard from "@/components/admin/StatisticsCard.vue";
import {useStatisticsStore} from "@/stores/statistics";
import {ComponentVariant, MonitoringState} from "@/types";
+import {RouteName} from "@/router";
import PageContainer from "@/components/page/PageContainer.vue";
const statistics = useStatisticsStore();
@@ -23,14 +24,14 @@ refresh();
icon="circle-o"
:variant="ComponentVariant.INFO"
:value="statistics.getStatistics.nodes.registered"
- link="/admin/nodes"
+ :route="RouteName.ADMIN_NODES"
/>
diff --git a/frontend/src/views/AdminNodesView.vue b/frontend/src/views/AdminNodesView.vue
index 44c8710..0b273f8 100644
--- a/frontend/src/views/AdminNodesView.vue
+++ b/frontend/src/views/AdminNodesView.vue
@@ -8,7 +8,7 @@ import ActionButton from "@/components/form/ActionButton.vue";
import LoadingContainer from "@/components/LoadingContainer.vue";
import NodesFilterPanel from "@/components/nodes/NodesFilterPanel.vue";
import {SortTH} from "@/components/table/SortTH.vue";
-import router from "@/router";
+import router, {route, RouteName} from "@/router";
const NODE_PER_PAGE = 50;
@@ -92,15 +92,17 @@ async function updateRouterState(
sortField: NodeSortField,
): Promise {
const filterStr = Object.keys(filter).length > 0 ? JSON.stringify(filter) : undefined;
- await router.replace({
- path: '/admin/nodes',
- query: {
- q: searchTerm || undefined,
- filter: filterStr,
- sortDir: sortDirection,
- sortField: sortField,
- }
- });
+ await router.replace(
+ route(
+ RouteName.ADMIN_NODES,
+ {
+ q: searchTerm || undefined,
+ filter: filterStr,
+ sortDir: sortDirection,
+ sortField: sortField,
+ }
+ )
+ );
}
async function updateFilter(filter: NodesFilter, searchTerm: SearchTerm): Promise {