mirror of
https://github.com/modrinth/code.git
synced 2026-08-28 02:24:56 +00:00
fix: global trace and tech review improvements (#6699)
* remaining globally safe/unsafe buttons * tweak global traces layout * deterministic local trace ordering * fix preview * ignore severity for ordering * show globally resolved traces toggle * minor frontend changes * prepr --------- Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
@@ -20,20 +20,34 @@
|
||||
heading="Failed to load global detail trace"
|
||||
/>
|
||||
<article v-else-if="trace" class="universal-card flex flex-col gap-3">
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div class="grid grid-cols-[minmax(0,1fr)_auto] items-start gap-3">
|
||||
<div class="min-w-0">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-2">
|
||||
<HashIcon class="shrink-0 text-secondary" aria-hidden="true" />
|
||||
<h2 class="m-0 min-w-0 text-lg font-semibold text-contrast">
|
||||
Trace
|
||||
<span class="break-all font-mono text-base">{{ trace.detail_key }}</span>
|
||||
</h2>
|
||||
<span
|
||||
v-if="latestLocalTrace"
|
||||
class="rounded-full border border-solid px-2.5 py-1 text-sm font-medium capitalize"
|
||||
:class="getSeverityBadgeColor(latestLocalTrace.severity)"
|
||||
>
|
||||
{{ latestLocalTrace.severity }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="latestLocalTrace" class="mt-1 flex flex-wrap gap-x-3 text-sm">
|
||||
<p class="m-0 break-all text-secondary">
|
||||
<span class="font-semibold text-contrast">Issue</span>
|
||||
{{ latestLocalTrace.issue_type }}
|
||||
</p>
|
||||
<p class="m-0 break-all text-secondary">
|
||||
<span class="font-semibold text-contrast">Path</span>
|
||||
{{ decodeTracePath(latestLocalTrace.file_path) }}
|
||||
</p>
|
||||
</div>
|
||||
<p class="m-0 mt-1 text-sm text-secondary">
|
||||
{{ pageStart }}-{{ pageEnd }} of {{ trace.local_trace_count }} local traces
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex shrink-0 flex-wrap items-center gap-2">
|
||||
<div class="flex shrink-0 flex-nowrap items-center gap-2">
|
||||
<Badge :type="trace.verdict" />
|
||||
<ButtonStyled color="red">
|
||||
<button :disabled="isRemoving" @click="removeGlobalTrace">
|
||||
@@ -45,11 +59,18 @@
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="trace.local_trace_count > localTracePageSize"
|
||||
class="flex flex-wrap items-center justify-between gap-3"
|
||||
class="flex flex-wrap items-center justify-between gap-3 border-0 border-t border-solid border-divider pt-3"
|
||||
>
|
||||
<Pagination :page="currentPage" :count="pageCount" @switch-page="switchPage" />
|
||||
<p v-if="isLoading" class="m-0 text-sm text-secondary">Loading page...</p>
|
||||
<p class="m-0 text-sm text-secondary">
|
||||
{{ pageStart }}-{{ pageEnd }} of {{ trace.local_trace_count }} local traces
|
||||
<span v-if="isLoading"> · Loading page...</span>
|
||||
</p>
|
||||
<Pagination
|
||||
v-if="trace.local_trace_count > localTracePageSize"
|
||||
:page="currentPage"
|
||||
:count="pageCount"
|
||||
@switch-page="switchPage"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="trace.local_traces.length > 0" class="flex flex-col gap-2">
|
||||
@@ -114,6 +135,29 @@ const pageStart = computed(() =>
|
||||
const pageEnd = computed(() =>
|
||||
Math.min(currentPage.value * localTracePageSize, trace.value?.local_trace_count ?? 0),
|
||||
)
|
||||
const latestLocalTrace = computed(() => trace.value?.local_traces.at(-1))
|
||||
|
||||
function decodeTracePath(path: string): string {
|
||||
try {
|
||||
return decodeURIComponent(path)
|
||||
} catch {
|
||||
return path
|
||||
}
|
||||
}
|
||||
|
||||
function getSeverityBadgeColor(severity: Labrinth.TechReview.Internal.DelphiSeverity): string {
|
||||
switch (severity) {
|
||||
case 'severe':
|
||||
return 'border-red/60 bg-highlight-red text-red'
|
||||
case 'high':
|
||||
return 'border-orange/60 bg-highlight-orange text-orange'
|
||||
case 'medium':
|
||||
return 'border-green/60 bg-highlight-green text-green'
|
||||
case 'low':
|
||||
default:
|
||||
return 'border-blue/60 bg-highlight-blue text-blue'
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchTracePage(afterDetailId: string | null) {
|
||||
return await client.labrinth.tech_review_internal.getGlobalIssueDetail({
|
||||
|
||||
Reference in New Issue
Block a user