Merge "feat: support edit for trove instance"

This commit is contained in:
Zuul 2022-07-20 12:56:21 +00:00 committed by Gerrit Code Review
commit f4e3b66a67
7 changed files with 76 additions and 9 deletions

View File

@ -550,20 +550,20 @@ const renderMenu = (t) => {
children: [
{
path: '/database/instances',
name: t('Instances'),
name: t('Database Instance'),
key: 'databaseInstances',
level: 1,
children: [
{
path: /^\/database\/instances\/detail\/.[^/]+$/,
name: t('Instance Detail'),
name: t('Database Instance Detail'),
key: 'databaseInstanceDetail',
level: 2,
routePath: '/database/instances/detail/:id',
},
{
path: '/database/instances/create',
name: t('Create Instance'),
name: t('Create Database Instance'),
key: 'databaseInstanceCreate',
level: 2,
},

View File

@ -460,6 +460,7 @@
"Create DNAT rule": "Create DNAT rule",
"Create DSCP Marking Rule": "Create DSCP Marking Rule",
"Create Database": "Create Database",
"Create Database Instance": "Create Database Instance",
"Create Default Pool": "Create Default Pool",
"Create Domain": "Create Domain",
"Create Encryption": "Create Encryption",
@ -584,6 +585,7 @@
"Data Source Type": "Data Source Type",
"Database": "Database",
"Database Instance": "Database Instance",
"Database Instance Detail": "Database Instance Detail",
"Database Name": "Database Name",
"Database Port": "Database Port",
"Database Service": "Database Service",
@ -2236,7 +2238,7 @@
"The instance deleted immediately cannot be restored": "The instance deleted immediately cannot be restored",
"The instance has been locked. If you want to do more, please unlock it first.": "The instance has been locked. If you want to do more, please unlock it first.",
"The instance is not shut down, unable to restore.": "The instance is not shut down, unable to restore.",
"The instance which is boot from volume will create snapshots for each mounted volumes": "The instance which is boot from volume will create snapshots for each mounted volumes",
"The instance which is boot from volume will create snapshots for each mounted volumes.": "The instance which is boot from volume will create snapshots for each mounted volumes.",
"The instances in the affinity group are allocated to the same physical machine as much as possible, and when there are no more physical machines to allocate, the normal allocation strategy is returned.": "The instances in the affinity group are allocated to the same physical machine as much as possible, and when there are no more physical machines to allocate, the normal allocation strategy is returned.",
"The instances in the affinity group are strictly allocated to the same physical machine. When there are no more physical machines to allocate, the allocation fails.": "The instances in the affinity group are strictly allocated to the same physical machine. When there are no more physical machines to allocate, the allocation fails.",
"The instances in the anti-affinity group are allocated to different physical machines as much as possible. When there are no more physical machines to allocate, the normal allocation strategy is returned.": "The instances in the anti-affinity group are allocated to different physical machines as much as possible. When there are no more physical machines to allocate, the normal allocation strategy is returned.",

View File

@ -460,6 +460,7 @@
"Create DNAT rule": "创建DNAT规则",
"Create DSCP Marking Rule": "创建DSCP标记规则",
"Create Database": "创建数据库",
"Create Database Instance": "创建数据库实例",
"Create Default Pool": "创建资源池",
"Create Domain": "创建域",
"Create Encryption": "创建加密",
@ -584,6 +585,7 @@
"Data Source Type": "数据源类型",
"Database": "数据库",
"Database Instance": "数据库实例",
"Database Instance Detail": "数据库实例详情",
"Database Name": "数据库名称",
"Database Port": "数据库端口",
"Database Service": "数据库服务",

View File

@ -0,0 +1,56 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { inject, observer } from 'mobx-react';
import { ModalAction } from 'containers/Action';
import globalTroveInstanceStore from 'stores/trove/instances';
export class Edit extends ModalAction {
static id = 'edit-instance';
static title = t('Edit');
static buttonText = t('Edit');
static policy = 'instance:update';
static allowed() {
return Promise.resolve(true);
}
get formItems() {
return [
{
name: 'name',
label: t('Name'),
type: 'input',
required: true,
placeholder: t('Please input name'),
},
];
}
onSubmit = (values) => {
const { name } = values;
const body = {
instance: {
name,
},
};
const { id } = this.item;
return globalTroveInstanceStore.patch({ id }, body);
};
}
export default inject('rootStore')(observer(Edit));

View File

@ -25,9 +25,9 @@ export class StepCreate extends StepAction {
this.store = globalInstancesStore;
}
static id = 'create-instance';
static id = 'create-database-instance';
static title = t('Create Instance');
static title = t('Create Database Instance');
static path = '/database/instances/create';
@ -38,7 +38,7 @@ export class StepCreate extends StepAction {
}
get name() {
return t('Create Instance');
return t('Create Database Instance');
}
get listUrl() {

View File

@ -13,13 +13,19 @@
// limitations under the License.
import Delete from './Delete';
import StepCreate from './StepCreate';
import Create from './StepCreate';
import Edit from './Edit';
const actionConfigs = {
rowActions: {
firstAction: Delete,
moreActions: [
{
action: Edit,
},
],
},
primaryActions: [StepCreate],
primaryActions: [Create],
batchActions: [Delete],
};

View File

@ -77,6 +77,7 @@ export const policyMap = {
trove: [
'instance:create',
'instance:delete',
'instance:update',
'instance:backups',
'instance:resize',
'instance:extension',