feat: support create instance in server group list page

1. Support create instance in server group row actions
2. Set server-group-select required when create instance by server group

Change-Id: I2a5f5de985a32a0394fe9501275519c568a4c9ab
This commit is contained in:
Jingwei.Zhang 2022-07-08 11:08:35 +08:00
parent 5eaa2d8ff4
commit 281b176981
3 changed files with 47 additions and 0 deletions

View File

@ -96,6 +96,12 @@ export class SystemStep extends Base {
}));
}
get serverGroupRequired() {
const { more } = this.state;
const { servergroup } = this.locationParams;
return !!servergroup && more;
}
get inputHelp() {
const { input = '' } = this.state;
const maxCount = 1000;
@ -370,6 +376,7 @@ export class SystemStep extends Base {
hidden: !more,
data: this.serverGroups,
isLoading: this.serverGroupStore.list.isLoading,
required: this.serverGroupRequired,
extra: t(
'Using server groups, you can create cloud hosts on the same/different physical nodes as much as possible to meet the affinity/non-affinity requirements of business applications.'
),

View File

@ -0,0 +1,34 @@
// Copyright 2022 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 CreateInstance from 'pages/compute/containers/Instance/actions/StepCreate';
export class StepCreate extends CreateInstance {
static id = 'instance-create';
static title = t('Create Instance');
static path(item) {
return `/compute/instance/create?servergroup=${item.id}`;
}
static policy = 'os_compute_api:servers:create';
static allowed() {
return true;
}
}
export default inject('rootStore')(observer(StepCreate));

View File

@ -14,10 +14,16 @@
import Create from './Create';
import Delete from './Delete';
import CreateInstance from './CreateInstance';
const actionConfigs = {
rowActions: {
firstAction: Delete,
moreActions: [
{
action: CreateInstance,
},
],
},
batchActions: [Delete],
primaryActions: [Create],