5555 {{ formatTraceCount(trace.local_trace_count) }}
5656 </p >
5757 </div >
58- <Badge :type =" trace .verdict " />
58+ <div class =" flex shrink-0 flex-wrap items-center gap-2" >
59+ <Badge :type =" trace .verdict " />
60+ <ButtonStyled color="red">
61+ <button
62+ :disabled =" removingTraceKeys.has(trace.detail_key)"
63+ @click =" removeGlobalTrace(trace)"
64+ >
65+ <TrashIcon aria-hidden="true" />
66+ Remove
67+ </button >
68+ </ButtonStyled >
69+ </div >
5970 </div >
6071
6172 <div v-if =" getPreviewLocalTraces(trace).length > 0" class =" flex flex-col gap-2" >
97108
98109<script setup lang="ts">
99110import type { Labrinth } from ' @modrinth/api-client'
100- import { HashIcon , ListIcon , SearchIcon } from ' @modrinth/assets'
111+ import { HashIcon , ListIcon , SearchIcon , TrashIcon } from ' @modrinth/assets'
101112import {
102113 Badge ,
103114 ButtonStyled ,
104115 EmptyState ,
105116 injectModrinthClient ,
117+ injectNotificationManager ,
106118 Pagination ,
107119 StyledInput ,
108120} from ' @modrinth/ui'
109121
110122import GlobalDetailLocalTraceCard from ' ~/components/ui/moderation/GlobalDetailLocalTraceCard.vue'
111123
112124const client = injectModrinthClient ()
125+ const { addNotification } = injectNotificationManager ()
113126const query = ref (' ' )
114127const activeQuery = ref <string | null >(null )
115128const isLoading = ref (false )
@@ -119,6 +132,7 @@ const itemsPerPage = 20
119132const localTracePreviewLimit = 10
120133const total = ref (0 )
121134const traces = ref <Labrinth .TechReview .Internal .GlobalIssueDetail []>([])
135+ const removingTraceKeys = reactive <Set <string >>(new Set ())
122136
123137const pageCount = computed (() => Math .max (Math .ceil (total .value / itemsPerPage ), 1 ))
124138const pageStart = computed (() =>
@@ -176,5 +190,37 @@ async function switchPage(page: number) {
176190 await loadTraces ()
177191}
178192
193+ async function removeGlobalTrace(trace : Labrinth .TechReview .Internal .GlobalIssueDetail ) {
194+ if (removingTraceKeys .has (trace .detail_key )) return
195+
196+ removingTraceKeys .add (trace .detail_key )
197+ try {
198+ await client .labrinth .tech_review_internal .updateGlobalIssueDetails ([
199+ { detail_key: trace .detail_key , verdict: ' pending' },
200+ ])
201+
202+ addNotification ({
203+ type: ' success' ,
204+ title: ' Global trace removed' ,
205+ text: ' The global verdict for this trace key has been removed.' ,
206+ })
207+
208+ if (traces .value .length === 1 && currentPage .value > 1 ) {
209+ currentPage .value --
210+ }
211+
212+ await loadTraces ()
213+ } catch (error ) {
214+ console .error (' Failed to remove global trace' , error )
215+ addNotification ({
216+ type: ' error' ,
217+ title: ' Failed to remove global trace' ,
218+ text: ' An error occurred while removing the global trace verdict.' ,
219+ })
220+ } finally {
221+ removingTraceKeys .delete (trace .detail_key )
222+ }
223+ }
224+
179225onMounted (loadTraces )
180226 </script >
0 commit comments