Skip to content

Commit 732027a

Browse files
committed
Merge branch 'pyro' of github.com:/modrinth/code into pyro
2 parents f264a6b + e8d2452 commit 732027a

File tree

11 files changed

+218
-112
lines changed

11 files changed

+218
-112
lines changed

apps/frontend/src/components/ui/servers/PanelServerActionButton.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<template>
22
<div class="flex flex-row items-center gap-2 rounded-lg">
33
<ButtonStyled v-if="showStopButton" type="standard" color="red">
4-
<button :disabled="!canTakeAction" @click="killServer">
4+
<button :disabled="!canTakeAction || isStartingDelay || disabled" @click="killServer">
55
<div class="flex gap-1">
66
<SlashIcon class="h-5 w-5" />
77
<span>{{ killButtonText }}</span>
88
</div>
99
</button>
1010
</ButtonStyled>
1111
<ButtonStyled v-if="showStopButton" type="standard" color="red">
12-
<button :disabled="!canTakeAction" @click="stopServer">
12+
<button :disabled="!canTakeAction || isStartingDelay || disabled" @click="stopServer">
1313
<div class="flex gap-1">
1414
<StopCircleIcon class="h-5 w-5" />
1515
<span>{{ stopButtonText }}</span>
@@ -18,7 +18,7 @@
1818
</ButtonStyled>
1919

2020
<ButtonStyled type="standard" color="brand">
21-
<button :disabled="!canTakeAction" @click="handleAction">
21+
<button :disabled="!canTakeAction || isStartingDelay || disabled" @click="handleAction">
2222
<div v-if="isStartingOrRestarting" class="grid place-content-center">
2323
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
2424
<path
@@ -49,6 +49,7 @@ import { ButtonStyled } from "@modrinth/ui";
4949
const props = defineProps<{
5050
isOnline: boolean;
5151
isActioning: boolean;
52+
disabled: any;
5253
}>();
5354
5455
const emit = defineEmits<{
@@ -106,9 +107,11 @@ const stopButtonText = computed(() => {
106107
});
107108
108109
const killButtonText = computed(() => {
109-
return currentState.value === ServerState.Stopping ? "Stopping..." : "Kill";
110+
return "Kill";
110111
});
111112
113+
const isStartingDelay = ref(false);
114+
112115
const updateState = (newState: ServerStateType) => {
113116
currentState.value = newState;
114117
};
@@ -122,6 +125,10 @@ const handleAction = () => {
122125
} else {
123126
updateState(ServerState.Starting);
124127
emit("action", "start");
128+
isStartingDelay.value = true;
129+
setTimeout(() => {
130+
isStartingDelay.value = false;
131+
}, 5000);
125132
}
126133
};
127134
@@ -135,7 +142,6 @@ const stopServer = () => {
135142
const killServer = () => {
136143
if (!canTakeAction.value) return;
137144
138-
updateState(ServerState.Stopping);
139145
emit("action", "kill");
140146
};
141147

apps/frontend/src/components/ui/servers/ServerIcon.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<template>
22
<client-only>
3-
<img v-if="image" no-shadow size="lg" alt="Server Icon" :class="computedClass" :src="image" />
3+
<img v-if="image" alt="Server Icon" :class="computedClass" :src="image" />
44
<img
55
v-else
6-
no-shadow
7-
size="lg"
86
alt="Server Icon"
97
:class="computedClass"
108
src="~/assets/images/servers/minecraft_server_icon.png"

apps/frontend/src/composables/pyroFetch.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ export async function usePyroFetch<T>(path: string, options: PyroFetchOptions =
8888
401: "Unauthorized",
8989
403: "Forbidden",
9090
404: "Not Found",
91+
405: "Method Not Allowed",
92+
429: "Too Many Requests",
9193
500: "Internal Server Error",
9294
502: "Bad Gateway",
9395
};

0 commit comments

Comments
 (0)