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 >
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";
4949const props = defineProps <{
5050 isOnline: boolean ;
5151 isActioning: boolean ;
52+ disabled: any ;
5253}>();
5354
5455const emit = defineEmits <{
@@ -106,9 +107,11 @@ const stopButtonText = computed(() => {
106107});
107108
108109const killButtonText = computed (() => {
109- return currentState . value === ServerState . Stopping ? " Stopping... " : " Kill" ;
110+ return " Kill" ;
110111});
111112
113+ const isStartingDelay = ref (false );
114+
112115const 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 = () => {
135142const killServer = () => {
136143 if (! canTakeAction .value ) return ;
137144
138- updateState (ServerState .Stopping );
139145 emit (" action" , " kill" );
140146};
141147
0 commit comments