1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 14:08:06 +08:00

feat: 已安装应用增加 https 端口跳转 (#1870)

This commit is contained in:
zhengkunwang 2023-08-08 14:12:11 +08:00 committed by GitHub
parent 1931e8800a
commit e0f15ca783
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 6 deletions

View File

@ -33,6 +33,7 @@ const dialogVisiable = ref();
interface DialogProps {
port: any;
protocol: string;
}
const acceptParams = async (params: DialogProps): Promise<void> => {
@ -40,16 +41,17 @@ const acceptParams = async (params: DialogProps): Promise<void> => {
MsgError(i18n.global.t('setting.errPort'));
return;
}
let protocol = params.protocol === 'https' ? 'https' : 'http';
const res = await getSettingInfo();
if (!res.data.systemIP) {
dialogVisiable.value = true;
return;
}
if (!checkIp(res.data.systemIP) || !checkDomain(res.data.systemIP)) {
window.open(`http://${res.data.systemIP}:${params.port}`, '_blank');
window.open(`${protocol}://${res.data.systemIP}:${params.port}`, '_blank');
return;
}
window.open(`http://[${res.data.systemIP}]:${params.port}`, '_blank');
window.open(`${protocol}://[${res.data.systemIP}]:${params.port}`, '_blank');
};
const goRouter = async (path: string) => {

View File

@ -48,6 +48,7 @@ const message = {
ignore: 'Ignore upgrade',
copy: 'Copy',
random: 'Random',
uninstall: 'Uninstall',
},
search: {
timeStart: 'Time start',

View File

@ -48,6 +48,7 @@ const message = {
ignore: '忽略升級',
copy: '復製',
random: '隨機密碼',
uninstall: '卸載',
},
search: {
timeStart: '開始時間',

View File

@ -48,6 +48,7 @@ const message = {
ignore: '忽略升级',
copy: '复制',
random: '随机密码',
uninstall: '卸载',
},
search: {
timeStart: '开始时间',

View File

@ -196,11 +196,19 @@
<el-tag
class="middle-center"
v-if="installed.httpPort > 0"
@click="goDashboard(installed.httpPort)"
@click="goDashboard(installed.httpPort, 'http')"
>
<el-icon class="middle-center"><Position /></el-icon>
{{ $t('app.busPort') }}{{ installed.httpPort }}
</el-tag>
<el-tag
class="middle-center"
v-if="installed.httpsPort > 0"
@click="goDashboard(installed.httpsPort, 'https')"
>
<el-icon class="middle-center"><Position /></el-icon>
{{ $t('app.busPort') }}{{ installed.httpsPort }}
</el-tag>
<div class="description">
<span>
{{ $t('app.alreadyRun') }} {{ getAge(installed.createdAt) }}
@ -358,8 +366,8 @@ const search = () => {
});
};
const goDashboard = async (port: any) => {
dialogPortJumpRef.value.acceptParams({ port: port });
const goDashboard = async (port: any, protocol: string) => {
dialogPortJumpRef.value.acceptParams({ port: port, protocol: protocol });
};
const openOperate = (row: any, op: string) => {
@ -467,7 +475,7 @@ const buttons = [
},
},
{
label: i18n.global.t('commons.button.delete'),
label: i18n.global.t('commons.button.uninstall'),
click: (row: any) => {
openOperate(row, 'delete');
},