From 0756d7210625af5a43c6ea7ed290b27e81c7e9dd Mon Sep 17 00:00:00 2001 From: Halo Dev Bot <87291978+halo-dev-bot@users.noreply.github.com> Date: Wed, 7 Dec 2022 14:20:54 +0800 Subject: [PATCH] [release-2.0] fix: plugin failed to get settings when plugin is stopped (#755) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is an automated cherry-pick of #750 /assign ruibaby ```release-note 修复在 Console 端停止插件时,仍然获取设置选项导致显示失败提示的问题。 ``` --- src/modules/system/plugins/layouts/PluginLayout.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/system/plugins/layouts/PluginLayout.vue b/src/modules/system/plugins/layouts/PluginLayout.vue index 94d77433..85975510 100644 --- a/src/modules/system/plugins/layouts/PluginLayout.vue +++ b/src/modules/system/plugins/layouts/PluginLayout.vue @@ -25,6 +25,7 @@ import BasicLayout from "@/layouts/BasicLayout.vue"; import type { Ref } from "vue"; import type { Plugin, SettingForm } from "@halo-dev/api-client"; import { usePermission } from "@/utils/permission"; +import { usePluginLifeCycle } from "../composables/use-plugin"; const { currentUserHasPermission } = usePermission(); @@ -60,6 +61,8 @@ provide>("activeTab", activeTab); const settingName = computed(() => plugin.value?.spec.settingName); const configMapName = computed(() => plugin.value?.spec.configMapName); +const { isStarted } = usePluginLifeCycle(plugin); + const { setting, handleFetchSettings } = useSettingForm( settingName, configMapName @@ -112,7 +115,9 @@ onMounted(async () => { return; } - await handleFetchSettings(); + if (isStarted.value) { + await handleFetchSettings(); + } tabs.value = cloneDeep(initialTabs);