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 " @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 " @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 " @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
@@ -106,9 +106,11 @@ const stopButtonText = computed(() => {
106106});
107107
108108const killButtonText = computed (() => {
109- return currentState . value === ServerState . Stopping ? " Stopping... " : " Kill" ;
109+ return " Kill" ;
110110});
111111
112+ const isStartingDelay = ref (false );
113+
112114const updateState = (newState : ServerStateType ) => {
113115 currentState .value = newState ;
114116};
@@ -122,6 +124,10 @@ const handleAction = () => {
122124 } else {
123125 updateState (ServerState .Starting );
124126 emit (" action" , " start" );
127+ isStartingDelay .value = true ;
128+ setTimeout (() => {
129+ isStartingDelay .value = false ;
130+ }, 5000 );
125131 }
126132};
127133
@@ -135,7 +141,6 @@ const stopServer = () => {
135141const killServer = () => {
136142 if (! canTakeAction .value ) return ;
137143
138- updateState (ServerState .Stopping );
139144 emit (" action" , " kill" );
140145};
141146
0 commit comments