Skip to content

Commit 89c4ef6

Browse files
committed
feat(front): catch-all route to report not found
Add catch-all route to report page not found with button to clusters.
1 parent f77ccf6 commit 89c4ef6

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Back button in job details page redirect to node details page when clicking
1515
on a job running on a node (#663).
1616
- Add support for running under a subfolder prefix on HTTP server.
17+
- Add catch-all route to report page not found with button to clusters.
1718
- agent:
1819
- Automatically discover latest Slurm REST API version supported by
1920
`slurmrestd` among the list of Slurm-web supported versions declared in

frontend/src/router/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import QosView from '@/views/QosView.vue'
3030
import ReservationsView from '@/views/ReservationsView.vue'
3131
import JobsStatusBadges from '@/views/tests/JobsStatusBadges.vue'
3232
import NodesStatusBadges from '@/views/tests/NodesStatusBadges.vue'
33+
import NotFoundView from '@/views/NotFoundView.vue'
3334

3435
const router = createRouter({
3536
history: createWebHistory(import.meta.env.BASE_URL),
@@ -169,6 +170,11 @@ const router = createRouter({
169170
path: '/tests/nodes-status-badges',
170171
name: 'tests-nodes-status-badges',
171172
component: NodesStatusBadges
173+
},
174+
{
175+
path: '/:pathMatch(.*)*',
176+
name: 'not-found',
177+
component: NotFoundView
172178
}
173179
]
174180
})
@@ -182,7 +188,7 @@ router.beforeEach(async (to, from) => {
182188
'/tests/jobs-status-badges',
183189
'/tests/nodes-status-badges'
184190
]
185-
const authRequired = !publicPages.includes(to.path)
191+
const authRequired = !publicPages.includes(to.path) && to.name !== 'not-found'
186192
const auth = useAuthStore()
187193
const runtime = useRuntimeStore()
188194
const runtimeConfiguration = useRuntimeConfiguration()
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!--
2+
Copyright (c) 2025 Rackslab
3+
4+
This file is part of Slurm-web.
5+
6+
SPDX-License-Identifier: MIT
7+
-->
8+
9+
<script setup lang="ts">
10+
import { RouterLink } from 'vue-router'
11+
</script>
12+
13+
<template>
14+
<main>
15+
<section class="bg-slurmweb-light flex h-screen items-center justify-center dark:bg-gray-900">
16+
<div class="mx-auto max-w-md text-center">
17+
<div class="mb-8">
18+
<h1 class="text-9xl font-bold text-gray-400 dark:text-gray-600" aria-label="404">404</h1>
19+
</div>
20+
<div class="mb-8">
21+
<h2 class="mb-4 text-2xl font-semibold text-gray-900 dark:text-white">Page not found</h2>
22+
<p class="text-sm text-gray-600 dark:text-gray-400">
23+
The page you are looking for does not exist or has been moved.
24+
</p>
25+
</div>
26+
<div>
27+
<RouterLink
28+
:to="{ name: 'clusters' }"
29+
class="bg-slurmweb hover:bg-slurmweb-dark focus:ring-slurmweb-light dark:bg-slurmweb-dark dark:hover:bg-slurmweb dark:focus:ring-slurmweb-verydark inline-flex items-center rounded-lg px-5 py-2.5 text-sm font-medium text-white focus:ring-4 focus:outline-hidden"
30+
>
31+
Go to clusters
32+
</RouterLink>
33+
</div>
34+
</div>
35+
</section>
36+
</main>
37+
</template>

0 commit comments

Comments
 (0)