@@ -6,28 +6,26 @@ import { toast } from 'vue-sonner'
66import { Button } from ' @/components/ui/button'
77import { Spinner } from ' @/components/ui/spinner'
88import { Input } from ' @/components/ui/input'
9+ import { Label } from ' @/components/ui/label'
910import { Badge } from ' @/components/ui/badge'
1011import { Alert , AlertDescription } from ' @/components/ui/alert'
1112import {
12- Save ,
1313 Lock ,
1414 Calendar ,
1515 Users ,
1616 Hash ,
1717 AlertTriangle ,
18- Trash2 ,
1918 XCircle ,
2019 Shield
2120} from ' lucide-vue-next'
2221import {
23- AlertDialog ,
24- AlertDialogCancel ,
25- AlertDialogContent ,
26- AlertDialogDescription ,
27- AlertDialogFooter ,
28- AlertDialogHeader ,
29- AlertDialogTitle ,
30- } from ' @/components/ui/alert-dialog'
22+ Dialog ,
23+ DialogContent ,
24+ DialogDescription ,
25+ DialogFooter ,
26+ DialogHeader ,
27+ DialogTitle ,
28+ } from ' @/components/ui/dialog'
3129import { TeamService , type Team } from ' @/services/teamService'
3230import { DsCard } from ' @/components/ui/ds-card'
3331import { z } from ' zod'
@@ -56,6 +54,7 @@ const saveError = ref<string | null>(null)
5654const isDeleting = ref (false )
5755const deleteError = ref <string | null >(null )
5856const showDeleteDialog = ref (false )
57+ const confirmationText = ref (' ' )
5958
6059// Form data
6160const formData = ref ({
@@ -97,6 +96,10 @@ const formattedUpdatedDate = computed(() => {
9796 })
9897})
9998
99+ const isConfirmationValid = computed (() => {
100+ return confirmationText .value === ' sudo delete team'
101+ })
102+
100103// Save team changes
101104const saveTeam = async () => {
102105 try {
@@ -288,11 +291,9 @@ watch(() => props.team, () => {
288291 <Button
289292 @click =" saveTeam"
290293 :disabled =" !hasChanges || isSaving"
291- class =" gap-2"
292294 >
293295 <Spinner v-if =" isSaving" class =" mr-2" />
294- <Save v-else class =" h-4 w-4" />
295- {{ t('teams.manage.save') }}
296+ {{ isSaving ? t('teams.manage.saving') : t('teams.manage.save') }}
296297 </Button >
297298 </template >
298299 </DsCard >
@@ -323,34 +324,19 @@ watch(() => props.team, () => {
323324
324325 <!-- Delete Team Content -->
325326 <div v-else class =" space-y-4" >
326- <p class =" text-sm text-muted-foreground " >
327+ <p class =" text-sm" >
327328 {{ t('teams.manage.dangerZone.deleteTeamDescription') }}
328329 </p >
329330
330331 <!-- What gets deleted -->
331- <div class =" bg-muted/50 border rounded-lg p-4" >
332- <h4 class =" text-sm font-medium mb-3" >{{ t('teams.manage.dangerZone.willDelete.title') }}</h4 >
333- <ul class =" text-xs space-y-2" >
334- <li class =" flex items-start gap-2" >
335- <XCircle class =" h-3 w-3 text-destructive mt-0.5 shrink-0" />
336- {{ t('teams.manage.dangerZone.willDelete.servers') }}
337- </li >
338- <li class =" flex items-start gap-2" >
339- <XCircle class =" h-3 w-3 text-destructive mt-0.5 shrink-0" />
340- {{ t('teams.manage.dangerZone.willDelete.credentials') }}
341- </li >
342- <li class =" flex items-start gap-2" >
343- <XCircle class =" h-3 w-3 text-destructive mt-0.5 shrink-0" />
344- {{ t('teams.manage.dangerZone.willDelete.variables') }}
345- </li >
346- <li class =" flex items-start gap-2" >
347- <XCircle class =" h-3 w-3 text-destructive mt-0.5 shrink-0" />
348- {{ t('teams.manage.dangerZone.willDelete.history') }}
349- </li >
350- <li class =" flex items-start gap-2" >
351- <XCircle class =" h-3 w-3 text-destructive mt-0.5 shrink-0" />
352- {{ t('teams.manage.dangerZone.willDelete.members') }}
353- </li >
332+ <div >
333+ <h4 class =" text-sm font-medium mb-2" >{{ t('teams.manage.dangerZone.willDelete.title') }}</h4 >
334+ <ul class =" text-sm space-y-1 list-disc list-inside" >
335+ <li >{{ t('teams.manage.dangerZone.willDelete.servers') }}</li >
336+ <li >{{ t('teams.manage.dangerZone.willDelete.credentials') }}</li >
337+ <li >{{ t('teams.manage.dangerZone.willDelete.variables') }}</li >
338+ <li >{{ t('teams.manage.dangerZone.willDelete.history') }}</li >
339+ <li >{{ t('teams.manage.dangerZone.willDelete.members') }}</li >
354340 </ul >
355341 </div >
356342 </div >
@@ -359,69 +345,74 @@ watch(() => props.team, () => {
359345 <Button
360346 variant =" destructive"
361347 @click =" showDeleteDialog = true"
362- class =" gap-2"
363348 >
364- <Trash2 class =" h-4 w-4" />
365349 {{ t('teams.manage.dangerZone.deleteButton') }}
366350 </Button >
367351 </template >
368352 </DsCard >
369353
370354 <!-- Delete Confirmation Dialog -->
371- <AlertDialog :open =" showDeleteDialog" @update:open =" showDeleteDialog = $event" >
372- <AlertDialogContent class =" sm:max-w-[500px]" >
373- <AlertDialogHeader >
374- <AlertDialogTitle class =" flex items-center gap-2 text-destructive" >
375- <AlertTriangle class =" h-5 w-5" />
376- {{ t('teams.manage.deleteDialog.title') }}
377- </AlertDialogTitle >
378- <AlertDialogDescription class =" space-y-4" >
355+ <Dialog
356+ :open =" showDeleteDialog"
357+ @update:open =" (value) => {
358+ showDeleteDialog = value
359+ if (!value) confirmationText = ''
360+ }"
361+ >
362+ <DialogContent class =" sm:max-w-[600px]" >
363+ <DialogHeader >
364+ <DialogTitle >{{ t('teams.manage.deleteDialog.title') }}</DialogTitle >
365+ <DialogDescription class =" space-y-4" >
379366 <p >{{ t('teams.manage.deleteDialog.warning') }}</p >
380367
381368 <div class =" rounded-lg border p-3 bg-muted/50" >
382369 <p class =" font-medium text-sm mb-1" >{{ t('teams.manage.deleteDialog.teamName') }}:</p >
383370 <p class =" font-mono text-sm" >"{{ team.name }}"</p >
384371 </div >
385372
386- <div class =" rounded-lg border-destructive/50 bg-destructive/5 p-4 space-y-3" >
387- <p class =" text-sm font-medium text-destructive" >{{ t('teams.manage.deleteDialog.consequences') }}</p >
388- <ul class =" text-xs space-y-2" >
389- <li class =" flex items-start gap-2" >
390- <XCircle class =" h-3 w-3 text-destructive mt-0.5 shrink-0" />
391- {{ t('teams.manage.deleteDialog.consequencesList.servers') }}
392- </li >
393- <li class =" flex items-start gap-2" >
394- <XCircle class =" h-3 w-3 text-destructive mt-0.5 shrink-0" />
395- {{ t('teams.manage.deleteDialog.consequencesList.credentials') }}
396- </li >
397- <li class =" flex items-start gap-2" >
398- <XCircle class =" h-3 w-3 text-destructive mt-0.5 shrink-0" />
399- {{ t('teams.manage.deleteDialog.consequencesList.variables') }}
400- </li >
401- <li class =" flex items-start gap-2" >
402- <XCircle class =" h-3 w-3 text-destructive mt-0.5 shrink-0" />
403- {{ t('teams.manage.deleteDialog.consequencesList.history') }}
404- </li >
373+ <div >
374+ <p class =" text-sm font-medium mb-2" >{{ t('teams.manage.deleteDialog.consequences') }}</p >
375+ <ul class =" text-sm space-y-1 list-disc list-inside" >
376+ <li >{{ t('teams.manage.deleteDialog.consequencesList.servers') }}</li >
377+ <li >{{ t('teams.manage.deleteDialog.consequencesList.credentials') }}</li >
378+ <li >{{ t('teams.manage.deleteDialog.consequencesList.variables') }}</li >
379+ <li >{{ t('teams.manage.deleteDialog.consequencesList.history') }}</li >
405380 </ul >
406381 </div >
407- </AlertDialogDescription >
408- </AlertDialogHeader >
409- <AlertDialogFooter >
410- <AlertDialogCancel @click =" showDeleteDialog = false" >
382+
383+ <div class =" space-y-2" >
384+ <Label for =" delete-confirmation" >
385+ {{ t('teams.manage.deleteDialog.confirmationLabel') }}
386+ </Label >
387+ <Input
388+ id =" delete-confirmation"
389+ v-model =" confirmationText"
390+ :placeholder =" t('teams.manage.deleteDialog.confirmationPlaceholder')"
391+ class =" font-mono"
392+ />
393+ <p class =" text-xs text-muted-foreground" >
394+ {{ t('teams.manage.deleteDialog.confirmationRequired') }}
395+ </p >
396+ </div >
397+ </DialogDescription >
398+ </DialogHeader >
399+ <DialogFooter >
400+ <Button
401+ variant =" outline"
402+ @click =" showDeleteDialog = false"
403+ >
411404 {{ t('teams.manage.deleteDialog.cancel') }}
412- </AlertDialogCancel >
405+ </Button >
413406 <Button
414407 variant =" destructive"
415408 @click =" deleteTeam"
416- :disabled =" isDeleting"
417- class =" gap-2"
409+ :disabled =" !isConfirmationValid || isDeleting"
418410 >
419411 <Spinner v-if =" isDeleting" class =" mr-2" />
420- <Trash2 v-else class =" h-4 w-4" />
421- {{ t('teams.manage.deleteDialog.confirm') }}
412+ {{ isDeleting ? t('teams.manage.deleteDialog.deleting') : t('teams.manage.deleteDialog.confirm') }}
422413 </Button >
423- </AlertDialogFooter >
424- </AlertDialogContent >
425- </AlertDialog >
414+ </DialogFooter >
415+ </DialogContent >
416+ </Dialog >
426417 </div >
427418</template >
0 commit comments