2023-09-26 15:34:16 +00:00
|
|
|
<script lang="ts" setup>
|
2024-06-26 10:42:50 +00:00
|
|
|
import { rbacAnnotations } from "@/constants/annotations";
|
|
|
|
import { formatDatetime } from "@/utils/date";
|
|
|
|
import type { DetailedUser } from "@halo-dev/api-client";
|
2023-09-26 15:34:16 +00:00
|
|
|
import {
|
2024-04-26 04:36:59 +00:00
|
|
|
IconInformation,
|
2023-09-26 15:34:16 +00:00
|
|
|
IconUserSettings,
|
|
|
|
VDescription,
|
|
|
|
VDescriptionItem,
|
|
|
|
VTag,
|
|
|
|
} from "@halo-dev/components";
|
2024-04-26 04:36:59 +00:00
|
|
|
import RiVerifiedBadgeLine from "~icons/ri/verified-badge-line";
|
2023-09-26 15:34:16 +00:00
|
|
|
|
2024-04-25 00:33:09 +00:00
|
|
|
withDefaults(defineProps<{ user?: DetailedUser }>(), {
|
|
|
|
user: undefined,
|
|
|
|
});
|
2023-09-26 15:34:16 +00:00
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<div class="border-t border-gray-100">
|
|
|
|
<VDescription>
|
|
|
|
<VDescriptionItem
|
|
|
|
:label="$t('core.user.detail.fields.display_name')"
|
|
|
|
:content="user?.user.spec.displayName"
|
|
|
|
class="!px-2"
|
|
|
|
/>
|
|
|
|
<VDescriptionItem
|
|
|
|
:label="$t('core.user.detail.fields.username')"
|
|
|
|
:content="user?.user.metadata.name"
|
|
|
|
class="!px-2"
|
|
|
|
/>
|
|
|
|
<VDescriptionItem
|
|
|
|
:label="$t('core.user.detail.fields.email')"
|
|
|
|
class="!px-2"
|
2024-04-26 04:36:59 +00:00
|
|
|
>
|
|
|
|
<div v-if="user?.user.spec.email" class="flex items-center space-x-2">
|
|
|
|
<span>
|
|
|
|
{{ user?.user.spec.email }}
|
|
|
|
</span>
|
|
|
|
<RiVerifiedBadgeLine
|
|
|
|
v-if="user?.user.spec.emailVerified"
|
|
|
|
v-tooltip="$t('core.user.detail.fields.email_verified.tooltip')"
|
|
|
|
class="text-xs text-blue-600"
|
|
|
|
/>
|
|
|
|
<IconInformation
|
|
|
|
v-else
|
|
|
|
v-tooltip="$t('core.user.detail.fields.email_not_verified.tooltip')"
|
|
|
|
class="text-xs text-red-500"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<span v-else>
|
|
|
|
{{ $t("core.common.text.none") }}
|
|
|
|
</span>
|
|
|
|
</VDescriptionItem>
|
2023-09-26 15:34:16 +00:00
|
|
|
<VDescriptionItem
|
|
|
|
:label="$t('core.user.detail.fields.roles')"
|
|
|
|
class="!px-2"
|
|
|
|
>
|
|
|
|
<VTag
|
|
|
|
v-for="(role, index) in user?.roles"
|
|
|
|
:key="index"
|
|
|
|
@click="
|
2023-11-16 07:51:19 +00:00
|
|
|
$router.push({
|
2023-09-26 15:34:16 +00:00
|
|
|
name: 'RoleDetail',
|
|
|
|
params: { name: role.metadata.name },
|
|
|
|
})
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<template #leftIcon>
|
|
|
|
<IconUserSettings />
|
|
|
|
</template>
|
|
|
|
{{
|
|
|
|
role.metadata.annotations?.[rbacAnnotations.DISPLAY_NAME] ||
|
|
|
|
role.metadata.name
|
|
|
|
}}
|
|
|
|
</VTag>
|
|
|
|
</VDescriptionItem>
|
|
|
|
<VDescriptionItem
|
|
|
|
:label="$t('core.user.detail.fields.bio')"
|
|
|
|
:content="user?.user.spec?.bio || $t('core.common.text.none')"
|
|
|
|
class="!px-2"
|
|
|
|
/>
|
|
|
|
<VDescriptionItem
|
|
|
|
:label="$t('core.user.detail.fields.creation_time')"
|
|
|
|
:content="formatDatetime(user?.user.metadata?.creationTimestamp)"
|
|
|
|
class="!px-2"
|
|
|
|
/>
|
|
|
|
</VDescription>
|
|
|
|
</div>
|
|
|
|
</template>
|