feat: refine fields in plugin detail page (#5724)

#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.15.x

#### What this PR does / why we need it:

优化插件详情页面的字段显示,适配 https://github.com/halo-dev/halo/pull/4061

1. 显示 metadata.name。
2. 显示源码仓库地址(spec.repo)。
3. 显示网站地址(spec.homepage)。

<img width="663" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/a1b2a561-4351-4c18-b959-6b398532a9af">

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/5721

#### Does this PR introduce a user-facing change?

```release-note
优化插件详情页面的字段显示
```
pull/5755/head
Ryan Wang 2024-04-19 10:40:08 +08:00 committed by GitHub
parent 1ed54a1c20
commit 571df5f865
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 51 additions and 14 deletions

View File

@ -95,14 +95,24 @@ const pluginRoleTemplateGroups = computed<RoleTemplateGroup[]>(() => {
</div> </div>
<div class="border-t border-gray-200"> <div class="border-t border-gray-200">
<VDescription> <VDescription>
<VDescriptionItem <VDescriptionItem label="ID" :content="plugin?.metadata.name" />
:label="$t('core.plugin.detail.fields.display_name')"
:content="plugin?.spec.displayName"
/>
<VDescriptionItem <VDescriptionItem
:label="$t('core.plugin.detail.fields.description')" :label="$t('core.plugin.detail.fields.description')"
:content="plugin?.spec.description" :content="plugin?.spec.description || $t('core.common.text.none')"
/> />
<VDescriptionItem :label="$t('core.plugin.detail.fields.author')">
<a
v-if="plugin?.spec.author"
:href="plugin?.spec.author.website"
class="hover:text-gray-600"
target="_blank"
>
{{ plugin?.spec.author.name }}
</a>
<span v-else>
{{ $t("core.common.text.none") }}
</span>
</VDescriptionItem>
<VDescriptionItem <VDescriptionItem
:label="$t('core.plugin.detail.fields.version')" :label="$t('core.plugin.detail.fields.version')"
:content="plugin?.spec.version" :content="plugin?.spec.version"
@ -111,13 +121,27 @@ const pluginRoleTemplateGroups = computed<RoleTemplateGroup[]>(() => {
:label="$t('core.plugin.detail.fields.requires')" :label="$t('core.plugin.detail.fields.requires')"
:content="plugin?.spec.requires" :content="plugin?.spec.requires"
/> />
<VDescriptionItem :label="$t('core.plugin.detail.fields.author')"> <VDescriptionItem :label="$t('core.plugin.detail.fields.homepage')">
<a <a
v-if="plugin?.spec.author" v-if="plugin?.spec.homepage"
:href="plugin?.spec.author.website" :href="plugin?.spec.homepage"
class="hover:text-gray-600"
target="_blank" target="_blank"
> >
{{ plugin?.spec.author.name }} {{ plugin?.spec.homepage }}
</a>
<span v-else>
{{ $t("core.common.text.none") }}
</span>
</VDescriptionItem>
<VDescriptionItem :label="$t('core.plugin.detail.fields.repo')">
<a
v-if="plugin?.spec.repo"
:href="plugin.spec.repo"
class="hover:text-gray-600"
target="_blank"
>
{{ plugin.spec.repo }}
</a> </a>
<span v-else> <span v-else>
{{ $t("core.common.text.none") }} {{ $t("core.common.text.none") }}
@ -138,6 +162,9 @@ const pluginRoleTemplateGroups = computed<RoleTemplateGroup[]>(() => {
</span> </span>
</li> </li>
</ul> </ul>
<span v-else>
{{ $t("core.common.text.none") }}
</span>
</VDescriptionItem> </VDescriptionItem>
<VDescriptionItem <VDescriptionItem
:label="$t('core.plugin.detail.fields.role_templates')" :label="$t('core.plugin.detail.fields.role_templates')"
@ -201,6 +228,10 @@ const pluginRoleTemplateGroups = computed<RoleTemplateGroup[]>(() => {
:label="$t('core.plugin.detail.fields.last_starttime')" :label="$t('core.plugin.detail.fields.last_starttime')"
:content="formatDatetime(plugin?.status?.lastStartTime)" :content="formatDatetime(plugin?.status?.lastStartTime)"
/> />
<VDescriptionItem
:label="$t('core.plugin.detail.fields.load_location')"
:content="plugin?.status?.loadLocation"
></VDescriptionItem>
</VDescription> </VDescription>
</div> </div>
</div> </div>

View File

@ -862,7 +862,6 @@ core:
header: header:
title: Plugin information title: Plugin information
fields: fields:
display_name: Display Name
description: Description description: Description
version: Version version: Version
requires: Requires requires: Requires
@ -870,6 +869,9 @@ core:
license: License license: License
role_templates: Role Templates role_templates: Role Templates
last_starttime: Last Start Time last_starttime: Last Start Time
homepage: Homepage
repo: Source Repository
load_location: Storage Location
loader: loader:
toast: toast:
entry_load_failed: Failed to load plugins entry file entry_load_failed: Failed to load plugins entry file

View File

@ -820,14 +820,16 @@ core:
header: header:
title: 插件信息 title: 插件信息
fields: fields:
display_name: 名称
description: 描述 description: 描述
version: 版本 version: 版本
requires: Halo 版本要求 requires: Halo 版本要求
author: 提供方 author: 作者
license: 协议 license: 协议
role_templates: 权限模板 role_templates: 权限模板
last_starttime: 最近一次启动 last_starttime: 最近一次启动
homepage: 网站
repo: 源码仓库
load_location: 存储位置
loader: loader:
toast: toast:
entry_load_failed: 加载插件入口文件失败 entry_load_failed: 加载插件入口文件失败

View File

@ -808,14 +808,16 @@ core:
header: header:
title: 插件信息 title: 插件信息
fields: fields:
display_name: 名稱
description: 描述 description: 描述
version: 版本 version: 版本
requires: Halo 版本要求 requires: Halo 版本要求
author: 提供方 author: 作者
license: 協議 license: 協議
role_templates: 權限模板 role_templates: 權限模板
last_starttime: 最近一次啟動 last_starttime: 最近一次啟動
homepage: 網站
repo: 源碼倉庫
load_location: 存儲位置
loader: loader:
toast: toast:
entry_load_failed: 讀取插件入口文件失敗 entry_load_failed: 讀取插件入口文件失敗