Merge "feat: Add Unrescue feature to nova instance actions"
This commit is contained in:
37
src/pages/compute/containers/Instance/actions/Unrescue.jsx
Normal file
37
src/pages/compute/containers/Instance/actions/Unrescue.jsx
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import { ConfirmAction } from 'src/containers/Action';
|
||||||
|
import globalServerStore from 'src/stores/nova/instance';
|
||||||
|
import { isNotLockedOrAdmin, checkStatus } from 'resources/nova/instance';
|
||||||
|
|
||||||
|
export default class UnRescueInstanceAction extends ConfirmAction {
|
||||||
|
get id() {
|
||||||
|
return 'unrescue';
|
||||||
|
}
|
||||||
|
|
||||||
|
get title() {
|
||||||
|
return t('Unrescue');
|
||||||
|
}
|
||||||
|
|
||||||
|
get buttonText() {
|
||||||
|
return t('Unrescue');
|
||||||
|
}
|
||||||
|
|
||||||
|
get isAsyncAction() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
allowedCheckFunc = (item) => {
|
||||||
|
if (!item) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Allow Unrescue only if instance is rescue and not locked
|
||||||
|
return (
|
||||||
|
isNotLockedOrAdmin(item, this.isAdminPage) &&
|
||||||
|
checkStatus(['rescue'], item)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
onSubmit = (item) => {
|
||||||
|
const { id } = item || this.item;
|
||||||
|
return globalServerStore.unrescue({ id });
|
||||||
|
};
|
||||||
|
}
|
@@ -49,6 +49,7 @@ import ConfirmResize from './ConfirmResize';
|
|||||||
import RevertResize from './RevertResize';
|
import RevertResize from './RevertResize';
|
||||||
import ModifyTags from './ModifyTags';
|
import ModifyTags from './ModifyTags';
|
||||||
import Rescue from './Rescue';
|
import Rescue from './Rescue';
|
||||||
|
import Unrescue from './Unrescue';
|
||||||
|
|
||||||
const statusActions = [
|
const statusActions = [
|
||||||
StartAction,
|
StartAction,
|
||||||
@@ -64,6 +65,7 @@ const statusActions = [
|
|||||||
Shelve,
|
Shelve,
|
||||||
Unshelve,
|
Unshelve,
|
||||||
Rescue,
|
Rescue,
|
||||||
|
Unrescue,
|
||||||
];
|
];
|
||||||
|
|
||||||
const resourceActions = [
|
const resourceActions = [
|
||||||
|
@@ -238,7 +238,7 @@ export class ServerStore extends Base {
|
|||||||
sgItems = result.map((it) =>
|
sgItems = result.map((it) =>
|
||||||
this.mapperSecurityGroupRule(it.security_group)
|
this.mapperSecurityGroupRule(it.security_group)
|
||||||
);
|
);
|
||||||
} catch (e) { }
|
} catch (e) {}
|
||||||
this.securityGroups = {
|
this.securityGroups = {
|
||||||
data: sgItems || [],
|
data: sgItems || [],
|
||||||
interfaces: ports,
|
interfaces: ports,
|
||||||
@@ -356,6 +356,14 @@ export class ServerStore extends Base {
|
|||||||
return this.client.action(id, rescue);
|
return this.client.action(id, rescue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
async unrescue({ id }) {
|
||||||
|
const body = {
|
||||||
|
unrescue: null,
|
||||||
|
};
|
||||||
|
return this.operation({ body, id });
|
||||||
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
async softReboot({ id }) {
|
async softReboot({ id }) {
|
||||||
const body = {
|
const body = {
|
||||||
|
Reference in New Issue
Block a user