mirror of https://github.com/halo-dev/halo-admin
fix: plugin failed to get settings when plugin is stopped (#750)
#### What type of PR is this? /kind bug /milestone 2.0.1 #### What this PR does / why we need it: 修复插件停止时,仍然获取设置选项导致提示失败的问题。 #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/2866 #### Special notes for your reviewer: 测试方式: 1. 安装一个插件,将其停止之后检查是否有获取 setting 的请求以及页面上是否有提示。 #### Does this PR introduce a user-facing change? ```release-note 修复在 Console 端停止插件时,仍然获取设置选项导致显示失败提示的问题。 ```pull/758/head
parent
5a8b046862
commit
581f7156f5
|
@ -25,6 +25,7 @@ import BasicLayout from "@/layouts/BasicLayout.vue";
|
||||||
import type { Ref } from "vue";
|
import type { Ref } from "vue";
|
||||||
import type { Plugin, SettingForm } from "@halo-dev/api-client";
|
import type { Plugin, SettingForm } from "@halo-dev/api-client";
|
||||||
import { usePermission } from "@/utils/permission";
|
import { usePermission } from "@/utils/permission";
|
||||||
|
import { usePluginLifeCycle } from "../composables/use-plugin";
|
||||||
|
|
||||||
const { currentUserHasPermission } = usePermission();
|
const { currentUserHasPermission } = usePermission();
|
||||||
|
|
||||||
|
@ -60,6 +61,8 @@ provide<Ref<string | undefined>>("activeTab", activeTab);
|
||||||
const settingName = computed(() => plugin.value?.spec.settingName);
|
const settingName = computed(() => plugin.value?.spec.settingName);
|
||||||
const configMapName = computed(() => plugin.value?.spec.configMapName);
|
const configMapName = computed(() => plugin.value?.spec.configMapName);
|
||||||
|
|
||||||
|
const { isStarted } = usePluginLifeCycle(plugin);
|
||||||
|
|
||||||
const { setting, handleFetchSettings } = useSettingForm(
|
const { setting, handleFetchSettings } = useSettingForm(
|
||||||
settingName,
|
settingName,
|
||||||
configMapName
|
configMapName
|
||||||
|
@ -112,7 +115,9 @@ onMounted(async () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await handleFetchSettings();
|
if (isStarted.value) {
|
||||||
|
await handleFetchSettings();
|
||||||
|
}
|
||||||
|
|
||||||
tabs.value = cloneDeep(initialTabs);
|
tabs.value = cloneDeep(initialTabs);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue