Apply node maintenance mode to servers ()

This commit is contained in:
Boy132 2022-11-07 00:02:30 +01:00 committed by GitHub
parent 4032481a4f
commit 032e4f2e31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 29 additions and 5 deletions
resources/scripts/components/server

View file

@ -8,6 +8,9 @@ import ServerRestoreSvg from '@/assets/images/server_restore.svg';
export default () => {
const status = ServerContext.useStoreState((state) => state.server.data?.status || null);
const isTransferring = ServerContext.useStoreState((state) => state.server.data?.isTransferring || false);
const isNodeUnderMaintenance = ServerContext.useStoreState(
(state) => state.server.data?.isNodeUnderMaintenance || false
);
return status === 'installing' || status === 'install_failed' ? (
<ScreenBlock
@ -21,6 +24,12 @@ export default () => {
image={ServerErrorSvg}
message={'This server is suspended and cannot be accessed.'}
/>
) : isNodeUnderMaintenance ? (
<ScreenBlock
title={'Node under Maintenance'}
image={ServerErrorSvg}
message={'The node of this server is currently under maintenance.'}
/>
) : (
<ScreenBlock
title={isTransferring ? 'Transferring' : 'Restoring from Backup'}

View file

@ -19,12 +19,15 @@ const ServerConsoleContainer = () => {
const isInstalling = ServerContext.useStoreState((state) => state.server.isInstalling);
const isTransferring = ServerContext.useStoreState((state) => state.server.data!.isTransferring);
const eggFeatures = ServerContext.useStoreState((state) => state.server.data!.eggFeatures, isEqual);
const isNodeUnderMaintenance = ServerContext.useStoreState((state) => state.server.data!.isNodeUnderMaintenance);
return (
<ServerContentBlock title={'Console'}>
{(isInstalling || isTransferring) && (
{(isNodeUnderMaintenance || isInstalling || isTransferring) && (
<Alert type={'warning'} className={'mb-4'}>
{isInstalling
{isNodeUnderMaintenance
? 'The node of this server is currently under maintenance and all actions are unavailable.'
: isInstalling
? 'This server is currently running its installation process and most actions are unavailable.'
: 'This server is currently being transferred to another node and all actions are unavailable.'}
</Alert>