Skip to content

Commit 74767ed

Browse files
committed
Disable buttons when not fully connected to instance
1 parent 1c00c3b commit 74767ed

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

resources/scripts/components/server/ServerConsole.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default () => {
7575
status === 'offline' ? tw`text-red-500` : (status === 'running' ? tw`text-green-500` : tw`text-yellow-500`),
7676
]}
7777
/>
78-
 {status}
78+
 {!status ? 'Connecting...' : status}
7979
</p>
8080
<p css={tw`text-xs mt-2`}>
8181
<FontAwesomeIcon icon={faMicrochip} fixedWidth css={tw`mr-1`}/> {cpu.toFixed(2)}%
@@ -112,6 +112,7 @@ export default () => {
112112
size={'xsmall'}
113113
isSecondary
114114
css={tw`mr-2`}
115+
disabled={!status}
115116
onClick={e => {
116117
e.preventDefault();
117118
sendPowerCommand('restart');

resources/scripts/components/server/StopOrKillButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const StopOrKillButton = ({ onPress }: { onPress: (action: PowerAction) => void
1616
<Button
1717
color={'red'}
1818
size={'xsmall'}
19-
disabled={status === 'offline'}
19+
disabled={!status || status === 'offline'}
2020
onClick={e => {
2121
e.preventDefault();
2222
onPress(clicked ? 'kill' : 'stop');

resources/scripts/state/server/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import schedules, { ServerScheduleStore } from '@/state/server/schedules';
88
import databases, { ServerDatabaseStore } from '@/state/server/databases';
99
import isEqual from 'react-fast-compare';
1010

11-
export type ServerStatus = 'offline' | 'starting' | 'stopping' | 'running';
11+
export type ServerStatus = 'offline' | 'starting' | 'stopping' | 'running' | null;
1212

1313
interface ServerDataStore {
1414
data?: Server;
@@ -56,7 +56,7 @@ interface ServerStatusStore {
5656
}
5757

5858
const status: ServerStatusStore = {
59-
value: 'offline',
59+
value: null,
6060
setServerStatus: action((state, payload) => {
6161
state.value = payload;
6262
}),

0 commit comments

Comments
 (0)