Merge "fix: Notify users to Confirm/Revert after VM resize"
This commit is contained in:
@@ -14,8 +14,10 @@
|
||||
|
||||
import React from 'react';
|
||||
import { observer, inject } from 'mobx-react';
|
||||
import { reaction } from 'mobx';
|
||||
import ImageType from 'components/ImageType';
|
||||
import Base from 'containers/List';
|
||||
import Notify from 'components/Notify';
|
||||
import {
|
||||
instanceStatus,
|
||||
transitionStatus,
|
||||
@@ -29,6 +31,8 @@ import { ServerGroupInstanceStore } from 'stores/skyline/server-group-instance';
|
||||
import actionConfigs from './actions';
|
||||
|
||||
export class Instance extends Base {
|
||||
notifiedInstances = new Set();
|
||||
|
||||
init() {
|
||||
if (!this.inDetailPage) {
|
||||
this.store = globalServerStore;
|
||||
@@ -114,6 +118,45 @@ export class Instance extends Base {
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
super.componentDidMount();
|
||||
|
||||
this.dispose = reaction(
|
||||
() => {
|
||||
const { data } = this.store.list;
|
||||
return data && data.length > 0
|
||||
? data.filter((instance) => instance.status === 'verify_resize')
|
||||
: [];
|
||||
},
|
||||
(verifyResizeInstances) => {
|
||||
if (verifyResizeInstances.length === 0) return;
|
||||
verifyResizeInstances.forEach((instance) => {
|
||||
if (!this.notifiedInstances.has(instance.id)) {
|
||||
Notify.warn(
|
||||
t(
|
||||
`Waiting for user to Confirm/Revert the Resize for\n ${instance.id}`
|
||||
)
|
||||
);
|
||||
this.notifiedInstances.add(instance.id);
|
||||
}
|
||||
});
|
||||
},
|
||||
{
|
||||
fireImmediately: false,
|
||||
delay: 100,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
super.componentWillUnmount();
|
||||
|
||||
if (this.dispose) {
|
||||
this.dispose();
|
||||
}
|
||||
this.notifiedInstances.clear();
|
||||
}
|
||||
|
||||
getColumns() {
|
||||
const columns = [
|
||||
{
|
||||
|
@@ -56,7 +56,7 @@ export const stableStatus = {
|
||||
paused: t('Paused'),
|
||||
error: t('Error'),
|
||||
resize: t('Resizing or Migrating'),
|
||||
verify_resize: t('Resizing or Migrating'),
|
||||
verify_resize: t('Verify Resize/Migrate'),
|
||||
revert_resize: t('Revert Resize/Migrate'),
|
||||
// reboot: t('Reboot'),
|
||||
// hard_reboot: t('Hard Reboot'),
|
||||
|
Reference in New Issue
Block a user