Merge "feat: support reboot action in trove instance"

This commit is contained in:
Zuul 2022-07-29 09:20:26 +00:00 committed by Gerrit Code Review
commit 6d35162f37
6 changed files with 59 additions and 8 deletions

View File

@ -1857,6 +1857,7 @@
"Reason: ": "Reason: ", "Reason: ": "Reason: ",
"Reboot": "Reboot", "Reboot": "Reboot",
"Reboot Container": "Reboot Container", "Reboot Container": "Reboot Container",
"Reboot Database Instance": "Reboot Database Instance",
"Reboot Instance": "Reboot Instance", "Reboot Instance": "Reboot Instance",
"Rebooting": "Rebooting", "Rebooting": "Rebooting",
"Rebuild": "Rebuild", "Rebuild": "Rebuild",
@ -1912,7 +1913,6 @@
"Resource Type": "Resource Type", "Resource Type": "Resource Type",
"Resource Types": "Resource Types", "Resource Types": "Resource Types",
"Resources Synced": "Resources Synced", "Resources Synced": "Resources Synced",
"Restart": "Restart",
"Restart Database Service": "Restart Database Service", "Restart Database Service": "Restart Database Service",
"Restart Policy": "Restart Policy", "Restart Policy": "Restart Policy",
"Restarting": "Restarting", "Restarting": "Restarting",

View File

@ -1857,6 +1857,7 @@
"Reason: ": "原因:", "Reason: ": "原因:",
"Reboot": "重启", "Reboot": "重启",
"Reboot Container": "重启容器", "Reboot Container": "重启容器",
"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 Database Service": "重启数据库服务", "Restart Database Service": "重启数据库服务",
"Restart Policy": "重启策略", "Restart Policy": "重启策略",
"Restarting": "重启中", "Restarting": "重启中",

View 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 });
};
}

View File

@ -16,7 +16,7 @@ import { ConfirmAction } from 'containers/Action';
import { checkStatus } from 'resources/nova/instance'; import { checkStatus } from 'resources/nova/instance';
import globalTroveInstanceStore from 'stores/trove/instances'; import globalTroveInstanceStore from 'stores/trove/instances';
export default class StartAction extends ConfirmAction { export default class RestartAction extends ConfirmAction {
get id() { get id() {
return 'restart'; return 'restart';
} }
@ -29,10 +29,6 @@ export default class StartAction extends ConfirmAction {
return true; return true;
} }
get buttonText() {
return t('Restart');
}
get actionName() { get actionName() {
return t('Restart Database Service'); return t('Restart Database Service');
} }

View File

@ -17,6 +17,7 @@ import Create from './StepCreate';
import Edit from './Edit'; import Edit from './Edit';
import Restart from './Restart'; import Restart from './Restart';
import Stop from './Stop'; import Stop from './Stop';
import Reboot from './Reboot';
const actionConfigs = { const actionConfigs = {
rowActions: { rowActions: {
@ -27,7 +28,7 @@ const actionConfigs = {
}, },
{ {
title: t('Database Instance Status'), title: t('Database Instance Status'),
actions: [Restart, Stop], actions: [Restart, Stop, Reboot],
}, },
], ],
}, },

View File

@ -95,6 +95,11 @@ export class InstancesStore extends Base {
return this.operation({ key: 'restart', id }); return this.operation({ key: 'restart', id });
} }
@action
async reboot({ id }) {
return this.operation({ key: 'reboot', id });
}
@action @action
async stop({ id }) { async stop({ id }) {
return this.submitting(this.adminClient.action(id, { stop: {} })); return this.submitting(this.adminClient.action(id, { stop: {} }));