pre: set change password to user dropdpwn

This commit is contained in:
马登山
2025-11-05 14:29:57 +08:00
parent 43cb1591ae
commit e79dd87fc3
2 changed files with 14 additions and 3 deletions
+12 -1
View File
@@ -11,20 +11,26 @@
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent class="w-48" align="end" side="top">
<DropdownMenuItem @select="handleChangePassword">
<Icon name="ri:lock-password-line" class="h-4 w-4" />
<span>{{ t('Change Password') }}</span>
</DropdownMenuItem>
<DropdownMenuItem @select="handleLogout">
<Icon name="ri:logout-box-r-line" class="h-4 w-4" />
<span>{{ t('Logout') }}</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
<AccessKeysChangePassword v-model:visible="changePasswordVisible" />
</template>
<script lang="ts" setup>
import { Icon } from '#components'
import { Button } from '@/components/ui/button'
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'
import { defineProps, toRef, withDefaults } from 'vue'
import { defineProps, ref, toRef, withDefaults } from 'vue'
import { useI18n } from 'vue-i18n'
import AccessKeysChangePassword from '@/components/access-keys/change-password.vue'
const { t } = useI18n()
const { logout } = useAuth()
@@ -40,6 +46,11 @@ const props = withDefaults(
)
const isCollapsed = toRef(props, 'isCollapsed')
const changePasswordVisible = ref(false)
const handleChangePassword = () => {
changePasswordVisible.value = true
}
const handleLogout = async () => {
await logout()
+2 -2
View File
@@ -4,10 +4,10 @@
<h1 class="text-2xl font-bold">{{ t('Access Keys') }}</h1>
<template #actions>
<SearchInput v-model="searchTerm" :placeholder="t('Search Access Key')" clearable class="max-w-xs" />
<Button variant="outline" @click="changePasswordVisible = true">
<!-- <Button variant="outline" @click="changePasswordVisible = true">
<Icon name="ri:key-2-line" class="size-4" />
<span>{{ t('Change Password') }}</span>
</Button>
</Button> -->
<Button variant="outline" v-if="selectedKeys.length" :disabled="!selectedKeys.length" @click="deleteSelected">
<Icon name="ri:delete-bin-5-line" class="size-4" />
<span>{{ t('Delete Selected') }}</span>