mirror of https://github.com/halo-dev/halo
feat: add theme uninstall support (halo-dev/console#596)
Signed-off-by: Ryan Wang <i@ryanc.cc>pull/3445/head
parent
524639b260
commit
c456dda92f
|
@ -34,7 +34,7 @@
|
||||||
"@formkit/vue": "1.0.0-beta.10",
|
"@formkit/vue": "1.0.0-beta.10",
|
||||||
"@halo-dev/admin-api": "^1.1.0",
|
"@halo-dev/admin-api": "^1.1.0",
|
||||||
"@halo-dev/admin-shared": "workspace:*",
|
"@halo-dev/admin-shared": "workspace:*",
|
||||||
"@halo-dev/api-client": "^0.0.9",
|
"@halo-dev/api-client": "^0.0.11",
|
||||||
"@halo-dev/components": "workspace:*",
|
"@halo-dev/components": "workspace:*",
|
||||||
"@halo-dev/richtext-editor": "0.0.0-alpha.1",
|
"@halo-dev/richtext-editor": "0.0.0-alpha.1",
|
||||||
"@vueuse/components": "^8.9.4",
|
"@vueuse/components": "^8.9.4",
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
"homepage": "https://github.com/halo-dev/halo-admin/tree/next/shared/components#readme",
|
"homepage": "https://github.com/halo-dev/halo-admin/tree/next/shared/components#readme",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@halo-dev/api-client": "^0.0.9",
|
"@halo-dev/api-client": "^0.0.11",
|
||||||
"@halo-dev/components": "workspace:*",
|
"@halo-dev/components": "workspace:*",
|
||||||
"axios": "^0.27.2"
|
"axios": "^0.27.2"
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,7 +14,7 @@ importers:
|
||||||
'@formkit/vue': 1.0.0-beta.10
|
'@formkit/vue': 1.0.0-beta.10
|
||||||
'@halo-dev/admin-api': ^1.1.0
|
'@halo-dev/admin-api': ^1.1.0
|
||||||
'@halo-dev/admin-shared': workspace:*
|
'@halo-dev/admin-shared': workspace:*
|
||||||
'@halo-dev/api-client': ^0.0.9
|
'@halo-dev/api-client': ^0.0.11
|
||||||
'@halo-dev/components': workspace:*
|
'@halo-dev/components': workspace:*
|
||||||
'@halo-dev/richtext-editor': 0.0.0-alpha.1
|
'@halo-dev/richtext-editor': 0.0.0-alpha.1
|
||||||
'@rushstack/eslint-patch': ^1.1.4
|
'@rushstack/eslint-patch': ^1.1.4
|
||||||
|
@ -85,7 +85,7 @@ importers:
|
||||||
'@formkit/vue': 1.0.0-beta.10_wwmyxdjqen5bmh3tr2meig5lki
|
'@formkit/vue': 1.0.0-beta.10_wwmyxdjqen5bmh3tr2meig5lki
|
||||||
'@halo-dev/admin-api': 1.1.0
|
'@halo-dev/admin-api': 1.1.0
|
||||||
'@halo-dev/admin-shared': link:packages/shared
|
'@halo-dev/admin-shared': link:packages/shared
|
||||||
'@halo-dev/api-client': 0.0.9
|
'@halo-dev/api-client': 0.0.11
|
||||||
'@halo-dev/components': link:packages/components
|
'@halo-dev/components': link:packages/components
|
||||||
'@halo-dev/richtext-editor': 0.0.0-alpha.1_vue@3.2.37
|
'@halo-dev/richtext-editor': 0.0.0-alpha.1_vue@3.2.37
|
||||||
'@vueuse/components': 8.9.4_vue@3.2.37
|
'@vueuse/components': 8.9.4_vue@3.2.37
|
||||||
|
@ -176,12 +176,12 @@ importers:
|
||||||
|
|
||||||
packages/shared:
|
packages/shared:
|
||||||
specifiers:
|
specifiers:
|
||||||
'@halo-dev/api-client': ^0.0.9
|
'@halo-dev/api-client': ^0.0.11
|
||||||
'@halo-dev/components': workspace:*
|
'@halo-dev/components': workspace:*
|
||||||
axios: ^0.27.2
|
axios: ^0.27.2
|
||||||
vite-plugin-dts: ^1.4.1
|
vite-plugin-dts: ^1.4.1
|
||||||
dependencies:
|
dependencies:
|
||||||
'@halo-dev/api-client': 0.0.9
|
'@halo-dev/api-client': 0.0.11
|
||||||
'@halo-dev/components': link:../components
|
'@halo-dev/components': link:../components
|
||||||
axios: 0.27.2
|
axios: 0.27.2
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
@ -2126,8 +2126,8 @@ packages:
|
||||||
- debug
|
- debug
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@halo-dev/api-client/0.0.9:
|
/@halo-dev/api-client/0.0.11:
|
||||||
resolution: {integrity: sha512-GhDbgIASrvUwVE1/jadowPWZnQMASaOIF9mS7FKcC3/UjHZGBmxx03ECVLc7PH1hnHqsNTCbiLUDZtig6ZDuUw==}
|
resolution: {integrity: sha512-67e7lrWPoHVKF4XItT6OWr7rX96CR9s/3SOVXYD3xCyAMIgLyFULfKVI7JGxisFMKvadTx7rm5RK4zzZ/CbXIw==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@halo-dev/logger/1.1.0:
|
/@halo-dev/logger/1.1.0:
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {
|
import {
|
||||||
IconArrowRight,
|
|
||||||
IconGitHub,
|
IconGitHub,
|
||||||
|
IconMore,
|
||||||
|
useDialog,
|
||||||
VButton,
|
VButton,
|
||||||
VModal,
|
VModal,
|
||||||
VSpace,
|
VSpace,
|
||||||
|
@ -33,6 +34,8 @@ const emit = defineEmits(["update:visible", "close", "update:selectedTheme"]);
|
||||||
const themes = ref<Theme[]>([]);
|
const themes = ref<Theme[]>([]);
|
||||||
const themeInstall = ref(false);
|
const themeInstall = ref(false);
|
||||||
|
|
||||||
|
const dialog = useDialog();
|
||||||
|
|
||||||
const handleFetchThemes = async () => {
|
const handleFetchThemes = async () => {
|
||||||
try {
|
try {
|
||||||
const { data } =
|
const { data } =
|
||||||
|
@ -43,6 +46,24 @@ const handleFetchThemes = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleUninstall = async (theme: Theme) => {
|
||||||
|
dialog.warning({
|
||||||
|
title: "是否确定删除该主题?",
|
||||||
|
description: "删除后将无法恢复。",
|
||||||
|
onConfirm: async () => {
|
||||||
|
try {
|
||||||
|
await apiClient.extension.theme.deletethemeHaloRunV1alpha1Theme(
|
||||||
|
theme.metadata.name
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Failed to uninstall theme", e);
|
||||||
|
} finally {
|
||||||
|
await handleFetchThemes();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const handleVisibleChange = (visible: boolean) => {
|
const handleVisibleChange = (visible: boolean) => {
|
||||||
emit("update:visible", visible);
|
emit("update:visible", visible);
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
|
@ -131,7 +152,30 @@ defineExpose({
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<IconArrowRight class="text-gray-900" />
|
<FloatingDropdown>
|
||||||
|
<IconMore
|
||||||
|
class="rounded text-gray-900 hover:bg-gray-200 hover:text-gray-600"
|
||||||
|
@click.stop
|
||||||
|
/>
|
||||||
|
<template #popper>
|
||||||
|
<div class="w-48 p-2">
|
||||||
|
<VSpace class="w-full" direction="column">
|
||||||
|
<VButton
|
||||||
|
v-close-popper
|
||||||
|
:disabled="
|
||||||
|
theme.metadata.name ===
|
||||||
|
activatedTheme?.metadata?.name
|
||||||
|
"
|
||||||
|
block
|
||||||
|
type="danger"
|
||||||
|
@click="handleUninstall(theme)"
|
||||||
|
>
|
||||||
|
卸载
|
||||||
|
</VButton>
|
||||||
|
</VSpace>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</FloatingDropdown>
|
||||||
</div>
|
</div>
|
||||||
</VSpace>
|
</VSpace>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue