feat: support edit domain name

support edit domain name

Change-Id: I81f8718806e6e90ed5564103c4636b205eac3e62
This commit is contained in:
zhangjingwei 2023-11-13 11:16:58 +08:00
parent 9b9c5248a9
commit 668180bcd6
9 changed files with 30 additions and 13 deletions

View File

@ -175,7 +175,6 @@ English | [Chinese](../../zh/develop/3-6-FormAction-introduction.md)
type: 'input', type: 'input',
placeholder: t('Please input name'), placeholder: t('Please input name'),
required: true, required: true,
help: t('The name cannot be modified after creation'),
}, },
{ {
name: 'description', name: 'description',

View File

@ -175,7 +175,6 @@
type: 'input', type: 'input',
placeholder: t('Please input name'), placeholder: t('Please input name'),
required: true, required: true,
help: t('The name cannot be modified after creation'),
}, },
{ {
name: 'description', name: 'description',

View File

@ -0,0 +1,6 @@
---
features:
- |
Support edit domain name:
* Support edit domain name when editing domain.

View File

@ -2463,7 +2463,6 @@
"The maximum batch size is {size}, that is, the size of the port range cannot exceed {size}.": "The maximum batch size is {size}, that is, the size of the port range cannot exceed {size}.", "The maximum batch size is {size}, that is, the size of the port range cannot exceed {size}.": "The maximum batch size is {size}, that is, the size of the port range cannot exceed {size}.",
"The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.": "The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.", "The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.": "The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.",
"The min size is {size} GiB": "The min size is {size} GiB", "The min size is {size} GiB": "The min size is {size} GiB",
"The name cannot be modified after creation": "The name cannot be modified after creation",
"The name of the physical network to which a port is connected": "The name of the physical network to which a port is connected", "The name of the physical network to which a port is connected": "The name of the physical network to which a port is connected",
"The name should be end with \".\"": "The name should be end with \".\"", "The name should be end with \".\"": "The name should be end with \".\"",
"The name should contain letter or number, the length is 1 to 16, characters can only contain \"0-9, a-z, A-Z, -, _.\"": "The name should contain letter or number, the length is 1 to 16, characters can only contain \"0-9, a-z, A-Z, -, _.\"", "The name should contain letter or number, the length is 1 to 16, characters can only contain \"0-9, a-z, A-Z, -, _.\"": "The name should contain letter or number, the length is 1 to 16, characters can only contain \"0-9, a-z, A-Z, -, _.\"",

View File

@ -2463,7 +2463,6 @@
"The maximum batch size is {size}, that is, the size of the port range cannot exceed {size}.": "최대 batch 크기는 {size}입니다. 즉, 포트 범위의 크기는 {size}를 초과할 수 없습니다.", "The maximum batch size is {size}, that is, the size of the port range cannot exceed {size}.": "최대 batch 크기는 {size}입니다. 즉, 포트 범위의 크기는 {size}를 초과할 수 없습니다.",
"The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.": "분할을 처리하기 위한 최대 전송 단위(MTU) 값입니다. IPv4의 경우 최소값은 68이며, IPv6의 경우 최소값은 1280입니다.", "The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.": "분할을 처리하기 위한 최대 전송 단위(MTU) 값입니다. IPv4의 경우 최소값은 68이며, IPv6의 경우 최소값은 1280입니다.",
"The min size is {size} GiB": "최소 크기는 {size} GiB입니다.", "The min size is {size} GiB": "최소 크기는 {size} GiB입니다.",
"The name cannot be modified after creation": "생성 후에는 이름을 수정할 수 없습니다.",
"The name of the physical network to which a port is connected": "포트가 연결된 물리 네트워크의 이름", "The name of the physical network to which a port is connected": "포트가 연결된 물리 네트워크의 이름",
"The name should be end with \".\"": "", "The name should be end with \".\"": "",
"The name should contain letter or number, the length is 1 to 16, characters can only contain \"0-9, a-z, A-Z, -, _.\"": "이름은 문자나 숫자를 포함해야 하고, 길이는 1~16자 사이여야 하며, 문자는 \"0-9, a-z, A-Z, -, _.\"만 포함할 수 있습니다.", "The name should contain letter or number, the length is 1 to 16, characters can only contain \"0-9, a-z, A-Z, -, _.\"": "이름은 문자나 숫자를 포함해야 하고, 길이는 1~16자 사이여야 하며, 문자는 \"0-9, a-z, A-Z, -, _.\"만 포함할 수 있습니다.",

View File

@ -2463,7 +2463,6 @@
"The maximum batch size is {size}, that is, the size of the port range cannot exceed {size}.": "批量的上限为{size}个,即端口范围大小不可超过{size}。", "The maximum batch size is {size}, that is, the size of the port range cannot exceed {size}.": "批量的上限为{size}个,即端口范围大小不可超过{size}。",
"The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.": "地址片段的最大传输单位。IPv4最小68IPv6最小1280。", "The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.": "地址片段的最大传输单位。IPv4最小68IPv6最小1280。",
"The min size is {size} GiB": "最小内存为 {size} GiB", "The min size is {size} GiB": "最小内存为 {size} GiB",
"The name cannot be modified after creation": "名称创建后不可修改",
"The name of the physical network to which a port is connected": "端口连接到的物理网络的名称", "The name of the physical network to which a port is connected": "端口连接到的物理网络的名称",
"The name should be end with \".\"": "", "The name should be end with \".\"": "",
"The name should contain letter or number, the length is 1 to 16, characters can only contain \"0-9, a-z, A-Z, -, _.\"": "名称应包含字母或数字,长度为 1 到 16且字符只能包含“0-9、a-z、A-Z、-、_”。", "The name should contain letter or number, the length is 1 to 16, characters can only contain \"0-9, a-z, A-Z, -, _.\"": "名称应包含字母或数字,长度为 1 到 16且字符只能包含“0-9、a-z、A-Z、-、_”。",

View File

@ -57,7 +57,6 @@ export class Create extends ModalAction {
type: 'input', type: 'input',
placeholder: t('Please input name'), placeholder: t('Please input name'),
required: true, required: true,
extra: t('The name cannot be modified after creation'),
validator: this.nameValidator, validator: this.nameValidator,
}, },
// { // {

View File

@ -15,10 +15,12 @@
import { inject, observer } from 'mobx-react'; import { inject, observer } from 'mobx-react';
import { ModalAction } from 'containers/Action'; import { ModalAction } from 'containers/Action';
import globalDomainStore from 'stores/keystone/domain'; import globalDomainStore from 'stores/keystone/domain';
import { toJS } from 'mobx';
export class Edit extends ModalAction { export class Edit extends ModalAction {
init() { init() {
this.store = globalDomainStore; this.store = globalDomainStore;
this.store.fetchList();
} }
static id = 'domain-edit'; static id = 'domain-edit';
@ -41,6 +43,22 @@ export class Edit extends ModalAction {
}; };
} }
get currentList() {
const { list: { data = [] } = {} } = this.store;
return data;
}
nameValidator = (rule, value) => {
const data = toJS(this.currentList);
if (data.find((d) => d.name === value && d.id !== this.item.id)) {
return Promise.reject(
new Error(t('Invalid: Domain name cannot be duplicated'))
);
}
return Promise.resolve(true);
};
get formItems() { get formItems() {
return [ return [
{ {
@ -48,9 +66,8 @@ export class Edit extends ModalAction {
label: t('Name'), label: t('Name'),
type: 'input', type: 'input',
placeholder: t('Please input name'), placeholder: t('Please input name'),
// required: true, required: true,
help: t('The name cannot be modified after creation'), validator: this.nameValidator,
disabled: true,
}, },
{ {
name: 'description', name: 'description',

View File

@ -95,9 +95,9 @@ export class DomainStore extends Base {
} }
@action @action
async edit({ id, description }) { async edit({ id, description, name }) {
const reqBody = { const reqBody = {
domain: { description }, domain: { description, name },
}; };
return this.submitting(this.client.patch(id, reqBody)); return this.submitting(this.client.patch(id, reqBody));
} }