fix: fix issue with can not delete web ui (#8878)

This commit is contained in:
CityFun 2025-05-30 11:36:03 +08:00 committed by GitHub
parent 8c8a4d2881
commit 36b81f6dba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 38 additions and 7 deletions

View file

@ -143,8 +143,10 @@ export namespace App {
canUpdate: boolean;
path: string;
httpPort?: number;
httpsPort?: number;
favorite: boolean;
app: App;
webUI: string;
}
export interface AppInstallDto {

View file

@ -242,7 +242,7 @@ const get = async () => {
if (res.data.webUI != '') {
const httpConfig = splitHttp(res.data.webUI);
webUI.domain = httpConfig.url;
webUI.protocol = httpConfig.proto;
webUI.protocol = httpConfig.proto + '://';
}
appType.value = res.data.type;
} catch (error) {
@ -289,14 +289,15 @@ const submit = async (formEl: FormInstance) => {
};
const updateAppConfig = async () => {
if (!webUI.domain || webUI.domain === '') {
return;
}
try {
await updateInstallConfig({
let req = {
installID: Number(paramData.value.id),
webUI: webUI.protocol + webUI.domain,
});
};
if (!webUI.domain || webUI.domain === '') {
req.webUI = '';
}
await updateInstallConfig(req);
MsgSuccess(i18n.global.t('commons.msg.updateSuccess'));
handleClose();
} catch (error) {}

View file

@ -249,7 +249,12 @@
:width="400"
>
<template #reference>
<el-button plain icon="Promotion" size="small">
<el-button
plain
icon="Promotion"
size="small"
@click="openLink(defaultLink, installed)"
>
{{ $t('app.toLink') }}
</el-button>
</template>
@ -277,6 +282,8 @@
}}
</el-button>
</td>
</tr>
<tr v-if="defaultLink != ''">
<td v-if="installed.httpsPort > 0">
<el-button
type="primary"
@ -700,6 +707,27 @@ const getConfig = async () => {
} catch (error) {}
};
const openLink = (defaultLink: string, installed: App.AppInstalled) => {
if (defaultLink != '' && installed.webUI != '') {
return;
}
if (defaultLink == '' && installed.webUI == '') {
return;
}
if (installed.webUI != '') {
toLink(installed.webUI);
return;
}
if (installed.httpsPort > 0) {
toLink('https://' + defaultLink + ':' + installed.httpsPort);
return;
}
if (installed.httpPort > 0) {
toLink('http://' + defaultLink + ':' + installed.httpPort);
return;
}
};
onMounted(() => {
getConfig();
const path = router.currentRoute.value.path;