fix: make the last acl tag removable on machines
This commit is contained in:
parent
09e1b1f261
commit
6e55f442fd
@ -3,6 +3,7 @@ import { ActionFunctionArgs, json } from '@remix-run/node'
|
||||
|
||||
import { del, post } from '~/utils/headscale'
|
||||
import { getSession } from '~/utils/sessions'
|
||||
import log from '~/utils/log'
|
||||
|
||||
export async function menuAction(request: ActionFunctionArgs['request']) {
|
||||
const session = await getSession(request.headers.get('Cookie'))
|
||||
@ -82,7 +83,9 @@ export async function menuAction(request: ActionFunctionArgs['request']) {
|
||||
|
||||
case 'tags': {
|
||||
const tags = data.get('tags')?.toString()
|
||||
.split(',') ?? []
|
||||
.split(',')
|
||||
.filter((tag) => tag.trim() !== '')
|
||||
?? []
|
||||
|
||||
try {
|
||||
await post(`v1/node/${id}/tags`, session.get('hsApiKey')!, {
|
||||
@ -90,7 +93,8 @@ export async function menuAction(request: ActionFunctionArgs['request']) {
|
||||
})
|
||||
|
||||
return json({ message: 'Tags updated' })
|
||||
} catch {
|
||||
} catch (error) {
|
||||
log.debug('APIC', 'Failed to update tags: %s', error)
|
||||
return json({ message: 'Failed to update tags' }, {
|
||||
status: 500,
|
||||
})
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import { PlusIcon, XIcon } from '@primer/octicons-react'
|
||||
import { Form, useSubmit } from '@remix-run/react'
|
||||
import { type Dispatch, type SetStateAction, useState } from 'react'
|
||||
import { Dispatch, SetStateAction, useState } from 'react'
|
||||
import { Button, Input } from 'react-aria-components'
|
||||
|
||||
import Dialog from '~/components/Dialog'
|
||||
import Link from '~/components/Link'
|
||||
import { type Machine } from '~/types'
|
||||
import { Machine } from '~/types'
|
||||
import { cn } from '~/utils/cn'
|
||||
|
||||
interface TagsProps {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user