нахуевертил. it works but sucks, tryed to add reactivity to admin page and its child dialogs and components
This commit is contained in:
@@ -9,22 +9,36 @@ import DeleteDeviceDialog from './DeleteDeviceDialog.vue'
|
||||
import DeviceCertificateDialog from './DeviceCertificateDialog.vue'
|
||||
import DeviceTasksDialog from './DeviceTasksDialog.vue'
|
||||
import { Ellipsis } from 'lucide-vue-next'
|
||||
import type { Device } from '@/lib/interfaces'
|
||||
import type { Device, Users } from '@/lib/interfaces'
|
||||
// import { api } from '@/lib/api'
|
||||
|
||||
const props = defineProps<{ row: Device }>() // ← accept full row
|
||||
const props = defineProps<{
|
||||
row: Device
|
||||
allUsers?: Users[]
|
||||
onRowUpdated?: (row: Device, payload: { name: string; userIds: string[] }) => void
|
||||
onRowDeleted?: (row: Device) => void
|
||||
}>() // ← accept full row
|
||||
|
||||
const isEditOpen = ref(false)
|
||||
const isDeleteOpen = ref(false)
|
||||
const isTasksOpen = ref(false)
|
||||
const itCertsOpen = ref(false)
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'refresh'): void
|
||||
(e: 'error', err: unknown): void
|
||||
}>()
|
||||
|
||||
function onDeleteConfirmed() {
|
||||
// await api.delete(`/devices/${encodeURIComponent(props.row.guid)}`)
|
||||
isDeleteOpen.value = false
|
||||
// emit('refresh')
|
||||
props.onRowDeleted?.(props.row)
|
||||
}
|
||||
function onEditConfirm() {
|
||||
function onEditConfirm(_payload: { name: string; userIds: string[] }) {
|
||||
isEditOpen.value = false
|
||||
// emit('refresh')
|
||||
props.onRowUpdated?.(props.row, _payload)
|
||||
}
|
||||
|
||||
function onTaskConfirm() {
|
||||
@@ -47,11 +61,11 @@ function onCertsConfirm() {
|
||||
<DropdownMenuItem @click.prevent="isEditOpen = true">Rename</DropdownMenuItem>
|
||||
<DropdownMenuItem @click.prevent="isTasksOpen = true">Tasks</DropdownMenuItem>
|
||||
<DropdownMenuItem @click.prevent="itCertsOpen = true">Certificates</DropdownMenuItem>
|
||||
<DropdownMenuItem @click.prevent="isDeleteOpen = true">Delete</DropdownMenuItem>
|
||||
<DropdownMenuItem class="text-destructive" @click.prevent="isDeleteOpen = true">Delete</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
<EditDeviceDialog v-model:modelValue="isEditOpen" :device="props.row" @confirm="onEditConfirm" />
|
||||
<EditDeviceDialog v-model:modelValue="isEditOpen" :device="props.row" :all-users="props.allUsers" @confirm="onEditConfirm" />
|
||||
<DeleteDeviceDialog v-model:modelValue="isDeleteOpen" :device="props.row" @confirm="onDeleteConfirmed" />
|
||||
<DeviceCertificateDialog v-model:modelValue="itCertsOpen" :device="props.row" @confirm="onCertsConfirm" />
|
||||
<DeviceTasksDialog v-model:modelValue="isTasksOpen" :device="props.row" @confirm="onTaskConfirm" />
|
||||
|
||||
Reference in New Issue
Block a user