mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-31 20:09:11 +00:00
refactor(settings): polish settings UI
This commit is contained in:
committed by
Carlos Valente
parent
f0c284b708
commit
24be49ef66
@@ -3,6 +3,7 @@ import { useRef } from 'react';
|
||||
|
||||
import Button from '../../../../common/components/buttons/Button';
|
||||
import Dialog from '../../../../common/components/dialog/Dialog';
|
||||
import Info from '../../../../common/components/info/Info';
|
||||
import { useElectronEvent } from '../../../../common/hooks/useElectronEvent';
|
||||
import { isLocalhost, isOntimeCloud } from '../../../../externals';
|
||||
import * as Panel from '../../panel-utils/PanelUtils';
|
||||
@@ -23,44 +24,50 @@ export default function ShutdownPanel() {
|
||||
<>
|
||||
<Panel.Header>Shutdown Ontime</Panel.Header>
|
||||
<Panel.Section>
|
||||
{isOntimeCloud ? (
|
||||
<Panel.Highlight>
|
||||
For security reasons, shutting down the server must be done from the Ontime Cloud dashboard.
|
||||
</Panel.Highlight>
|
||||
) : (
|
||||
<Panel.Paragraph>
|
||||
This will shutdown the Ontime server. <br />
|
||||
The runtime state will be lost, but your project is kept for next time.
|
||||
</Panel.Paragraph>
|
||||
)}
|
||||
<Button variant='destructive' onClick={handler.open} disabled={!(isElectron || isLocalhost)}>
|
||||
Shutdown ontime
|
||||
</Button>
|
||||
{!canShutdown && (
|
||||
<Panel.Description>Note: Ontime can only be shutdown from the machine it is running in.</Panel.Description>
|
||||
)}
|
||||
<Dialog
|
||||
isOpen={isOpen}
|
||||
title='Shutdown Ontime'
|
||||
showCloseButton
|
||||
onClose={handler.close}
|
||||
bodyElements={
|
||||
<Panel.Paragraph>
|
||||
This will shutdown the Ontime server. <br /> Are you sure?
|
||||
</Panel.Paragraph>
|
||||
}
|
||||
footerElements={
|
||||
<>
|
||||
<Button ref={cancelRef} onClick={handler.close} variant='ghosted-white'>
|
||||
Cancel
|
||||
<Panel.Card>
|
||||
<Panel.SubHeader>Shutdown</Panel.SubHeader>
|
||||
<Panel.Divider />
|
||||
{isOntimeCloud ? (
|
||||
<Info type='warning'>
|
||||
For security reasons, shutting down the server must be done from the Ontime Cloud dashboard.
|
||||
</Info>
|
||||
) : (
|
||||
<Panel.Field
|
||||
title='Stop the Ontime server'
|
||||
description='The runtime state will be lost, but your project is kept for next time.'
|
||||
/>
|
||||
)}
|
||||
{!isOntimeCloud && (
|
||||
<Panel.Section>
|
||||
<Button variant='destructive' onClick={handler.open} disabled={!canShutdown}>
|
||||
Shutdown ontime
|
||||
</Button>
|
||||
<Button variant='destructive' onClick={sendShutdown} disabled={!canShutdown}>
|
||||
Shutdown
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
{!canShutdown && <Panel.Description>Only available from the machine running Ontime.</Panel.Description>}
|
||||
</Panel.Section>
|
||||
)}
|
||||
</Panel.Card>
|
||||
</Panel.Section>
|
||||
<Dialog
|
||||
isOpen={isOpen}
|
||||
title='Shutdown Ontime'
|
||||
showCloseButton
|
||||
onClose={handler.close}
|
||||
bodyElements={
|
||||
<Panel.Paragraph>
|
||||
This will shutdown the Ontime server. <br /> Are you sure?
|
||||
</Panel.Paragraph>
|
||||
}
|
||||
footerElements={
|
||||
<>
|
||||
<Button ref={cancelRef} onClick={handler.close} variant='ghosted-white'>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button variant='destructive' onClick={sendShutdown} disabled={!canShutdown}>
|
||||
Shutdown
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user