-
+
{{ $t('commons.button.save') }}
@@ -38,10 +43,15 @@
>
{{ $t('commons.button.delete') }}
-
+
{{ $t('commons.button.cancel') }}
-
+
{{ $t('website.setDefault') }}
@@ -58,6 +68,8 @@ import { CreateGroup, DeleteGroup, GetGroupList, UpdateGroup } from '@/api/modul
import Header from '@/components/drawer-header/index.vue';
import { MsgSuccess } from '@/utils/message';
import { Group } from '@/api/interface/group';
+import { Rules } from '@/global/form-rules';
+import { FormInstance } from 'element-plus';
const open = ref(false);
const type = ref();
@@ -67,10 +79,11 @@ const handleClose = () => {
data.value = [];
emit('search');
};
-
interface DialogProps {
type: string;
}
+
+const groupForm = ref();
const acceptParams = (params: DialogProps): void => {
type.value = params.type;
open.value = true;
@@ -93,20 +106,28 @@ const search = () => {
});
};
-const saveGroup = (group: Group.GroupInfo, isDefault: boolean) => {
- group.type = type.value;
- if (group.id == 0) {
- CreateGroup(group).then(() => {
- MsgSuccess(i18n.global.t('commons.msg.createSuccess'));
- search();
- });
- } else {
- group.isDefault = isDefault;
- UpdateGroup(group).then(() => {
- MsgSuccess(i18n.global.t('commons.msg.updateSuccess'));
- search();
- });
- }
+const saveGroup = async (formEl: FormInstance, group: Group.GroupInfo, isEdit: boolean) => {
+ if (!formEl) return;
+ await formEl.validate((valid) => {
+ if (!valid) {
+ return;
+ }
+ group.type = type.value;
+ if (!isEdit) {
+ group.isDefault = true;
+ }
+ if (group.id == 0) {
+ CreateGroup(group).then(() => {
+ MsgSuccess(i18n.global.t('commons.msg.createSuccess'));
+ search();
+ });
+ } else {
+ UpdateGroup(group).then(() => {
+ MsgSuccess(i18n.global.t('commons.msg.updateSuccess'));
+ search();
+ });
+ }
+ });
};
const openCreate = () => {
@@ -153,13 +174,5 @@ const editGroup = (index: number) => {
data.value[index].edit = true;
};
-const cancelEdit = (index: number) => {
- if (data.value[index].id == 0) {
- data.value.splice(index, 1);
- } else {
- data.value[index].edit = false;
- }
-};
-
defineExpose({ acceptParams });
diff --git a/frontend/src/global/form-rules.ts b/frontend/src/global/form-rules.ts
index e5969d998..1544e7d31 100644
--- a/frontend/src/global/form-rules.ts
+++ b/frontend/src/global/form-rules.ts
@@ -45,7 +45,7 @@ const checkUserName = (rule: any, value: any, callback: any) => {
if (value === '' || typeof value === 'undefined' || value == null) {
callback(new Error(i18n.global.t('commons.rule.userName')));
} else {
- const reg = /^[a-zA-Z\u4e00-\u9fa5]{1}[a-zA-Z0-9_\u4e00-\u9fa5]{2,30}$/;
+ const reg = /[a-zA-Z0-9_\u4e00-\u9fa5]{3,30}$/;
if (!reg.test(value) && value !== '') {
callback(new Error(i18n.global.t('commons.rule.userName')));
} else {
@@ -97,7 +97,7 @@ const checkVolumeName = (rule: any, value: any, callback: any) => {
if (value === '' || typeof value === 'undefined' || value == null) {
callback(new Error(i18n.global.t('commons.rule.volumeName')));
} else {
- const reg = /^[a-zA-Z0-9]{1}[a-z:A-Z0-9_.-]{0,30}$/;
+ const reg = /^[a-zA-Z0-9]{1}[a-z:A-Z0-9_.-]{1,30}$/;
if (!reg.test(value) && value !== '') {
callback(new Error(i18n.global.t('commons.rule.volumeName')));
} else {
@@ -159,6 +159,19 @@ const checkDomain = (rule: any, value: any, callback: any) => {
}
};
+const checkIntegerNumber = (rule: any, value: any, callback: any) => {
+ if (value === '' || typeof value === 'undefined' || value == null) {
+ callback(new Error(i18n.global.t('commons.rule.integer')));
+ } else {
+ const reg = /^[1-9]\d*$/;
+ if (!reg.test(value) && value !== '') {
+ callback(new Error(i18n.global.t('commons.rule.integer')));
+ } else {
+ callback();
+ }
+ }
+};
+
const checkParamCommon = (rule: any, value: any, callback: any) => {
if (value === '' || typeof value === 'undefined' || value == null) {
callback(new Error(i18n.global.t('commons.rule.paramName')));
@@ -250,6 +263,7 @@ interface CommonRule {
password: FormItemRule;
email: FormItemRule;
number: FormItemRule;
+ integerNumber: FormItemRule;
ip: FormItemRule;
port: FormItemRule;
domain: FormItemRule;
@@ -339,6 +353,11 @@ export const Rules: CommonRule = {
type: 'number',
message: i18n.global.t('commons.rule.number'),
},
+ integerNumber: {
+ required: true,
+ validator: checkIntegerNumber,
+ trigger: 'blur',
+ },
ip: {
validator: checkIp,
required: true,
diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts
index 22c75f97c..2fac4cac5 100644
--- a/frontend/src/lang/modules/en.ts
+++ b/frontend/src/lang/modules/en.ts
@@ -443,6 +443,7 @@ export default {
mount: 'Mount',
serverPath: 'Server path',
containerDir: 'Container path',
+ volumeHelper: 'Ensure that the content of the storage volume is correct',
modeRW: 'RW',
modeR: 'R',
mode: 'Mode',
diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts
index 4690105d6..9137d8d7f 100644
--- a/frontend/src/lang/modules/zh.ts
+++ b/frontend/src/lang/modules/zh.ts
@@ -455,6 +455,7 @@ export default {
mount: '挂载卷',
serverPath: '服务器目录',
containerDir: '容器目录',
+ volumeHelper: '请确认存储卷内容输入正确',
modeRW: '读写',
modeR: '只读',
mode: '权限',
@@ -524,6 +525,7 @@ export default {
registrieHelper: '一行一个,例:\n172.16.10.111:8081 \n172.16.10.112:8081',
compose: '编排',
+ composePathHelper: '容器编排将保存在: {0}',
apps: '应用商店',
local: '本地',
createCompose: '创建编排',
diff --git a/frontend/src/views/host/terminal/host/index.vue b/frontend/src/views/host/terminal/host/index.vue
index 44315a9af..33e085386 100644
--- a/frontend/src/views/host/terminal/host/index.vue
+++ b/frontend/src/views/host/terminal/host/index.vue
@@ -155,9 +155,6 @@ const buttons = [
click: (row: any) => {
dialogGroupChangeRef.value!.acceptParams({ id: row.id, group: row.groupBelong });
},
- disabled: (row: any) => {
- return row.addr === '127.0.0.1';
- },
},
{
label: i18n.global.t('commons.button.edit'),
diff --git a/frontend/src/views/host/terminal/host/operate/index.vue b/frontend/src/views/host/terminal/host/operate/index.vue
index b4eb5ef20..ab94da99b 100644
--- a/frontend/src/views/host/terminal/host/operate/index.vue
+++ b/frontend/src/views/host/terminal/host/operate/index.vue
@@ -11,7 +11,7 @@
{{ dialogData.rowData!.addr }}
-
+
@@ -113,8 +113,6 @@ const rules = reactive({
port: [Rules.requiredInput, Rules.port],
user: [Rules.requiredInput],
authMode: [Rules.requiredSelect],
- password: [Rules.requiredInput],
- privateKey: [Rules.requiredInput],
});
const loadGroups = async () => {
diff --git a/frontend/src/views/host/terminal/terminal/host-create.vue b/frontend/src/views/host/terminal/terminal/host-create.vue
index 38db86bf5..6fbed605e 100644
--- a/frontend/src/views/host/terminal/terminal/host-create.vue
+++ b/frontend/src/views/host/terminal/terminal/host-create.vue
@@ -16,7 +16,7 @@
type="warning"
/>
-
+
{{ hostInfo.addr }}
diff --git a/frontend/src/views/log/operation/index.vue b/frontend/src/views/log/operation/index.vue
index 0e4b76ff2..024c6605b 100644
--- a/frontend/src/views/log/operation/index.vue
+++ b/frontend/src/views/log/operation/index.vue
@@ -131,7 +131,7 @@ const search = async () => {
await getOperationLogs(params)
.then((res) => {
loading.value = false;
- data.value = res.data.items;
+ data.value = res.data.items || [];
if (globalStore.language === 'zh') {
for (const item of data.value) {
item.detailZH = loadDetail(item.detailZH);
diff --git a/frontend/src/views/setting/backup-account/operate/index.vue b/frontend/src/views/setting/backup-account/operate/index.vue
index ba32ab958..ceda34dfc 100644
--- a/frontend/src/views/setting/backup-account/operate/index.vue
+++ b/frontend/src/views/setting/backup-account/operate/index.vue
@@ -260,6 +260,7 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
.catch(() => {
loading.value = false;
});
+ return;
}
await editBackup(dialogData.value.rowData)
.then(() => {