From 54ca1889efd55dea89df095333f33568a3417885 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Thu, 30 Mar 2023 23:26:14 +0800 Subject: [PATCH] perf: improve the conditions for fetching role templates on the plugin details page (#3626) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind improvement /area console /milestone 2.4.x #### What this PR does / why we need it: 优化插件详情页面获取角色模板的条件,不查询 label 中带了 `halo.run/hidden` 的角色模板。 #### Special notes for your reviewer: #### Does this PR introduce a user-facing change? ```release-note 优化 Console 端在插件详情页面上获取角色模板的条件 ``` --- console/src/modules/system/plugins/PluginDetail.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/console/src/modules/system/plugins/PluginDetail.vue b/console/src/modules/system/plugins/PluginDetail.vue index 76b06f0e0..376b59f7b 100644 --- a/console/src/modules/system/plugins/PluginDetail.vue +++ b/console/src/modules/system/plugins/PluginDetail.vue @@ -4,7 +4,7 @@ import type { Ref } from "vue"; import { computed, inject } from "vue"; import { apiClient } from "@/utils/api-client"; import type { Plugin, Role } from "@halo-dev/api-client"; -import { pluginLabels } from "@/constants/labels"; +import { pluginLabels, roleLabels } from "@/constants/labels"; import { rbacAnnotations } from "@/constants/annotations"; import { usePluginLifeCycle } from "./composables/use-plugin"; import { formatDatetime } from "@/utils/date"; @@ -24,7 +24,11 @@ const { data: pluginRoleTemplates } = useQuery({ const { data } = await apiClient.extension.role.listv1alpha1Role({ page: 0, size: 0, - labelSelector: [`${pluginLabels.NAME}=${plugin?.value?.metadata.name}`], + labelSelector: [ + `${pluginLabels.NAME}=${plugin?.value?.metadata.name}`, + `${roleLabels.TEMPLATE}=true`, + "!halo.run/hidden", + ], }); return data.items;