Skip to content

Commit

Permalink
Add registration token functionality, remove unused vue pages
Browse files Browse the repository at this point in the history
  • Loading branch information
NHAS committed Nov 21, 2024
1 parent 89713b2 commit 7584c77
Show file tree
Hide file tree
Showing 17 changed files with 241 additions and 996 deletions.
3 changes: 1 addition & 2 deletions adminui2/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const authStore = useAuthStore()
const devicesStore = useDevicesStore()
const usersStore = useUsersStore()
const { hasCompletedAuth, hasTriedAuth, loggedInUser, isLoggedIn } = storeToRefs(authStore)
const { hasCompletedAuth, hasTriedAuth, isLoggedIn } = storeToRefs(authStore)
const toast = useToast()
Expand All @@ -29,7 +29,6 @@ onMounted(async () => {
watch(hasCompletedAuth, (newHasCompletedAuth, prevHasCompletedAuth) => {
if (newHasCompletedAuth && !prevHasCompletedAuth) {
toast.success(`Welcome ${loggedInUser.value?.username}`)
devicesStore.load(true)
usersStore.load(true)
}
Expand Down
13 changes: 11 additions & 2 deletions adminui2/src/api/registration_tokens.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import type { RegistrationToken } from './types'
import type { GenericResponseDTO, RegistrationTokenRequestDTO } from './types'

import { client } from '.'

export function getAllRegistrationTokens(): Promise<RegistrationToken[]> {
export function getAllRegistrationTokens(): Promise<RegistrationTokenRequestDTO[]> {
return client.get('/api/management/registration_tokens').then(res => res.data)
}


export function createRegistrationToken(token: RegistrationTokenRequestDTO): Promise<GenericResponseDTO> {
return client.post('/api/management/registration_tokens', token).then(res => res.data)
}

export function deleteRegistrationTokens(tokens: string[]): Promise<GenericResponseDTO> {
return client.delete('/api/management/registration_tokens', {data: tokens}).then(res => res.data)
}
2 changes: 1 addition & 1 deletion adminui2/src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface RuleDTO {
deny_routes: string[]
}

export interface RegistrationToken {
export interface RegistrationTokenRequestDTO {
token: string
username: string
groups: string[]
Expand Down
8 changes: 2 additions & 6 deletions adminui2/src/components/ConfirmModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function confirm() {
<div :class="isOpen ? 'modal modal-open' : 'modal'">
<form method="dialog" class="remove-card-backgrounds modal-box text-left">
<button @click="() => (isOpen = false)" class="btn btn-circle btn-ghost btn-sm absolute right-2 top-2">✕</button>
<h2 class="my-4 text-xl font-bold">{{ title }}</h2>
<p>{{ body }}</p>
<h2 class="my-4 font-mono text-xl font-bold">{{ title }}</h2>
<p class="font-mono">{{ body }}</p>

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

<style>
Expand Down
2 changes: 1 addition & 1 deletion adminui2/src/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const policyLinks = [
]
const managementLinks = [
{ name: 'Registration Tokens', icon: Icons.RegistrationKey, to: '/admin/general' },
{ name: 'Registration Tokens', icon: Icons.RegistrationKey, to: '/management/registration_tokens' },
{ name: 'Users', icon: Icons.Groups, to: '/admin/users' },
{ name: 'Devices', icon: Icons.Device, to: '/admin/users' }
]
Expand Down
149 changes: 0 additions & 149 deletions adminui2/src/pages/Agents.vue

This file was deleted.

148 changes: 0 additions & 148 deletions adminui2/src/pages/AttackTemplates.vue

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 7584c77

Please sign in to comment.