1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 16:29:17 +08:00

feat: 概览页增加未启用安全入口提示信息

This commit is contained in:
ssongliu 2023-04-17 11:13:30 +08:00 committed by ssongliu
parent a06e5f28b3
commit 17dd07fe32
4 changed files with 36 additions and 3 deletions

View File

@ -221,6 +221,8 @@ const message = {
}, },
home: { home: {
overview: 'Overview', overview: 'Overview',
entranceHelper:
'Enabling a secure entrance can help improve system security. If necessary, go to the Control Panel settings, select Security, and enable the secure entrance.',
appInstalled: 'App installed', appInstalled: 'App installed',
systemInfo: 'System info', systemInfo: 'System info',
hostname: 'Hostname', hostname: 'Hostname',

View File

@ -224,6 +224,7 @@ const message = {
}, },
home: { home: {
overview: '概览', overview: '概览',
entranceHelper: '设置安全入口有利于提高系统的安全性如有需要前往 面板设置-安全 启用安全入口',
appInstalled: '已安装应用', appInstalled: '已安装应用',
systemInfo: '系统信息', systemInfo: '系统信息',
hostname: '主机名称', hostname: '主机名称',

View File

@ -8,6 +8,22 @@
}, },
]" ]"
/> />
<el-alert v-if="!isSafety" :closable="false" style="margin-top: 20px" type="warning">
<template #default>
<span>
<span>{{ $t('home.entranceHelper') }}</span>
<el-link
style="font-size: 12px; margin-left: 5px"
icon="Position"
@click="goRouter('/settings/safe')"
type="primary"
>
{{ $t('firewall.quickJump') }}
</el-link>
</span>
</template>
</el-alert>
<el-row :gutter="20" style="margin-top: 20px"> <el-row :gutter="20" style="margin-top: 20px">
<el-col :span="16"> <el-col :span="16">
<CardWithHeader :header="$t('home.overview')" height="146px"> <CardWithHeader :header="$t('home.overview')" height="146px">
@ -109,7 +125,7 @@
<div v-if="chartOption === 'io'" style="margin-top: 40px"> <div v-if="chartOption === 'io'" style="margin-top: 40px">
<v-charts <v-charts
height="300px" height="305px"
id="ioChart" id="ioChart"
type="line" type="line"
:option="chartsOption['ioChart']" :option="chartsOption['ioChart']"
@ -119,7 +135,7 @@
</div> </div>
<div v-if="chartOption === 'network'" style="margin-top: 40px"> <div v-if="chartOption === 'network'" style="margin-top: 40px">
<v-charts <v-charts
height="300px" height="305px"
id="networkChart" id="networkChart"
type="line" type="line"
:option="chartsOption['networkChart']" :option="chartsOption['networkChart']"
@ -210,7 +226,7 @@ import { useRouter } from 'vue-router';
import RouterButton from '@/components/router-button/index.vue'; import RouterButton from '@/components/router-button/index.vue';
import { loadBaseInfo, loadCurrentInfo } from '@/api/modules/dashboard'; import { loadBaseInfo, loadCurrentInfo } from '@/api/modules/dashboard';
import { getIOOptions, getNetworkOptions } from '@/api/modules/monitor'; import { getIOOptions, getNetworkOptions } from '@/api/modules/monitor';
import { loadUpgradeInfo } from '@/api/modules/setting'; import { getSettingInfo, loadUpgradeInfo } from '@/api/modules/setting';
import { GlobalStore } from '@/store'; import { GlobalStore } from '@/store';
const router = useRouter(); const router = useRouter();
const globalStore = GlobalStore(); const globalStore = GlobalStore();
@ -218,6 +234,8 @@ const globalStore = GlobalStore();
const statuRef = ref(); const statuRef = ref();
const appRef = ref(); const appRef = ref();
const isSafety = ref();
const chartOption = ref('network'); const chartOption = ref('network');
let timer: NodeJS.Timer | null = null; let timer: NodeJS.Timer | null = null;
let isInit = ref<boolean>(true); let isInit = ref<boolean>(true);
@ -482,7 +500,13 @@ const loadUpgradeStatus = async () => {
} }
}; };
const loadSafeStatus = async () => {
const res = await getSettingInfo();
isSafety.value = res.data.securityEntranceStatus === 'enable';
};
onMounted(() => { onMounted(() => {
loadSafeStatus();
loadUpgradeStatus(); loadUpgradeStatus();
onLoadNetworkOptions(); onLoadNetworkOptions();
onLoadIOOptions(); onLoadIOOptions();

View File

@ -183,6 +183,12 @@ const loadDetail = (log: string) => {
if (log.indexOf('[SessionTimeout]') !== -1) { if (log.indexOf('[SessionTimeout]') !== -1) {
return log.replace('[SessionTimeout]', '[' + i18n.global.t('setting.sessionTimeout') + ']'); return log.replace('[SessionTimeout]', '[' + i18n.global.t('setting.sessionTimeout') + ']');
} }
if (log.indexOf('SecurityEntranceStatus') !== -1) {
return log.replace('[SecurityEntranceStatus]', '[' + i18n.global.t('setting.entrance') + ']');
}
if (log.indexOf('SecurityEntrance') !== -1) {
return log.replace('[SecurityEntrance]', '[' + i18n.global.t('setting.entrance') + ']');
}
if (log.indexOf('[ExpirationDays]') !== -1) { if (log.indexOf('[ExpirationDays]') !== -1) {
return log.replace('[ExpirationDays]', '[' + i18n.global.t('setting.expirationTime') + ']'); return log.replace('[ExpirationDays]', '[' + i18n.global.t('setting.expirationTime') + ']');
} }