mirror of https://github.com/halo-dev/halo-admin
refactor: support configuring plugin when the plugin is stopped (#875)
#### What type of PR is this? /kind improvement #### What this PR does / why we need it: 1. 插件停止时支持配置插件设置项。 2. 修改插件异常信息的获取方式。 适配:https://github.com/halo-dev/halo/pull/3355 #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/3352 #### Special notes for your reviewer: 测试方式: 1. Halo 需要切换到 https://github.com/halo-dev/halo/pull/3355 分支。 2. Console 需要 `pnpm build:packages` 3. 根据 https://github.com/halo-dev/halo/pull/3355 中的描述进行测试。 #### Does this PR introduce a user-facing change? ```release-note None ```pull/888/head
parent
0eff78787e
commit
08c58ae179
|
@ -12,6 +12,10 @@
|
|||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
// May contain unused imports in some cases
|
||||
// @ts-ignore
|
||||
import { Condition } from './condition'
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
|
@ -26,28 +30,16 @@ export interface PluginStatus {
|
|||
phase?: PluginStatusPhaseEnum
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @type {Array<Condition>}
|
||||
* @memberof PluginStatus
|
||||
*/
|
||||
reason?: string
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PluginStatus
|
||||
*/
|
||||
message?: string
|
||||
conditions?: Array<Condition>
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PluginStatus
|
||||
*/
|
||||
lastStartTime?: string
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PluginStatus
|
||||
*/
|
||||
lastTransitionTime?: string
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
|
|
|
@ -66,6 +66,13 @@ const handleResetSettingConfig = async () => {
|
|||
},
|
||||
});
|
||||
};
|
||||
|
||||
const getFailedMessage = (plugin: Plugin) => {
|
||||
if (plugin.status?.conditions?.length) {
|
||||
const lastCondition = plugin.status.conditions[0];
|
||||
return [lastCondition.reason, lastCondition.message].join(":");
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<PluginUploadModal
|
||||
|
@ -105,7 +112,7 @@ const handleResetSettingConfig = async () => {
|
|||
<VEntityField v-if="plugin?.status?.phase === 'FAILED'">
|
||||
<template #description>
|
||||
<VStatusDot
|
||||
v-tooltip="`${plugin?.status?.reason}:${plugin?.status?.message}`"
|
||||
v-tooltip="getFailedMessage(plugin)"
|
||||
state="error"
|
||||
animate
|
||||
/>
|
||||
|
|
|
@ -70,7 +70,7 @@ const handleFetchPlugin = async () => {
|
|||
};
|
||||
|
||||
const handleFetchSettings = async () => {
|
||||
if (!plugin.value) return;
|
||||
if (!plugin.value || !plugin.value.spec.settingName) return;
|
||||
const { data } = await apiClient.plugin.fetchPluginSetting({
|
||||
name: plugin.value?.metadata.name,
|
||||
});
|
||||
|
@ -112,9 +112,7 @@ onMounted(async () => {
|
|||
return;
|
||||
}
|
||||
|
||||
if (isStarted.value) {
|
||||
await handleFetchSettings();
|
||||
}
|
||||
await handleFetchSettings();
|
||||
|
||||
tabs.value = cloneDeep(initialTabs);
|
||||
|
||||
|
|
Loading…
Reference in New Issue