perf: optimize the display of numbers

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/628/head
Ryan Wang 2022-09-29 11:10:31 +08:00
parent 24794df827
commit 1048e6fca6
14 changed files with 84 additions and 43 deletions

View File

@ -655,11 +655,19 @@ onMounted(() => {
/> />
</template> </template>
</VEntityField> </VEntityField>
<VEntityField <VEntityField>
:description=" <template #description>
formatDatetime(attachment.metadata.creationTimestamp) <span
" class="truncate text-xs tabular-nums text-gray-500"
/> >
{{
formatDatetime(
attachment.metadata.creationTimestamp
)
}}
</span>
</template>
</VEntityField>
</template> </template>
<template #dropdownItems> <template #dropdownItems>
<VButton <VButton

View File

@ -189,7 +189,7 @@ watch(
<div <div
class="inline-flex flex-col items-end gap-4 sm:flex-row sm:items-center sm:gap-6" class="inline-flex flex-col items-end gap-4 sm:flex-row sm:items-center sm:gap-6"
> >
<time class="text-sm text-gray-500"> <time class="text-sm tabular-nums text-gray-500">
{{ formatDatetime(policy.metadata.creationTimestamp) }} {{ formatDatetime(policy.metadata.creationTimestamp) }}
</time> </time>
<span class="cursor-pointer"> <span class="cursor-pointer">

View File

@ -328,11 +328,12 @@ const subjectRefResult = computed(() => {
<VStatusDot v-tooltip="``" state="warning" animate /> <VStatusDot v-tooltip="``" state="warning" animate />
</template> </template>
</VEntityField> </VEntityField>
<VEntityField <VEntityField>
:description=" <template #description>
formatDatetime(comment?.comment?.metadata.creationTimestamp) <span class="truncate text-xs tabular-nums text-gray-500">
" {{ formatDatetime(comment?.comment?.metadata.creationTimestamp) }}
> </span>
</template>
</VEntityField> </VEntityField>
</template> </template>
<template #dropdownItems> <template #dropdownItems>

View File

@ -161,9 +161,12 @@ const isHoveredReply = computed(() => {
<VStatusDot v-tooltip="``" state="warning" animate /> <VStatusDot v-tooltip="``" state="warning" animate />
</template> </template>
</VEntityField> </VEntityField>
<VEntityField <VEntityField>
:description="formatDatetime(reply?.reply.metadata.creationTimestamp)" <template #description>
> <span class="truncate text-xs tabular-nums text-gray-500">
{{ formatDatetime(reply?.reply?.metadata.creationTimestamp) }}
</span>
</template>
</VEntityField> </VEntityField>
</template> </template>
<template #dropdownItems> <template #dropdownItems>

View File

@ -600,11 +600,15 @@ function handleSortItemChange(sortItem?: SortItem) {
/> />
</template> </template>
</VEntityField> </VEntityField>
<VEntityField <VEntityField>
:description=" <template #description>
<span class="truncate text-xs tabular-nums text-gray-500">
{{
formatDatetime(singlePage.page.metadata.creationTimestamp) formatDatetime(singlePage.page.metadata.creationTimestamp)
" }}
/> </span>
</template>
</VEntityField>
</template> </template>
<template #dropdownItems> <template #dropdownItems>
<VButton <VButton

View File

@ -892,11 +892,13 @@ function handleContributorChange(user?: User) {
<VStatusDot v-tooltip="``" state="warning" animate /> <VStatusDot v-tooltip="``" state="warning" animate />
</template> </template>
</VEntityField> </VEntityField>
<VEntityField <VEntityField>
:description=" <template #description>
formatDatetime(post.post.metadata.creationTimestamp) <span class="truncate text-xs tabular-nums text-gray-500">
" {{ formatDatetime(post.post.metadata.creationTimestamp) }}
/> </span>
</template>
</VEntityField>
</template> </template>
<template #dropdownItems> <template #dropdownItems>
<VButton <VButton

View File

@ -78,9 +78,13 @@ function onDelete(category: CategoryTree) {
<VEntityField <VEntityField
:description="`${category.status?.postCount || 0} 篇文章`" :description="`${category.status?.postCount || 0} 篇文章`"
/> />
<VEntityField <VEntityField>
:description="formatDatetime(category.metadata.creationTimestamp)" <template #description>
/> <span class="truncate text-xs tabular-nums text-gray-500">
{{ formatDatetime(category.metadata.creationTimestamp) }}
</span>
</template>
</VEntityField>
</template> </template>
<template #dropdownItems> <template #dropdownItems>
<VButton <VButton

View File

@ -194,9 +194,13 @@ onMounted(async () => {
<VEntityField <VEntityField
:description="`${tag.status?.postCount || 0} 篇文章`" :description="`${tag.status?.postCount || 0} 篇文章`"
/> />
<VEntityField <VEntityField>
:description="formatDatetime(tag.metadata.creationTimestamp)" <template #description>
/> <span class="truncate text-xs tabular-nums text-gray-500">
{{ formatDatetime(tag.metadata.creationTimestamp) }}
</span>
</template>
</VEntityField>
</template> </template>
<template #dropdownItems> <template #dropdownItems>
<VButton <VButton

View File

@ -50,7 +50,7 @@ onMounted(handleFetchPosts);
</div> </div>
<div> <div>
<time class="text-sm text-gray-500"> <time class="text-sm tabular-nums text-gray-500">
{{ formatDatetime(post.post.spec.publishTime) }} {{ formatDatetime(post.post.spec.publishTime) }}
</time> </time>
</div> </div>

View File

@ -213,7 +213,9 @@ watchEffect(() => {
class="bg-white px-4 py-5 hover:bg-gray-50 sm:grid sm:grid-cols-6 sm:gap-4 sm:px-6" class="bg-white px-4 py-5 hover:bg-gray-50 sm:grid sm:grid-cols-6 sm:gap-4 sm:px-6"
> >
<dt class="text-sm font-medium text-gray-900">最近一次启动</dt> <dt class="text-sm font-medium text-gray-900">最近一次启动</dt>
<dd class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0"> <dd
class="mt-1 text-sm tabular-nums text-gray-900 sm:col-span-2 sm:mt-0"
>
{{ formatDatetime(plugin?.status?.lastStartTime) }} {{ formatDatetime(plugin?.status?.lastStartTime) }}
</dd> </dd>
</div> </div>

View File

@ -79,10 +79,13 @@ const { isStarted, changeStatus, uninstall } = usePluginLifeCycle(plugin);
</template> </template>
</VEntityField> </VEntityField>
<VEntityField :description="plugin?.spec.version" /> <VEntityField :description="plugin?.spec.version" />
<VEntityField <VEntityField v-if="plugin?.metadata.creationTimestamp">
v-if="plugin?.metadata.creationTimestamp" <template #description>
:description="formatDatetime(plugin?.metadata.creationTimestamp)" <span class="truncate text-xs tabular-nums text-gray-500">
/> {{ formatDatetime(plugin?.metadata.creationTimestamp) }}
</span>
</template>
</VEntityField>
<VEntityField> <VEntityField>
<template #description> <template #description>
<div <div

View File

@ -264,9 +264,13 @@ const handleDelete = async (role: Role) => {
<VTag> 系统保留</VTag> <VTag> 系统保留</VTag>
</template> </template>
</VEntityField> </VEntityField>
<VEntityField <VEntityField>
:description="formatDatetime(role.metadata.creationTimestamp)" <template #description>
/> <span class="truncate text-xs tabular-nums text-gray-500">
{{ formatDatetime(role.metadata.creationTimestamp) }}
</span>
</template>
</VEntityField>
</template> </template>
<template #dropdownItems> <template #dropdownItems>
<VButton <VButton

View File

@ -73,7 +73,9 @@ const router = useRouter();
class="bg-white py-5 px-2 hover:bg-gray-50 sm:grid sm:grid-cols-6 sm:gap-4" class="bg-white py-5 px-2 hover:bg-gray-50 sm:grid sm:grid-cols-6 sm:gap-4"
> >
<dt class="text-sm font-medium text-gray-900">注册时间</dt> <dt class="text-sm font-medium text-gray-900">注册时间</dt>
<dd class="mt-1 text-sm text-gray-900 sm:col-span-3 sm:mt-0"> <dd
class="mt-1 text-sm tabular-nums text-gray-900 sm:col-span-3 sm:mt-0"
>
{{ formatDatetime(user?.metadata?.creationTimestamp) }} {{ formatDatetime(user?.metadata?.creationTimestamp) }}
</dd> </dd>
</div> </div>

View File

@ -430,9 +430,13 @@ onMounted(() => {
<VStatusDot v-tooltip="``" state="warning" animate /> <VStatusDot v-tooltip="``" state="warning" animate />
</template> </template>
</VEntityField> </VEntityField>
<VEntityField <VEntityField>
:description="formatDatetime(user.metadata.creationTimestamp)" <template #description>
/> <span class="truncate text-xs tabular-nums text-gray-500">
{{ formatDatetime(user.metadata.creationTimestamp) }}
</span>
</template>
</VEntityField>
</template> </template>
<template #dropdownItems> <template #dropdownItems>
<VButton <VButton