Merge branch 'next' of github.com:halo-dev/halo-admin into next

pull/599/head
Ryan Wang 2022-08-12 16:16:58 +08:00
commit 1457dd8b9c
4 changed files with 54 additions and 10 deletions

View File

@ -34,7 +34,7 @@
"@formkit/vue": "1.0.0-beta.10",
"@halo-dev/admin-api": "^1.1.0",
"@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/richtext-editor": "0.0.0-alpha.1",
"@vueuse/components": "^8.9.4",

View File

@ -36,7 +36,7 @@
"homepage": "https://github.com/halo-dev/halo-admin/tree/next/shared/components#readme",
"license": "MIT",
"dependencies": {
"@halo-dev/api-client": "^0.0.9",
"@halo-dev/api-client": "^0.0.11",
"@halo-dev/components": "workspace:*",
"axios": "^0.27.2"
},

View File

@ -14,7 +14,7 @@ importers:
'@formkit/vue': 1.0.0-beta.10
'@halo-dev/admin-api': ^1.1.0
'@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/richtext-editor': 0.0.0-alpha.1
'@rushstack/eslint-patch': ^1.1.4
@ -85,7 +85,7 @@ importers:
'@formkit/vue': 1.0.0-beta.10_wwmyxdjqen5bmh3tr2meig5lki
'@halo-dev/admin-api': 1.1.0
'@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/richtext-editor': 0.0.0-alpha.1_vue@3.2.37
'@vueuse/components': 8.9.4_vue@3.2.37
@ -176,12 +176,12 @@ importers:
packages/shared:
specifiers:
'@halo-dev/api-client': ^0.0.9
'@halo-dev/api-client': ^0.0.11
'@halo-dev/components': workspace:*
axios: ^0.27.2
vite-plugin-dts: ^1.4.1
dependencies:
'@halo-dev/api-client': 0.0.9
'@halo-dev/api-client': 0.0.11
'@halo-dev/components': link:../components
axios: 0.27.2
devDependencies:
@ -2126,8 +2126,8 @@ packages:
- debug
dev: false
/@halo-dev/api-client/0.0.9:
resolution: {integrity: sha512-GhDbgIASrvUwVE1/jadowPWZnQMASaOIF9mS7FKcC3/UjHZGBmxx03ECVLc7PH1hnHqsNTCbiLUDZtig6ZDuUw==}
/@halo-dev/api-client/0.0.11:
resolution: {integrity: sha512-67e7lrWPoHVKF4XItT6OWr7rX96CR9s/3SOVXYD3xCyAMIgLyFULfKVI7JGxisFMKvadTx7rm5RK4zzZ/CbXIw==}
dev: false
/@halo-dev/logger/1.1.0:

View File

@ -1,7 +1,8 @@
<script lang="ts" setup>
import {
IconArrowRight,
IconGitHub,
IconMore,
useDialog,
VButton,
VModal,
VSpace,
@ -33,6 +34,8 @@ const emit = defineEmits(["update:visible", "close", "update:selectedTheme"]);
const themes = ref<Theme[]>([]);
const themeInstall = ref(false);
const dialog = useDialog();
const handleFetchThemes = async () => {
try {
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) => {
emit("update:visible", visible);
if (!visible) {
@ -131,7 +152,30 @@ defineExpose({
</a>
</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>
</VSpace>
</div>