mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-03-25 01:24:14 -04:00
added job type filter for logs
This commit is contained in:
@@ -17,6 +17,11 @@
|
||||
[options]="categoryOptions()"
|
||||
[(value)]="selectedCategory"
|
||||
/>
|
||||
<app-select
|
||||
placeholder="All Jobs"
|
||||
[options]="jobNameOptions()"
|
||||
[(value)]="selectedJobName"
|
||||
/>
|
||||
<app-input
|
||||
placeholder="Search logs..."
|
||||
type="search"
|
||||
|
||||
@@ -49,6 +49,7 @@ export class LogsComponent implements OnInit {
|
||||
|
||||
readonly selectedLevel = signal<unknown>('');
|
||||
readonly selectedCategory = signal<unknown>('');
|
||||
readonly selectedJobName = signal<unknown>('');
|
||||
readonly searchQuery = signal('');
|
||||
readonly expandedIndex = signal<number | null>(null);
|
||||
readonly showExportMenu = signal(false);
|
||||
@@ -65,6 +66,7 @@ export class LogsComponent implements OnInit {
|
||||
let logs = this.hub.logs();
|
||||
const level = this.selectedLevel() as string;
|
||||
const category = this.selectedCategory() as string;
|
||||
const jobName = this.selectedJobName() as string;
|
||||
const query = this.searchQuery().toLowerCase();
|
||||
const runId = this.selectedJobRunId();
|
||||
|
||||
@@ -77,6 +79,9 @@ export class LogsComponent implements OnInit {
|
||||
if (category) {
|
||||
logs = logs.filter((l) => l.category === category);
|
||||
}
|
||||
if (jobName) {
|
||||
logs = logs.filter((l) => l.jobName === jobName);
|
||||
}
|
||||
if (query) {
|
||||
logs = logs.filter(
|
||||
(l) =>
|
||||
@@ -102,6 +107,14 @@ export class LogsComponent implements OnInit {
|
||||
];
|
||||
});
|
||||
|
||||
readonly jobNameOptions = computed<SelectOption[]>(() => {
|
||||
const names = new Set(this.hub.logs().map((l) => l.jobName).filter(Boolean));
|
||||
return [
|
||||
{ label: 'All Jobs', value: '' },
|
||||
...Array.from(names).sort().map((n) => ({ label: this.jobDisplayName(n!), value: n! })),
|
||||
];
|
||||
});
|
||||
|
||||
isExpandable(log: LogEntry): boolean {
|
||||
return !!(log.exception || log.jobName || log.instanceName || log.downloadClientType || log.jobRunId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user