Files
halo/ui/console-src/modules/system/plugins/components/PluginConditionsModal.vue
John Niang 5df51bb715 Refactor plugin reconciliation for dependency mechanism (#5900)
#### What type of PR is this?

/kind improvement
/area core
/area plugin

#### What this PR does / why we need it:

This PR wholly refactors plugin reconciliation to implement dependency mechanism.

Currently,
- If we disable plugin which has dependents, the plugin must wait for dependents to be disabled.
- If we enable plugin which has dependencies , the plugin must wait for dependencies to be enabled.
- If we upgrade plugin which has dependents, the plugin must request dependents to be unloaded. After the plugin is unloaded, the plugin must cancel unload request for dependents.

#### Which issue(s) this PR fixes:

Fixes #5872 

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

```release-note
优化被依赖的插件的升级,启用和禁用
```
2024-05-27 08:16:56 +00:00

94 lines
2.8 KiB
Vue

<script lang="ts" setup>
import { VButton, VModal } from "@halo-dev/components";
import type { Plugin } from "@halo-dev/api-client";
import { formatDatetime, relativeTimeTo } from "@/utils/date";
import { ref } from "vue";
withDefaults(defineProps<{ plugin: Plugin }>(), {});
const emit = defineEmits<{
(event: "close"): void;
}>();
const modal = ref();
</script>
<template>
<VModal
ref="modal"
:body-class="['!p-0']"
:title="$t('core.plugin.conditions_modal.title')"
:width="900"
layer-closable
@close="emit('close')"
>
<table class="min-w-full divide-y divide-gray-100">
<thead class="bg-gray-50">
<tr>
<th
class="px-4 py-3 text-left text-sm font-semibold text-gray-900 sm:w-96"
scope="col"
>
{{ $t("core.plugin.conditions_modal.fields.type") }}
</th>
<th
scope="col"
class="px-4 py-3 text-left text-sm font-semibold text-gray-900"
>
{{ $t("core.plugin.conditions_modal.fields.status") }}
</th>
<th
scope="col"
class="px-4 py-3 text-left text-sm font-semibold text-gray-900"
>
{{ $t("core.plugin.conditions_modal.fields.reason") }}
</th>
<th
scope="col"
class="px-4 py-3 text-left text-sm font-semibold text-gray-900"
>
{{ $t("core.plugin.conditions_modal.fields.message") }}
</th>
<th
scope="col"
class="px-4 py-3 text-left text-sm font-semibold text-gray-900"
>
{{ $t("core.plugin.conditions_modal.fields.last_transition_time") }}
</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100 bg-white">
<tr
v-for="(condition, index) in plugin?.status?.conditions"
:key="index"
>
<td class="whitespace-nowrap px-4 py-3 text-sm text-gray-900">
{{ condition.type }}
</td>
<td class="whitespace-nowrap px-4 py-3 text-sm text-gray-500">
{{ condition.status }}
</td>
<td class="whitespace-nowrap px-4 py-3 text-sm text-gray-500">
{{ condition.reason || "-" }}
</td>
<td class="whitespace-nowrap px-4 py-3 text-sm text-gray-500">
{{ condition.message || "-" }}
</td>
<td
v-tooltip="formatDatetime(condition.lastTransitionTime)"
class="whitespace-nowrap px-4 py-3 text-sm text-gray-500"
>
{{ relativeTimeTo(condition.lastTransitionTime) }}
</td>
</tr>
</tbody>
</table>
<template #footer>
<VButton @click="modal.close()">
{{ $t("core.common.buttons.close") }}
</VButton>
</template>
</VModal>
</template>