mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-05-18 03:24:44 -04:00
Add search event reason (#546)
This commit is contained in:
@@ -27,17 +27,24 @@ export enum SeekerSearchType {
|
||||
Replacement = 'Replacement',
|
||||
}
|
||||
|
||||
export enum SeekerSearchReason {
|
||||
Missing = 'Missing',
|
||||
QualityCutoffNotMet = 'QualityCutoffNotMet',
|
||||
CustomFormatScoreBelowCutoff = 'CustomFormatScoreBelowCutoff',
|
||||
Replacement = 'Replacement',
|
||||
}
|
||||
|
||||
export interface SearchEvent {
|
||||
id: string;
|
||||
timestamp: string;
|
||||
instanceName: string;
|
||||
arrInstanceId: string | null;
|
||||
instanceType: string | null;
|
||||
itemCount: number;
|
||||
items: string[];
|
||||
itemTitle: string;
|
||||
searchType: SeekerSearchType;
|
||||
searchReason: string | null;
|
||||
searchStatus: string | null;
|
||||
completedAt: string | null;
|
||||
grabbedItems: unknown[] | null;
|
||||
grabbedItems: string[] | null;
|
||||
cycleId: string | null;
|
||||
isDryRun: boolean;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,6 @@
|
||||
(click)="toggleExpand(item)"
|
||||
>
|
||||
<ng-icon name="tablerChartBar" class="score-row__icon" />
|
||||
<span class="score-row__title">{{ item.title }}</span>
|
||||
<span class="score-row__scores">
|
||||
<span class="score-row__current">{{ item.currentScore }}</span>
|
||||
<span class="score-row__separator">/</span>
|
||||
@@ -103,6 +102,9 @@
|
||||
class="score-row__chevron"
|
||||
/>
|
||||
</div>
|
||||
<div class="score-row__title" (click)="toggleExpand(item)">
|
||||
{{ item.title }}
|
||||
</div>
|
||||
|
||||
@if (expandedId() === item.id) {
|
||||
<div class="score-row__details">
|
||||
|
||||
@@ -115,9 +115,9 @@
|
||||
&__title {
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
padding: 0 var(--space-4) var(--space-2);
|
||||
word-break: break-word;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&__scores {
|
||||
@@ -276,12 +276,11 @@
|
||||
padding: var(--space-2) var(--space-3);
|
||||
}
|
||||
|
||||
.score-row__title {
|
||||
padding: 0 var(--space-3) var(--space-2);
|
||||
}
|
||||
|
||||
.score-row__profile {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.score-row__time {
|
||||
order: 4;
|
||||
flex-basis: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,15 +135,14 @@
|
||||
<div class="list-row">
|
||||
<div class="list-row__main">
|
||||
<ng-icon name="tablerSearch" class="list-row__icon" />
|
||||
<span class="list-row__title">
|
||||
{{ event.items.length > 0 ? event.items[0] : 'Search triggered' }}
|
||||
@if (event.items.length > 1) {
|
||||
<span class="list-row__extra">+{{ event.items.length - 1 }} more</span>
|
||||
}
|
||||
</span>
|
||||
<app-badge [severity]="searchTypeSeverity(event.searchType)" size="sm">
|
||||
{{ event.searchType }}
|
||||
</app-badge>
|
||||
@if (event.searchReason) {
|
||||
<app-badge [severity]="searchReasonSeverity(event.searchReason)" size="sm">
|
||||
{{ formatSearchReason(event.searchReason) }}
|
||||
</app-badge>
|
||||
}
|
||||
@if (event.searchStatus) {
|
||||
<app-badge [severity]="searchStatusSeverity(event.searchStatus)" size="sm">
|
||||
{{ event.searchStatus }}
|
||||
@@ -155,9 +154,14 @@
|
||||
@if (event.cycleId) {
|
||||
<span class="list-row__cycle">{{ event.cycleId.substring(0, 8) }}</span>
|
||||
}
|
||||
<span class="list-row__meta">{{ event.instanceName }}</span>
|
||||
@if (event.instanceType) {
|
||||
<app-badge [severity]="instanceTypeSeverity(event.instanceType)" size="sm" class="list-row__instance">{{ event.instanceType }}</app-badge>
|
||||
}
|
||||
<span class="list-row__time">{{ event.timestamp | date:'yyyy-MM-dd HH:mm' }}</span>
|
||||
</div>
|
||||
<div class="list-row__title">
|
||||
{{ event.itemTitle || 'Search triggered' }}
|
||||
</div>
|
||||
@if (event.grabbedItems && event.grabbedItems.length > 0) {
|
||||
<div class="list-row__detail">
|
||||
<ng-icon name="tablerDownload" class="list-row__detail-icon" />
|
||||
|
||||
@@ -264,8 +264,7 @@
|
||||
&__title {
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
padding: 0 var(--space-4) var(--space-2);
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
@@ -276,16 +275,6 @@
|
||||
margin-left: var(--space-1);
|
||||
}
|
||||
|
||||
&__meta {
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--text-tertiary);
|
||||
flex-shrink: 0;
|
||||
max-width: 150px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__cycle {
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-xs);
|
||||
@@ -306,7 +295,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1);
|
||||
padding: 0 var(--space-4) var(--space-2) calc(var(--space-4) + 18px + var(--space-2));
|
||||
padding: 0 var(--space-4) var(--space-2);
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--text-tertiary);
|
||||
}
|
||||
@@ -329,7 +318,7 @@
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.list-row__meta {
|
||||
.list-row__instance {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -350,12 +339,11 @@
|
||||
padding: var(--space-2) var(--space-3);
|
||||
}
|
||||
|
||||
.list-row__meta {
|
||||
display: none;
|
||||
.list-row__title {
|
||||
padding: 0 var(--space-3) var(--space-2);
|
||||
}
|
||||
|
||||
.list-row__time {
|
||||
order: 4;
|
||||
flex-basis: 100%;
|
||||
.list-row__instance {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { BadgeSeverity } from '@ui/badge/badge.component';
|
||||
import { AnimatedCounterComponent } from '@ui/animated-counter/animated-counter.component';
|
||||
import { SearchStatsApi } from '@core/api/search-stats.api';
|
||||
import type { SearchStatsSummary, SearchEvent, InstanceSearchStat } from '@core/models/search-stats.models';
|
||||
import { SeekerSearchType } from '@core/models/search-stats.models';
|
||||
import { SeekerSearchType, SeekerSearchReason } from '@core/models/search-stats.models';
|
||||
import { AppHubService } from '@core/realtime/app-hub.service';
|
||||
import { ToastService } from '@core/services/toast.service';
|
||||
|
||||
@@ -141,8 +141,28 @@ export class SearchesTabComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
formatGrabbedItems(items: unknown[]): string {
|
||||
return items.map((i: any) => i.Title || i.title || 'Unknown').join(', ');
|
||||
formatGrabbedItems(items: string[]): string {
|
||||
return items.join(', ');
|
||||
}
|
||||
|
||||
formatSearchReason(reason: string): string {
|
||||
switch (reason) {
|
||||
case SeekerSearchReason.Missing: return 'Missing';
|
||||
case SeekerSearchReason.QualityCutoffNotMet: return 'Cutoff Unmet';
|
||||
case SeekerSearchReason.CustomFormatScoreBelowCutoff: return 'CF Below Cutoff';
|
||||
case SeekerSearchReason.Replacement: return 'Replacement';
|
||||
default: return reason;
|
||||
}
|
||||
}
|
||||
|
||||
searchReasonSeverity(reason: string): BadgeSeverity {
|
||||
switch (reason) {
|
||||
case SeekerSearchReason.Missing: return 'error';
|
||||
case SeekerSearchReason.QualityCutoffNotMet: return 'warning';
|
||||
case SeekerSearchReason.CustomFormatScoreBelowCutoff: return 'warning';
|
||||
case SeekerSearchReason.Replacement: return 'info';
|
||||
default: return 'default';
|
||||
}
|
||||
}
|
||||
|
||||
cycleProgress(inst: InstanceSearchStat): number {
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
<div class="upgrade-row">
|
||||
<div class="upgrade-row__main">
|
||||
<ng-icon name="tablerTrendingUp" class="upgrade-row__icon" />
|
||||
<span class="upgrade-row__title">{{ upgrade.title }}</span>
|
||||
<div class="upgrade-row__scores">
|
||||
<span class="upgrade-row__score upgrade-row__score--old">{{ upgrade.previousScore }}</span>
|
||||
<ng-icon name="tablerArrowRight" class="upgrade-row__arrow" />
|
||||
@@ -47,6 +46,9 @@
|
||||
</app-badge>
|
||||
<span class="upgrade-row__time">{{ upgrade.upgradedAt | date:'yyyy-MM-dd HH:mm' }}</span>
|
||||
</div>
|
||||
<div class="upgrade-row__title">
|
||||
{{ upgrade.title }}
|
||||
</div>
|
||||
</div>
|
||||
} @empty {
|
||||
<app-empty-state
|
||||
|
||||
@@ -101,8 +101,7 @@
|
||||
&__title {
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
padding: 0 var(--space-4) var(--space-2);
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
@@ -159,13 +158,7 @@
|
||||
padding: var(--space-2) var(--space-3);
|
||||
}
|
||||
|
||||
.upgrade-row__scores {
|
||||
flex-basis: 100%;
|
||||
order: 3;
|
||||
}
|
||||
|
||||
.upgrade-row__time {
|
||||
order: 4;
|
||||
flex-basis: 100%;
|
||||
.upgrade-row__title {
|
||||
padding: 0 var(--space-3) var(--space-2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user