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; canUpdate: boolean;
path: string; path: string;
httpPort?: number; httpPort?: number;
httpsPort?: number;
favorite: boolean; favorite: boolean;
app: App; app: App;
webUI: string;
} }
export interface AppInstallDto { export interface AppInstallDto {

View file

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

View file

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