Disable buttons when not fully connected to instance
This commit is contained in:
parent
1c00c3b234
commit
74767ed6a2
3 changed files with 5 additions and 4 deletions
|
@ -75,7 +75,7 @@ export default () => {
|
||||||
status === 'offline' ? tw`text-red-500` : (status === 'running' ? tw`text-green-500` : tw`text-yellow-500`),
|
status === 'offline' ? tw`text-red-500` : (status === 'running' ? tw`text-green-500` : tw`text-yellow-500`),
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
{status}
|
{!status ? 'Connecting...' : status}
|
||||||
</p>
|
</p>
|
||||||
<p css={tw`text-xs mt-2`}>
|
<p css={tw`text-xs mt-2`}>
|
||||||
<FontAwesomeIcon icon={faMicrochip} fixedWidth css={tw`mr-1`}/> {cpu.toFixed(2)}%
|
<FontAwesomeIcon icon={faMicrochip} fixedWidth css={tw`mr-1`}/> {cpu.toFixed(2)}%
|
||||||
|
@ -112,6 +112,7 @@ export default () => {
|
||||||
size={'xsmall'}
|
size={'xsmall'}
|
||||||
isSecondary
|
isSecondary
|
||||||
css={tw`mr-2`}
|
css={tw`mr-2`}
|
||||||
|
disabled={!status}
|
||||||
onClick={e => {
|
onClick={e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
sendPowerCommand('restart');
|
sendPowerCommand('restart');
|
||||||
|
|
|
@ -16,7 +16,7 @@ const StopOrKillButton = ({ onPress }: { onPress: (action: PowerAction) => void
|
||||||
<Button
|
<Button
|
||||||
color={'red'}
|
color={'red'}
|
||||||
size={'xsmall'}
|
size={'xsmall'}
|
||||||
disabled={status === 'offline'}
|
disabled={!status || status === 'offline'}
|
||||||
onClick={e => {
|
onClick={e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
onPress(clicked ? 'kill' : 'stop');
|
onPress(clicked ? 'kill' : 'stop');
|
||||||
|
|
|
@ -8,7 +8,7 @@ import schedules, { ServerScheduleStore } from '@/state/server/schedules';
|
||||||
import databases, { ServerDatabaseStore } from '@/state/server/databases';
|
import databases, { ServerDatabaseStore } from '@/state/server/databases';
|
||||||
import isEqual from 'react-fast-compare';
|
import isEqual from 'react-fast-compare';
|
||||||
|
|
||||||
export type ServerStatus = 'offline' | 'starting' | 'stopping' | 'running';
|
export type ServerStatus = 'offline' | 'starting' | 'stopping' | 'running' | null;
|
||||||
|
|
||||||
interface ServerDataStore {
|
interface ServerDataStore {
|
||||||
data?: Server;
|
data?: Server;
|
||||||
|
@ -56,7 +56,7 @@ interface ServerStatusStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
const status: ServerStatusStore = {
|
const status: ServerStatusStore = {
|
||||||
value: 'offline',
|
value: null,
|
||||||
setServerStatus: action((state, payload) => {
|
setServerStatus: action((state, payload) => {
|
||||||
state.value = payload;
|
state.value = payload;
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in a new issue