fix: fix the domain description

1. fix the domain description
2.filter the disabled domain when get domain options

Change-Id: I6ece6d4cf50fbed3ac2569b70fc47591932d69c6
This commit is contained in:
liyoumin 2023-08-03 17:13:50 +08:00
parent a95c588a5d
commit cfe389dd39
7 changed files with 285 additions and 219 deletions

View File

@ -237,6 +237,7 @@
"Base Info": "Base Info", "Base Info": "Base Info",
"Basic Parameters": "Basic Parameters", "Basic Parameters": "Basic Parameters",
"Batch Allocate": "Batch Allocate", "Batch Allocate": "Batch Allocate",
"Before deleting the project, it is recommended to clean up the resources under the project.": "Before deleting the project, it is recommended to clean up the resources under the project.",
"Belarus": "Belarus", "Belarus": "Belarus",
"Belgium": "Belgium", "Belgium": "Belgium",
"Belize": "Belize", "Belize": "Belize",
@ -1301,6 +1302,7 @@
"Invalid: CIDR Format Error(e.g. 10.10.10.0/24)": "Invalid: CIDR Format Error(e.g. 10.10.10.0/24)", "Invalid: CIDR Format Error(e.g. 10.10.10.0/24)": "Invalid: CIDR Format Error(e.g. 10.10.10.0/24)",
"Invalid: DNS Format Error(e.g. 1001:1001::)": "Invalid: DNS Format Error(e.g. 1001:1001::)", "Invalid: DNS Format Error(e.g. 1001:1001::)": "Invalid: DNS Format Error(e.g. 1001:1001::)",
"Invalid: DNS Format Error(e.g. 114.114.114.114)": "Invalid: DNS Format Error(e.g. 114.114.114.114)", "Invalid: DNS Format Error(e.g. 114.114.114.114)": "Invalid: DNS Format Error(e.g. 114.114.114.114)",
"Invalid: Domain name cannot be duplicated": "Invalid: Domain name cannot be duplicated",
"Invalid: Password must be the same with confirm password.": "Invalid: Password must be the same with confirm password.", "Invalid: Password must be the same with confirm password.": "Invalid: Password must be the same with confirm password.",
"Invalid: Please input a valid ip": "Invalid: Please input a valid ip", "Invalid: Please input a valid ip": "Invalid: Please input a valid ip",
"Invalid: Please input a valid ipv4": "Invalid: Please input a valid ipv4", "Invalid: Please input a valid ipv4": "Invalid: Please input a valid ipv4",
@ -1815,6 +1817,7 @@
"Please input {label}!": "Please input {label}!", "Please input {label}!": "Please input {label}!",
"Please make sure this IP address be available to avoid creating VM failure.": "Please make sure this IP address be available to avoid creating VM failure.", "Please make sure this IP address be available to avoid creating VM failure.": "Please make sure this IP address be available to avoid creating VM failure.",
"Please make sure this IP address be available.": "Please make sure this IP address be available.", "Please make sure this IP address be available.": "Please make sure this IP address be available.",
"Please note that when deleting a domain, all projects, users, and user groups under the domain will be deleted directly!": "Please note that when deleting a domain, all projects, users, and user groups under the domain will be deleted directly!",
"Please reasonably plan the network and subnet to which the virtual network card belongs.": "Please reasonably plan the network and subnet to which the virtual network card belongs.", "Please reasonably plan the network and subnet to which the virtual network card belongs.": "Please reasonably plan the network and subnet to which the virtual network card belongs.",
"Please save your token properly and it will be valid for {left}.": "Please save your token properly and it will be valid for {left}.", "Please save your token properly and it will be valid for {left}.": "Please save your token properly and it will be valid for {left}.",
"Please select": "Please select", "Please select": "Please select",

View File

@ -236,6 +236,7 @@
"Base Info": "기본 정보", "Base Info": "기본 정보",
"Basic Parameters": "기본 파라미터", "Basic Parameters": "기본 파라미터",
"Batch Allocate": "배치 할당", "Batch Allocate": "배치 할당",
"Before deleting the project, it is recommended to clean up the resources under the project.": "프로젝트를 삭제하기 전에 프로젝트 하위의 자원을 정리하는 것이 좋습니다.",
"Belarus": "벨라루스", "Belarus": "벨라루스",
"Belgium": "벨기에", "Belgium": "벨기에",
"Belize": "벨리즈", "Belize": "벨리즈",
@ -1300,6 +1301,7 @@
"Invalid: CIDR Format Error(e.g. 10.10.10.0/24)": "잘못됨: CIDR 형식 오류(예: 10.10.10.0/24)", "Invalid: CIDR Format Error(e.g. 10.10.10.0/24)": "잘못됨: CIDR 형식 오류(예: 10.10.10.0/24)",
"Invalid: DNS Format Error(e.g. 1001:1001::)": "잘못됨: DNS 형식 오류(예: 1001:1001::)", "Invalid: DNS Format Error(e.g. 1001:1001::)": "잘못됨: DNS 형식 오류(예: 1001:1001::)",
"Invalid: DNS Format Error(e.g. 114.114.114.114)": "잘못됨: DNS 형식 오류(예: 114.114.114.114)", "Invalid: DNS Format Error(e.g. 114.114.114.114)": "잘못됨: DNS 형식 오류(예: 114.114.114.114)",
"Invalid: Domain name cannot be duplicated": "잘못됨: 도메인 이름은 중복될 수 없습니다.",
"Invalid: Password must be the same with confirm password.": "잘못됨: 암호는 암호 확인과 동일해야 합니다.", "Invalid: Password must be the same with confirm password.": "잘못됨: 암호는 암호 확인과 동일해야 합니다.",
"Invalid: Please input a valid ip": "잘못됨: 유효한 IP를 입력하십시오", "Invalid: Please input a valid ip": "잘못됨: 유효한 IP를 입력하십시오",
"Invalid: Please input a valid ipv4": "잘못됨: 유효한 ipv4를 입력하십시오", "Invalid: Please input a valid ipv4": "잘못됨: 유효한 ipv4를 입력하십시오",
@ -1814,6 +1816,7 @@
"Please input {label}!": "{label}을(를) 입력하세요!", "Please input {label}!": "{label}을(를) 입력하세요!",
"Please make sure this IP address be available to avoid creating VM failure.": "VM 생성 실패를 피하기 위해 IP 주소가 사용 가능한지 확인하세요.", "Please make sure this IP address be available to avoid creating VM failure.": "VM 생성 실패를 피하기 위해 IP 주소가 사용 가능한지 확인하세요.",
"Please make sure this IP address be available.": "IP 주소가 사용 가능한지 확인하세요.", "Please make sure this IP address be available.": "IP 주소가 사용 가능한지 확인하세요.",
"Please note that when deleting a domain, all projects, users, and user groups under the domain will be deleted directly!": "도메인을 삭제할 때 해당 도메인 하위의 모든 프로젝트, 사용자 및 사용자 그룹이 모두 직접 삭제됩니다!",
"Please reasonably plan the network and subnet to which the virtual network card belongs.": "가상 네트워크 카드가 속한 네트워크와 서브넷을 합리적으로 계획하세요.", "Please reasonably plan the network and subnet to which the virtual network card belongs.": "가상 네트워크 카드가 속한 네트워크와 서브넷을 합리적으로 계획하세요.",
"Please save your token properly and it will be valid for {left}.": "토큰을 적절히 저장하고 {left} 동안 유효합니다.", "Please save your token properly and it will be valid for {left}.": "토큰을 적절히 저장하고 {left} 동안 유효합니다.",
"Please select": "선택하세요.", "Please select": "선택하세요.",

View File

@ -237,6 +237,7 @@
"Base Info": "基本信息", "Base Info": "基本信息",
"Basic Parameters": "基本参数", "Basic Parameters": "基本参数",
"Batch Allocate": "批量申请", "Batch Allocate": "批量申请",
"Before deleting the project, it is recommended to clean up the resources under the project.": "删除项目前,建议先清理项目下的资源!",
"Belarus": "白俄罗斯", "Belarus": "白俄罗斯",
"Belgium": "比利时", "Belgium": "比利时",
"Belize": "伯利兹城", "Belize": "伯利兹城",
@ -1301,6 +1302,7 @@
"Invalid: CIDR Format Error(e.g. 10.10.10.0/24)": "无效CIDR格式错误例如 10.10.10.0/24", "Invalid: CIDR Format Error(e.g. 10.10.10.0/24)": "无效CIDR格式错误例如 10.10.10.0/24",
"Invalid: DNS Format Error(e.g. 1001:1001::)": "无效DNS格式错误(例如: 1001:1001::)", "Invalid: DNS Format Error(e.g. 1001:1001::)": "无效DNS格式错误(例如: 1001:1001::)",
"Invalid: DNS Format Error(e.g. 114.114.114.114)": "无效DNS格式错误(例如: 114.114.114.114)", "Invalid: DNS Format Error(e.g. 114.114.114.114)": "无效DNS格式错误(例如: 114.114.114.114)",
"Invalid: Domain name cannot be duplicated": "无效,域名不可重复",
"Invalid: Password must be the same with confirm password.": "无效:密码和确认密码必须一致。", "Invalid: Password must be the same with confirm password.": "无效:密码和确认密码必须一致。",
"Invalid: Please input a valid ip": "无效请输入有效的IP", "Invalid: Please input a valid ip": "无效请输入有效的IP",
"Invalid: Please input a valid ipv4": "无效请输入有效的IPV4", "Invalid: Please input a valid ipv4": "无效请输入有效的IPV4",
@ -1815,6 +1817,7 @@
"Please input {label}!": "请输入{label}", "Please input {label}!": "请输入{label}",
"Please make sure this IP address be available to avoid creating VM failure.": "需检查此 IP 是否已被占用,否则可能创建失败。", "Please make sure this IP address be available to avoid creating VM failure.": "需检查此 IP 是否已被占用,否则可能创建失败。",
"Please make sure this IP address be available.": "需确保此IP未被占用。", "Please make sure this IP address be available.": "需确保此IP未被占用。",
"Please note that when deleting a domain, all projects, users, and user groups under the domain will be deleted directly!": "请注意,删除域时,会直接把域下的项目、用户和用户组全部删除!",
"Please reasonably plan the network and subnet to which the virtual network card belongs.": "请合理规划虚拟网卡所属的网络和子网。", "Please reasonably plan the network and subnet to which the virtual network card belongs.": "请合理规划虚拟网卡所属的网络和子网。",
"Please save your token properly and it will be valid for {left}.": "请妥善保管您的Token该Token {left} 内有效。", "Please save your token properly and it will be valid for {left}.": "请妥善保管您的Token该Token {left} 内有效。",
"Please select": "请选择", "Please select": "请选择",

View File

@ -16,6 +16,7 @@ import { inject, observer } from 'mobx-react';
import globalDomainStore from 'stores/keystone/domain'; import globalDomainStore from 'stores/keystone/domain';
import { ModalAction } from 'containers/Action'; import { ModalAction } from 'containers/Action';
import { statusTypes } from 'resources/keystone/domain'; import { statusTypes } from 'resources/keystone/domain';
import { toJS } from 'mobx';
export class Create extends ModalAction { export class Create extends ModalAction {
init() { init() {
@ -43,6 +44,11 @@ export class Create extends ModalAction {
return data; return data;
} }
get currentList() {
const { list: { data = [] } = {} } = this.store;
return data;
}
get formItems() { get formItems() {
return [ return [
{ {
@ -51,7 +57,8 @@ export class Create extends ModalAction {
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'), extra: t('The name cannot be modified after creation'),
validator: this.nameValidator,
}, },
// { // {
// name: 'domainManager', // name: 'domainManager',
@ -81,6 +88,17 @@ export class Create extends ModalAction {
]; ];
} }
nameValidator = (rule, value) => {
const data = toJS(this.currentList);
if (data.find((d) => d.name === value)) {
return Promise.reject(
new Error(t('Invalid: Domain name cannot be duplicated'))
);
}
return Promise.resolve(true);
};
onSubmit = (values) => { onSubmit = (values) => {
values.enabled = values.enabled.value; values.enabled = values.enabled.value;
return this.store.create(values); return this.store.create(values);

View File

@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import React from 'react';
import { ConfirmAction } from 'containers/Action'; import { ConfirmAction } from 'containers/Action';
import globalDomainStore from 'stores/keystone/domain'; import globalDomainStore from 'stores/keystone/domain';
@ -40,6 +40,25 @@ export default class DeleteAction extends ConfirmAction {
allowedCheckFunc = (data) => !data.enabled; allowedCheckFunc = (data) => !data.enabled;
confirmContext = (data) => {
const name = this.getName(data);
return (
<div>
<div>
{t('Are you sure to {action} (instance: {name})?', {
action: this.actionNameDisplay || this.title,
name,
})}
</div>
<div>
{t(
'Please note that when deleting a domain, all projects, users, and user groups under the domain will be deleted directly!'
)}
</div>
</div>
);
};
onSubmit = (data) => { onSubmit = (data) => {
const { id } = data; const { id } = data;
return globalDomainStore.delete({ id }); return globalDomainStore.delete({ id });

View File

@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import React from 'react';
import { ConfirmAction } from 'containers/Action'; import { ConfirmAction } from 'containers/Action';
import globalProjectStore from 'stores/keystone/project'; import globalProjectStore from 'stores/keystone/project';
@ -53,6 +53,25 @@ export default class DeleteAction extends ConfirmAction {
}); });
}; };
confirmContext = (data) => {
const name = this.getName(data);
return (
<div>
<div>
{t('Are you sure to {action} (instance: {name})?', {
action: this.actionNameDisplay || this.title,
name,
})}
</div>
<div>
{t(
'Before deleting the project, it is recommended to clean up the resources under the project.'
)}
</div>
</div>
);
};
onSubmit = (data) => { onSubmit = (data) => {
const { id } = data; const { id } = data;
return globalProjectStore.delete({ id }); return globalProjectStore.delete({ id });

View File

@ -19,8 +19,9 @@ export const getDomainOptions = (self) => {
const { domains } = globalDomainStore; const { domains } = globalDomainStore;
const domainList = (domains || []).filter( const domainList = (domains || []).filter(
(it) => (it) =>
baseDomains.indexOf(it.name) === -1 || (baseDomains.indexOf(it.name) === -1 ||
it.id === (self.item || {}).domain_id it.id === (self.item || {}).domain_id) &&
!!it.enabled
); );
return domainList.map((it) => ({ return domainList.map((it) => ({
label: it.name, label: it.name,