Merge "feat: support reboot action in trove instance"
This commit is contained in:
commit
6d35162f37
@ -1857,6 +1857,7 @@
|
||||
"Reason: ": "Reason: ",
|
||||
"Reboot": "Reboot",
|
||||
"Reboot Container": "Reboot Container",
|
||||
"Reboot Database Instance": "Reboot Database Instance",
|
||||
"Reboot Instance": "Reboot Instance",
|
||||
"Rebooting": "Rebooting",
|
||||
"Rebuild": "Rebuild",
|
||||
@ -1912,7 +1913,6 @@
|
||||
"Resource Type": "Resource Type",
|
||||
"Resource Types": "Resource Types",
|
||||
"Resources Synced": "Resources Synced",
|
||||
"Restart": "Restart",
|
||||
"Restart Database Service": "Restart Database Service",
|
||||
"Restart Policy": "Restart Policy",
|
||||
"Restarting": "Restarting",
|
||||
|
@ -1857,6 +1857,7 @@
|
||||
"Reason: ": "原因:",
|
||||
"Reboot": "重启",
|
||||
"Reboot Container": "重启容器",
|
||||
"Reboot Database Instance": "重启数据库实例",
|
||||
"Reboot Instance": "重启云主机",
|
||||
"Rebooting": "重启中",
|
||||
"Rebuild": "重建",
|
||||
@ -1912,7 +1913,6 @@
|
||||
"Resource Type": "资源类型",
|
||||
"Resource Types": "资源类型",
|
||||
"Resources Synced": "资源同步",
|
||||
"Restart": "重启",
|
||||
"Restart Database Service": "重启数据库服务",
|
||||
"Restart Policy": "重启策略",
|
||||
"Restarting": "重启中",
|
||||
|
49
src/pages/database/containers/Instances/actions/Reboot.jsx
Normal file
49
src/pages/database/containers/Instances/actions/Reboot.jsx
Normal file
@ -0,0 +1,49 @@
|
||||
// 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 { ConfirmAction } from 'containers/Action';
|
||||
import { checkStatus } from 'resources/nova/instance';
|
||||
import globalTroveInstanceStore from 'stores/trove/instances';
|
||||
|
||||
export default class RebootAction extends ConfirmAction {
|
||||
get id() {
|
||||
return 'reboot';
|
||||
}
|
||||
|
||||
get title() {
|
||||
return t('Reboot Database Instance');
|
||||
}
|
||||
|
||||
get isDanger() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get actionName() {
|
||||
return t('Reboot Database Instance');
|
||||
}
|
||||
|
||||
get isAsyncAction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
policy = 'instance:reboot';
|
||||
|
||||
allowedCheckFunc = (item) =>
|
||||
checkStatus(['active', 'shutoff', 'shutdown'], item);
|
||||
|
||||
onSubmit = (item) => {
|
||||
const { id } = item || this.item;
|
||||
return globalTroveInstanceStore.reboot({ id });
|
||||
};
|
||||
}
|
@ -16,7 +16,7 @@ import { ConfirmAction } from 'containers/Action';
|
||||
import { checkStatus } from 'resources/nova/instance';
|
||||
import globalTroveInstanceStore from 'stores/trove/instances';
|
||||
|
||||
export default class StartAction extends ConfirmAction {
|
||||
export default class RestartAction extends ConfirmAction {
|
||||
get id() {
|
||||
return 'restart';
|
||||
}
|
||||
@ -29,10 +29,6 @@ export default class StartAction extends ConfirmAction {
|
||||
return true;
|
||||
}
|
||||
|
||||
get buttonText() {
|
||||
return t('Restart');
|
||||
}
|
||||
|
||||
get actionName() {
|
||||
return t('Restart Database Service');
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import Create from './StepCreate';
|
||||
import Edit from './Edit';
|
||||
import Restart from './Restart';
|
||||
import Stop from './Stop';
|
||||
import Reboot from './Reboot';
|
||||
|
||||
const actionConfigs = {
|
||||
rowActions: {
|
||||
@ -27,7 +28,7 @@ const actionConfigs = {
|
||||
},
|
||||
{
|
||||
title: t('Database Instance Status'),
|
||||
actions: [Restart, Stop],
|
||||
actions: [Restart, Stop, Reboot],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -95,6 +95,11 @@ export class InstancesStore extends Base {
|
||||
return this.operation({ key: 'restart', id });
|
||||
}
|
||||
|
||||
@action
|
||||
async reboot({ id }) {
|
||||
return this.operation({ key: 'reboot', id });
|
||||
}
|
||||
|
||||
@action
|
||||
async stop({ id }) {
|
||||
return this.submitting(this.adminClient.action(id, { stop: {} }));
|
||||
|
Loading…
Reference in New Issue
Block a user