1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-16 18:54:43 +08:00

feat: 支持自定义概览页安全入口提示是否显示 (#2257)

This commit is contained in:
ssongliu 2023-09-11 18:32:11 +08:00 committed by GitHub
parent ac91480987
commit d1d0ca92ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 1 deletions

View File

@ -1052,6 +1052,7 @@ const message = {
safe: 'Security', safe: 'Security',
entrance: 'Entrance', entrance: 'Entrance',
showEntrance: 'Enable Home Page Notification Not Enabled',
entranceHelper: 'Enabling secure entry will only allow logging in to the panel through specified secure entry.', entranceHelper: 'Enabling secure entry will only allow logging in to the panel through specified secure entry.',
entranceError: entranceError:
'Please enter a secure login entry point of 6-10 characters, only numbers or letters are supported.', 'Please enter a secure login entry point of 6-10 characters, only numbers or letters are supported.',

View File

@ -1052,6 +1052,7 @@ const message = {
safe: '安全', safe: '安全',
entrance: '安全入口', entrance: '安全入口',
showEntrance: '啟用概覽頁未開啟提醒',
entranceHelper: '開啟安全入口後只能通過指定安全入口登錄面板', entranceHelper: '開啟安全入口後只能通過指定安全入口登錄面板',
entranceError: '請輸入 6-10 位安全登錄入口僅支持輸入數字或字母', entranceError: '請輸入 6-10 位安全登錄入口僅支持輸入數字或字母',
entranceInputHelper: '安全入口設置為空時則取消安全入口', entranceInputHelper: '安全入口設置為空時則取消安全入口',

View File

@ -1052,6 +1052,7 @@ const message = {
safe: '安全', safe: '安全',
entrance: '安全入口', entrance: '安全入口',
showEntrance: '启用概览页未开启提醒',
entranceHelper: '开启安全入口后只能通过指定安全入口登录面板', entranceHelper: '开启安全入口后只能通过指定安全入口登录面板',
entranceError: '请输入 6-10 位安全登录入口仅支持输入数字或字母', entranceError: '请输入 6-10 位安全登录入口仅支持输入数字或字母',
entranceInputHelper: '安全入口设置为空时则取消安全入口', entranceInputHelper: '安全入口设置为空时则取消安全入口',

View File

@ -28,6 +28,7 @@ export const GlobalStore = defineStore({
device: DeviceType.Desktop, device: DeviceType.Desktop,
lastFilePath: '', lastFilePath: '',
currentDB: '', currentDB: '',
showEntranceWarn: true,
}), }),
getters: {}, getters: {},
actions: { actions: {
@ -68,6 +69,9 @@ export const GlobalStore = defineStore({
setCurrentDB(name: string) { setCurrentDB(name: string) {
this.currentDB = name; this.currentDB = name;
}, },
setShowEntranceWarn(show: boolean) {
this.showEntranceWarn = show;
},
}, },
persist: piniaPersistConfig('GlobalState'), persist: piniaPersistConfig('GlobalState'),
}); });

View File

@ -23,6 +23,7 @@ export interface GlobalState {
device: DeviceType; device: DeviceType;
lastFilePath: string; lastFilePath: string;
currentDB: string; currentDB: string;
showEntranceWarn: boolean;
} }
export interface MenuState { export interface MenuState {

View File

@ -8,7 +8,12 @@
}, },
]" ]"
/> />
<el-alert v-if="!isSafety" :closable="false" style="margin-top: 20px" type="warning"> <el-alert
v-if="!isSafety && globalStore.showEntranceWarn"
style="margin-top: 20px"
type="warning"
@close="hideEntrance"
>
<template #default> <template #default>
<span> <span>
<span>{{ $t('home.entranceHelper') }}</span> <span>{{ $t('home.entranceHelper') }}</span>
@ -504,6 +509,10 @@ const loadData = async () => {
} }
}; };
const hideEntrance = () => {
globalStore.setShowEntranceWarn(false);
};
const loadUpgradeStatus = async () => { const loadUpgradeStatus = async () => {
const res = await loadUpgradeInfo(); const res = await loadUpgradeInfo();
if (res.data) { if (res.data) {

View File

@ -24,6 +24,9 @@
{{ $t('setting.entranceInputHelper') }} {{ $t('setting.entranceInputHelper') }}
</span> </span>
</el-form-item> </el-form-item>
<el-form-item>
<el-checkbox v-model="show" :label="$t('setting.showEntrance')" />
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
@ -56,6 +59,7 @@ interface DialogProps {
} }
const drawerVisiable = ref(); const drawerVisiable = ref();
const loading = ref(); const loading = ref();
const show = ref();
const form = reactive({ const form = reactive({
securityEntrance: '', securityEntrance: '',
@ -78,6 +82,7 @@ function checkSecurityEntrance(rule: any, value: any, callback: any) {
const acceptParams = (params: DialogProps): void => { const acceptParams = (params: DialogProps): void => {
form.securityEntrance = params.securityEntrance; form.securityEntrance = params.securityEntrance;
show.value = globalStore.showEntranceWarn;
drawerVisiable.value = true; drawerVisiable.value = true;
}; };
@ -96,6 +101,7 @@ const submitEntrance = async (formEl: FormInstance | undefined) => {
loading.value = true; loading.value = true;
await updateSetting(param) await updateSetting(param)
.then(() => { .then(() => {
globalStore.setShowEntranceWarn(show.value);
globalStore.entrance = form.securityEntrance; globalStore.entrance = form.securityEntrance;
loading.value = false; loading.value = false;
drawerVisiable.value = false; drawerVisiable.value = false;