From e2c817f5ec2763b02a69a346de375912c5dc42ba Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Tue, 30 Apr 2024 11:57:33 +0800 Subject: [PATCH] fix: show plugin error message Signed-off-by: Ryan Wang --- .../plugins/components/PluginListItem.vue | 11 ++++------- .../system/plugins/composables/use-plugin.ts | 18 +++++++++--------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/ui/console-src/modules/system/plugins/components/PluginListItem.vue b/ui/console-src/modules/system/plugins/components/PluginListItem.vue index 3c84705a22..8353680a64 100644 --- a/ui/console-src/modules/system/plugins/components/PluginListItem.vue +++ b/ui/console-src/modules/system/plugins/components/PluginListItem.vue @@ -154,14 +154,11 @@ const { startFields, endFields } = useEntityFieldItemExtensionPoint( !enabled || (enabled && phase === PluginStatusPhaseEnum.Started); const getStatusDotState = () => { - if ( - enabled && - phase !== - (PluginStatusPhaseEnum.Started || PluginStatusPhaseEnum.Failed) - ) { - return "default"; + if (enabled && phase === PluginStatusPhaseEnum.Failed) { + return "error"; } - return "error"; + + return "default"; }; return [ diff --git a/ui/console-src/modules/system/plugins/composables/use-plugin.ts b/ui/console-src/modules/system/plugins/composables/use-plugin.ts index 6391f1b512..4915740a5e 100644 --- a/ui/console-src/modules/system/plugins/composables/use-plugin.ts +++ b/ui/console-src/modules/system/plugins/composables/use-plugin.ts @@ -33,16 +33,8 @@ export function usePluginLifeCycle( const { enabled } = plugin.value.spec || {}; const { phase } = plugin.value.status || {}; - // Starting up - if ( - enabled && - phase !== (PluginStatusPhaseEnum.Started || PluginStatusPhaseEnum.Failed) - ) { - return t("core.common.status.starting_up"); - } - // Starting failed - if (!isStarted.value) { + if (enabled && phase === PluginStatusPhaseEnum.Failed) { const lastCondition = plugin.value.status?.conditions?.[0]; return ( @@ -51,6 +43,14 @@ export function usePluginLifeCycle( .join(":") || "Unknown" ); } + + // Starting up + if ( + enabled && + phase !== (PluginStatusPhaseEnum.Started || PluginStatusPhaseEnum.Failed) + ) { + return t("core.common.status.starting_up"); + } }; const { isLoading: changingStatus, mutate: changeStatus } = useMutation({