Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

refactor: support configuring plugin when the plugin is stopped #875

Merged
merged 1 commit into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions packages/api-client/src/models/plugin-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
* Do not edit the class manually.
*/

// May contain unused imports in some cases
// @ts-ignore
import { Condition } from './condition'

/**
*
* @export
Expand All @@ -26,28 +30,16 @@ export interface PluginStatus {
phase?: PluginStatusPhaseEnum
/**
*
* @type {string}
* @memberof PluginStatus
*/
reason?: string
/**
*
* @type {string}
* @type {Array<Condition>}
* @memberof PluginStatus
*/
message?: string
conditions?: Array<Condition>
/**
*
* @type {string}
* @memberof PluginStatus
*/
lastStartTime?: string
/**
*
* @type {string}
* @memberof PluginStatus
*/
lastTransitionTime?: string
/**
*
* @type {string}
Expand Down
9 changes: 8 additions & 1 deletion src/modules/system/plugins/components/PluginListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
/>
Expand Down
6 changes: 2 additions & 4 deletions src/modules/system/plugins/layouts/PluginLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down Expand Up @@ -112,9 +112,7 @@ onMounted(async () => {
return;
}

if (isStarted.value) {
await handleFetchSettings();
}
await handleFetchSettings();

tabs.value = cloneDeep(initialTabs);

Expand Down