diff --git a/frontend/src/views/setting/panel/index.vue b/frontend/src/views/setting/panel/index.vue
index f9a094d8ac3f..378b89eac31e 100644
--- a/frontend/src/views/setting/panel/index.vue
+++ b/frontend/src/views/setting/panel/index.vue
@@ -2,39 +2,32 @@
-
+
-
-
+
+
-
- {{ $t('commons.button.save') }}
+
+ {{ $t('commons.button.set') }}
@@ -28,14 +24,14 @@
v-model="form.securityEntrance"
>
-
+
{{ $t('commons.button.set') }}
-
+
{{ $t('commons.button.set') }}
@@ -46,7 +42,7 @@
-
+
{{ $t('commons.button.set') }}
@@ -62,9 +58,7 @@
+
@@ -123,25 +118,19 @@
import { ref, reactive, onMounted } from 'vue';
import { ElForm, ElMessageBox } from 'element-plus';
import LayoutContent from '@/layout/layout-content.vue';
+import PortSetting from '@/views/setting/safe/port/index.vue';
import SSLSetting from '@/views/setting/safe/ssl/index.vue';
import MfaSetting from '@/views/setting/safe/mfa/index.vue';
import TimeoutSetting from '@/views/setting/safe/timeout/index.vue';
import EntranceSetting from '@/views/setting/safe/entrance/index.vue';
-import {
- updateSetting,
- getSettingInfo,
- updatePort,
- getSystemAvailable,
- updateSSL,
- loadSSLInfo,
-} from '@/api/modules/setting';
+import { updateSetting, getSettingInfo, getSystemAvailable, updateSSL, loadSSLInfo } from '@/api/modules/setting';
import i18n from '@/lang';
-import { Rules } from '@/global/form-rules';
import { MsgSuccess } from '@/utils/message';
import { Setting } from '@/api/interface/setting';
const loading = ref(false);
const entranceRef = ref();
+const portRef = ref();
const timeoutref = ref();
const mfaRef = ref();
@@ -155,10 +144,9 @@ const form = reactive({
securityEntrance: '',
expirationDays: 0,
expirationTime: '',
- complexityVerification: '',
+ complexityVerification: 'disable',
mfaStatus: 'disable',
});
-type FormInstance = InstanceType
;
const unset = ref(i18n.global.t('setting.unSetting'));
@@ -176,20 +164,11 @@ const search = async () => {
form.complexityVerification = res.data.complexityVerification;
form.mfaStatus = res.data.mfaStatus;
};
-const panelFormRef = ref();
-const onSave = async (formEl: FormInstance | undefined, key: string, val: any) => {
- if (!formEl) return;
- const result = await formEl.validateField(key.replace(key[0], key[0].toLowerCase()), callback);
- if (!result) {
- return;
- }
- if (val === '') {
- return;
- }
+const onSaveComplexity = async () => {
let param = {
- key: key,
- value: val + '',
+ key: 'ComplexityVerification',
+ value: form.complexityVerification,
};
loading.value = true;
await updateSetting(param)
@@ -202,41 +181,7 @@ const onSave = async (formEl: FormInstance | undefined, key: string, val: any) =
loading.value = false;
});
};
-function callback(error: any) {
- if (error) {
- return error.message;
- } else {
- return;
- }
-}
-const onSavePort = async (formEl: FormInstance | undefined, key: string, val: any) => {
- if (!formEl) return;
- const result = await formEl.validateField(key.replace(key[0], key[0].toLowerCase()), callback);
- if (!result) {
- return;
- }
- ElMessageBox.confirm(i18n.global.t('setting.portChangeHelper'), i18n.global.t('setting.portChange'), {
- confirmButtonText: i18n.global.t('commons.button.confirm'),
- cancelButtonText: i18n.global.t('commons.button.cancel'),
- type: 'info',
- }).then(async () => {
- loading.value = true;
- let param = {
- serverPort: val,
- };
- await updatePort(param)
- .then(() => {
- loading.value = false;
- MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
- let href = window.location.href;
- let ip = href.split('//')[1].split(':')[0];
- window.open(`${href.split('//')[0]}//${ip}:${val}/`, '_self');
- })
- .catch(() => {
- loading.value = false;
- });
- });
-};
+
const handleMFA = async () => {
if (form.mfaStatus === 'enable') {
mfaRef.value.acceptParams();
@@ -257,6 +202,9 @@ const handleMFA = async () => {
const onChangeEntrance = async () => {
entranceRef.value.acceptParams({ securityEntrance: form.securityEntrance });
};
+const onChangePort = async () => {
+ portRef.value.acceptParams({ serverPort: form.serverPort });
+};
const handleSSL = async () => {
if (form.ssl === 'enable') {
let params = {
diff --git a/frontend/src/views/setting/safe/port/index.vue b/frontend/src/views/setting/safe/port/index.vue
new file mode 100644
index 000000000000..6dc5ddb682a9
--- /dev/null
+++ b/frontend/src/views/setting/safe/port/index.vue
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/views/setting/safe/ssl/index.vue b/frontend/src/views/setting/safe/ssl/index.vue
index 62f5d9c4a1c5..89a5951490ba 100644
--- a/frontend/src/views/setting/safe/ssl/index.vue
+++ b/frontend/src/views/setting/safe/ssl/index.vue
@@ -186,7 +186,6 @@ const onDownload = async () => {
};
const onSaveSSL = async (formEl: FormInstance | undefined) => {
- onDownload();
if (!formEl) return;
formEl.validate(async (valid) => {
if (!valid) return;
diff --git a/frontend/src/views/setting/safe/timeout/index.vue b/frontend/src/views/setting/safe/timeout/index.vue
index 7fe4e905b804..8bbfe671cfe4 100644
--- a/frontend/src/views/setting/safe/timeout/index.vue
+++ b/frontend/src/views/setting/safe/timeout/index.vue
@@ -81,9 +81,3 @@ defineExpose({
acceptParams,
});
-
-