feat: support edit domain name
support edit domain name Change-Id: I81f8718806e6e90ed5564103c4636b205eac3e62
This commit is contained in:
parent
9b9c5248a9
commit
668180bcd6
@ -175,7 +175,6 @@ English | [Chinese](../../zh/develop/3-6-FormAction-introduction.md)
|
||||
type: 'input',
|
||||
placeholder: t('Please input name'),
|
||||
required: true,
|
||||
help: t('The name cannot be modified after creation'),
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
@ -349,7 +348,7 @@ English | [Chinese](../../zh/develop/3-6-FormAction-introduction.md)
|
||||
|
||||
- `labelCol`
|
||||
- Configure the layout of the labels on the left side of the form
|
||||
- The default value is
|
||||
- The default value is
|
||||
|
||||
```javascript
|
||||
get labelCol() {
|
||||
@ -373,7 +372,7 @@ English | [Chinese](../../zh/develop/3-6-FormAction-introduction.md)
|
||||
|
||||
- `wrapperCol`
|
||||
- Configure the layout of the content on the right side of the form
|
||||
- The default value is
|
||||
- The default value is
|
||||
|
||||
```javascript
|
||||
get wrapperCol() {
|
||||
|
@ -175,7 +175,6 @@
|
||||
type: 'input',
|
||||
placeholder: t('Please input name'),
|
||||
required: true,
|
||||
help: t('The name cannot be modified after creation'),
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Support edit domain name:
|
||||
|
||||
* Support edit domain name when editing domain.
|
@ -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 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 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 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, -, _.\"",
|
||||
|
@ -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 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 name cannot be modified after creation": "생성 후에는 이름을 수정할 수 없습니다.",
|
||||
"The name of the physical network to which a port is connected": "포트가 연결된 물리 네트워크의 이름",
|
||||
"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, -, _.\"만 포함할 수 있습니다.",
|
||||
|
@ -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 transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.": "地址片段的最大传输单位。IPv4最小68,IPv6最小1280。",
|
||||
"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 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、-、_”。",
|
||||
|
@ -57,7 +57,6 @@ export class Create extends ModalAction {
|
||||
type: 'input',
|
||||
placeholder: t('Please input name'),
|
||||
required: true,
|
||||
extra: t('The name cannot be modified after creation'),
|
||||
validator: this.nameValidator,
|
||||
},
|
||||
// {
|
||||
|
@ -15,10 +15,12 @@
|
||||
import { inject, observer } from 'mobx-react';
|
||||
import { ModalAction } from 'containers/Action';
|
||||
import globalDomainStore from 'stores/keystone/domain';
|
||||
import { toJS } from 'mobx';
|
||||
|
||||
export class Edit extends ModalAction {
|
||||
init() {
|
||||
this.store = globalDomainStore;
|
||||
this.store.fetchList();
|
||||
}
|
||||
|
||||
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() {
|
||||
return [
|
||||
{
|
||||
@ -48,9 +66,8 @@ export class Edit extends ModalAction {
|
||||
label: t('Name'),
|
||||
type: 'input',
|
||||
placeholder: t('Please input name'),
|
||||
// required: true,
|
||||
help: t('The name cannot be modified after creation'),
|
||||
disabled: true,
|
||||
required: true,
|
||||
validator: this.nameValidator,
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
|
@ -95,9 +95,9 @@ export class DomainStore extends Base {
|
||||
}
|
||||
|
||||
@action
|
||||
async edit({ id, description }) {
|
||||
async edit({ id, description, name }) {
|
||||
const reqBody = {
|
||||
domain: { description },
|
||||
domain: { description, name },
|
||||
};
|
||||
return this.submitting(this.client.patch(id, reqBody));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user