mirror of
https://github.com/halo-dev/halo.git
synced 2025-12-20 16:44:38 +08:00
#### What type of PR is this? /area ui /kind improvement /milestone 2.21.x #### What this PR does / why we need it: 1. Add ghost variant 2. Improve icon style 3. Refactoring css using scss functions #### Does this PR introduce a user-facing change? ```release-note None ```
48 lines
1.2 KiB
Vue
48 lines
1.2 KiB
Vue
<script setup lang="ts">
|
|
import { PluginStatusPhaseEnum, type Plugin } from "@halo-dev/api-client";
|
|
import { IconInformation, VButton } from "@halo-dev/components";
|
|
import { computed } from "vue";
|
|
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
plugin: Plugin;
|
|
}>(),
|
|
{}
|
|
);
|
|
|
|
const enabledJsModulesInfo =
|
|
(window["enabledPlugins"] as { name: string; version: string }[]) || [];
|
|
|
|
const currentJsModuleInfo = enabledJsModulesInfo.find((jsModuleInfo) => {
|
|
return jsModuleInfo.name === props.plugin.metadata.name;
|
|
});
|
|
|
|
const needsReloadWindow = computed(() => {
|
|
if (!currentJsModuleInfo) {
|
|
return false;
|
|
}
|
|
|
|
const { version } = props.plugin.spec;
|
|
const { phase } = props.plugin.status || {};
|
|
|
|
const isStarted = PluginStatusPhaseEnum.Started === phase;
|
|
|
|
return isStarted && version !== currentJsModuleInfo?.version;
|
|
});
|
|
|
|
function handleReloadWindow() {
|
|
window.location.reload();
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<VButton v-if="needsReloadWindow" size="xs" @click="handleReloadWindow">
|
|
<template #icon>
|
|
<IconInformation />
|
|
</template>
|
|
{{ $t("core.plugin.operations.reload_window.button") }}
|
|
</VButton>
|
|
</template>
|
|
|
|
<style lang="scss" scoped></style>
|