Merge "feat: Add Unrescue feature to nova instance actions"

This commit is contained in:
Zuul
2025-09-28 05:44:59 +00:00
committed by Gerrit Code Review
3 changed files with 48 additions and 1 deletions

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

View File

@@ -49,6 +49,7 @@ import ConfirmResize from './ConfirmResize';
import RevertResize from './RevertResize';
import ModifyTags from './ModifyTags';
import Rescue from './Rescue';
import Unrescue from './Unrescue';
const statusActions = [
StartAction,
@@ -64,6 +65,7 @@ const statusActions = [
Shelve,
Unshelve,
Rescue,
Unrescue,
];
const resourceActions = [

View File

@@ -356,6 +356,14 @@ export class ServerStore extends Base {
return this.client.action(id, rescue);
}
@action
async unrescue({ id }) {
const body = {
unrescue: null,
};
return this.operation({ body, id });
}
@action
async softReboot({ id }) {
const body = {