Skip to content

Commit 7584c77

Browse files
committed
Add registration token functionality, remove unused vue pages
1 parent 89713b2 commit 7584c77

17 files changed

+241
-996
lines changed

adminui2/src/App.vue

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const authStore = useAuthStore()
1313
const devicesStore = useDevicesStore()
1414
const usersStore = useUsersStore()
1515
16-
const { hasCompletedAuth, hasTriedAuth, loggedInUser, isLoggedIn } = storeToRefs(authStore)
16+
const { hasCompletedAuth, hasTriedAuth, isLoggedIn } = storeToRefs(authStore)
1717
1818
const toast = useToast()
1919
@@ -29,7 +29,6 @@ onMounted(async () => {
2929
3030
watch(hasCompletedAuth, (newHasCompletedAuth, prevHasCompletedAuth) => {
3131
if (newHasCompletedAuth && !prevHasCompletedAuth) {
32-
toast.success(`Welcome ${loggedInUser.value?.username}`)
3332
devicesStore.load(true)
3433
usersStore.load(true)
3534
}
+11-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
import type { RegistrationToken } from './types'
1+
import type { GenericResponseDTO, RegistrationTokenRequestDTO } from './types'
22

33
import { client } from '.'
44

5-
export function getAllRegistrationTokens(): Promise<RegistrationToken[]> {
5+
export function getAllRegistrationTokens(): Promise<RegistrationTokenRequestDTO[]> {
66
return client.get('/api/management/registration_tokens').then(res => res.data)
77
}
8+
9+
10+
export function createRegistrationToken(token: RegistrationTokenRequestDTO): Promise<GenericResponseDTO> {
11+
return client.post('/api/management/registration_tokens', token).then(res => res.data)
12+
}
13+
14+
export function deleteRegistrationTokens(tokens: string[]): Promise<GenericResponseDTO> {
15+
return client.delete('/api/management/registration_tokens', {data: tokens}).then(res => res.data)
16+
}

adminui2/src/api/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export interface RuleDTO {
55
deny_routes: string[]
66
}
77

8-
export interface RegistrationToken {
8+
export interface RegistrationTokenRequestDTO {
99
token: string
1010
username: string
1111
groups: string[]

adminui2/src/components/ConfirmModal.vue

+2-6
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ function confirm() {
2222
<div :class="isOpen ? 'modal modal-open' : 'modal'">
2323
<form method="dialog" class="remove-card-backgrounds modal-box text-left">
2424
<button @click="() => (isOpen = false)" class="btn btn-circle btn-ghost btn-sm absolute right-2 top-2">✕</button>
25-
<h2 class="my-4 text-xl font-bold">{{ title }}</h2>
26-
<p>{{ body }}</p>
25+
<h2 class="my-4 font-mono text-xl font-bold">{{ title }}</h2>
26+
<p class="font-mono">{{ body }}</p>
2727

2828
<div class="modal-action">
2929
<button class="btn m-1" @click="() => (isOpen = false)">Cancel</button>
@@ -44,10 +44,6 @@ function confirm() {
4444
max-width: 90vw;
4545
width: auto;
4646
}
47-
/* .modal::backdrop { */
48-
/* background-color: rgba(0, 0, 0, 0.3); */
49-
/* animation: modal-pop 0.2s ease-out; */
50-
/* } */
5147
</style>
5248

5349
<style>

adminui2/src/layouts/default.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const policyLinks = [
3030
]
3131
3232
const managementLinks = [
33-
{ name: 'Registration Tokens', icon: Icons.RegistrationKey, to: '/admin/general' },
33+
{ name: 'Registration Tokens', icon: Icons.RegistrationKey, to: '/management/registration_tokens' },
3434
{ name: 'Users', icon: Icons.Groups, to: '/admin/users' },
3535
{ name: 'Devices', icon: Icons.Device, to: '/admin/users' }
3636
]

adminui2/src/pages/Agents.vue

-149
This file was deleted.

adminui2/src/pages/AttackTemplates.vue

-148
This file was deleted.

0 commit comments

Comments
 (0)