Apply node maintenance mode to servers (#4421)
This commit is contained in:
parent
4032481a4f
commit
032e4f2e31
11 changed files with 29 additions and 5 deletions
|
@ -17,6 +17,7 @@ export interface Server {
|
|||
uuid: string;
|
||||
name: string;
|
||||
node: string;
|
||||
isNodeUnderMaintenance: boolean;
|
||||
status: ServerStatus;
|
||||
sftpDetails: {
|
||||
ip: string;
|
||||
|
@ -50,6 +51,7 @@ export const rawDataToServerObject = ({ attributes: data }: FractalResponseData)
|
|||
uuid: data.uuid,
|
||||
name: data.name,
|
||||
node: data.node,
|
||||
isNodeUnderMaintenance: data.is_node_under_maintenance,
|
||||
status: data.status,
|
||||
invocation: data.invocation,
|
||||
dockerImage: data.docker_image,
|
||||
|
|
|
@ -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'}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -30,7 +30,7 @@ const server: ServerDataStore = {
|
|||
return false;
|
||||
}
|
||||
|
||||
return state.data.status !== null || state.data.isTransferring;
|
||||
return state.data.status !== null || state.data.isTransferring || state.data.isNodeUnderMaintenance;
|
||||
}),
|
||||
|
||||
isInstalling: computed((state) => {
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
<div class="row">
|
||||
@if($node->maintenance_mode)
|
||||
<div class="col-sm-12">
|
||||
<div class="info-box bg-grey">
|
||||
<div class="info-box bg-orange">
|
||||
<span class="info-box-icon"><i class="ion ion-wrench"></i></span>
|
||||
<div class="info-box-content" style="padding: 23px 10px 0;">
|
||||
<span class="info-box-text">This node is under</span>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue