103103 >
104104 Details
105105 </router-link >
106+
107+ <button
108+ @click =" showDeleteConfirmation = true"
109+ :disabled =" loading"
110+ class =" btn btn-sm btn-error"
111+ >
112+ Delete
113+ </button >
114+ </div >
115+ </div >
116+
117+ <!-- Delete Confirmation Modal -->
118+ <div v-if =" showDeleteConfirmation" class =" modal modal-open" >
119+ <div class =" modal-box" >
120+ <h3 class =" font-bold text-lg mb-4" >Delete Server</h3 >
121+ <p class =" mb-4" >
122+ Are you sure you want to delete the server <strong >{{ server.name }}</strong >?
123+ </p >
124+ <p class =" text-sm text-base-content/70 mb-6" >
125+ This action cannot be undone. The server will be removed from your configuration.
126+ </p >
127+ <div class =" modal-action" >
128+ <button
129+ @click =" showDeleteConfirmation = false"
130+ :disabled =" loading"
131+ class =" btn btn-outline"
132+ >
133+ Cancel
134+ </button >
135+ <button
136+ @click =" confirmDelete"
137+ :disabled =" loading"
138+ class =" btn btn-error"
139+ >
140+ <span v-if =" loading" class =" loading loading-spinner loading-xs" ></span >
141+ Delete Server
142+ </button >
143+ </div >
106144 </div >
107145 </div >
108146 </div >
@@ -123,6 +161,7 @@ const props = defineProps<Props>()
123161const serversStore = useServersStore ()
124162const systemStore = useSystemStore ()
125163const loading = ref (false )
164+ const showDeleteConfirmation = ref (false )
126165
127166const needsOAuth = computed (() => {
128167 // Check if server requires OAuth authentication
@@ -236,4 +275,25 @@ async function unquarantine() {
236275 loading .value = false
237276 }
238277}
278+
279+ async function confirmDelete() {
280+ loading .value = true
281+ try {
282+ await serversStore .deleteServer (props .server .name )
283+ systemStore .addToast ({
284+ type: ' success' ,
285+ title: ' Server Deleted' ,
286+ message: ` ${props .server .name } has been deleted successfully ` ,
287+ })
288+ showDeleteConfirmation .value = false
289+ } catch (error ) {
290+ systemStore .addToast ({
291+ type: ' error' ,
292+ title: ' Delete Failed' ,
293+ message: error instanceof Error ? error .message : ' Unknown error' ,
294+ })
295+ } finally {
296+ loading .value = false
297+ }
298+ }
239299 </script >
0 commit comments