diff --git a/src/app/components/inspect-list.component.css b/src/app/components/inspect-list.component.css new file mode 100644 index 000000000..58c18f4c1 --- /dev/null +++ b/src/app/components/inspect-list.component.css @@ -0,0 +1,35 @@ +.header { + display: flex; + align-items: center; + justify-content: space-between; +} + +.no-data { + text-align: center; + margin: 1rem; + font-style: italic; +} + +button { + width: fit-content; +} + +.item { + display: flex; + justify-content: space-between; + align-items: center; + margin: 0.5rem; +} + +mat-divider { + margin-right: 0.5rem; +} + +mat-toolbar { + padding: 1rem; +} + +mat-card { + max-height: 25vh; + overflow-y: auto; +} \ No newline at end of file diff --git a/src/app/components/inspect-list.component.html b/src/app/components/inspect-list.component.html index ad81f9c4a..f7ac7bdb7 100644 --- a/src/app/components/inspect-list.component.html +++ b/src/app/components/inspect-list.component.html @@ -10,13 +10,17 @@ } @else { @for(item of list; track item) {
- @if(redirectLink) { - - } @else { - {{item}} - } + @if(redirectLink) { + + } +
@if(!$last) { diff --git a/src/app/components/inspect-list.component.spec.ts b/src/app/components/inspect-list.component.spec.ts index 762e822c9..7491ce57b 100644 --- a/src/app/components/inspect-list.component.spec.ts +++ b/src/app/components/inspect-list.component.spec.ts @@ -1,4 +1,7 @@ +import { Clipboard } from '@angular/cdk/clipboard'; import { TestBed } from '@angular/core/testing'; +import { IconsService } from '@services/icons.service'; +import { NotificationService } from '@services/notification.service'; import { InspectListComponent } from './inspect-list.component'; describe('InspectListComponent', () => { @@ -11,10 +14,21 @@ describe('InspectListComponent', () => { '2-root-1-0': list[2] }; + const mockClipboard = { + copy: jest.fn() + }; + + const mockNotificationService = { + success: jest.fn(), + }; + beforeEach(() => { component = TestBed.configureTestingModule({ providers: [ - InspectListComponent + InspectListComponent, + IconsService, + { provide: Clipboard, useValue: mockClipboard }, + { provide: NotificationService, useValue: mockNotificationService }, ] }).inject(InspectListComponent); component.list = list; @@ -60,4 +74,20 @@ describe('InspectListComponent', () => { }); }); }); + + describe('copy', () => { + const id = 'id'; + + beforeEach(() => { + component.copy(id); + }); + + it('should copy the provided Id', () => { + expect(mockClipboard.copy).toHaveBeenCalledWith(id); + }); + + it('should notify on copy', () => { + expect(mockNotificationService.success).toHaveBeenCalled(); + }); + }); }); \ No newline at end of file diff --git a/src/app/components/inspect-list.component.ts b/src/app/components/inspect-list.component.ts index dcc6c4513..804d3b570 100644 --- a/src/app/components/inspect-list.component.ts +++ b/src/app/components/inspect-list.component.ts @@ -1,9 +1,13 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { Clipboard } from '@angular/cdk/clipboard'; +import { ChangeDetectionStrategy, Component, Input, inject } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; import { MatDivider } from '@angular/material/divider'; +import { MatIconModule } from '@angular/material/icon'; import { MatToolbarModule } from '@angular/material/toolbar'; import { Params, RouterModule } from '@angular/router'; +import { IconsService } from '@services/icons.service'; +import { NotificationService } from '@services/notification.service'; /** * The inspect list component provide a way to display lists inside a Mat-Card. @@ -21,42 +25,18 @@ import { Params, RouterModule } from '@angular/router'; MatButtonModule, RouterModule, MatDivider, + MatIconModule, ], - styles: [` - .header { - display: flex; - align-items: center; - justify-content: space-between; - } - - .no-data { - text-align: center; - margin: 1rem; - font-style: italic; - } - - button { - width: fit-content; - } - - .item { - width: 100%; - margin: 0.5rem; - } - - mat-divider { - margin-right: 0.5rem; - } - - mat-toolbar { - padding: 1rem; - } - `] + styleUrl: 'inspect-list.component.css', }) export class InspectListComponent { private _list: string[] = []; private _queryParams: Params; + private readonly iconsService = inject(IconsService); + private readonly notificationService = inject(NotificationService); + readonly clipboard = inject(Clipboard); + @Input({ required: true }) set list(entries: string[] | undefined) { if (entries) { this._list = entries; @@ -83,4 +63,13 @@ export class InspectListComponent { get queryParams(): Params { return this._queryParams; } + + getIcon(name: string) { + return this.iconsService.getIcon(name); + } + + copy(value: string) { + this.clipboard.copy(value); + this.notificationService.success('Id copied'); + } } \ No newline at end of file diff --git a/src/app/components/inspection/inspection-card.component.html b/src/app/components/inspection/inspection-card.component.html index 714b1c4d0..a4bb4f56e 100644 --- a/src/app/components/inspection/inspection-card.component.html +++ b/src/app/components/inspection/inspection-card.component.html @@ -1,3 +1,8 @@ +@if (optionsFields && !fields) { + + Options + +} \ No newline at end of file diff --git a/src/app/components/inspection/inspection-card.component.ts b/src/app/components/inspection/inspection-card.component.ts index ab0981e43..a0f7367dd 100644 --- a/src/app/components/inspection/inspection-card.component.ts +++ b/src/app/components/inspection/inspection-card.component.ts @@ -1,5 +1,6 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; import { MatCardModule } from '@angular/material/card'; +import { MatToolbarModule } from '@angular/material/toolbar'; import { TaskOptions } from '@app/tasks/types'; import { Field } from '@app/types/column.type'; import { DataRaw, Status } from '@app/types/data'; @@ -11,7 +12,8 @@ import { InspectionComponent } from './inspection.component'; standalone: true, imports: [ MatCardModule, - InspectionComponent + InspectionComponent, + MatToolbarModule, ], styleUrl: '../../../inspections.css', changeDetection: ChangeDetectionStrategy.OnPush diff --git a/src/app/components/inspection/inspection.component.html b/src/app/components/inspection/inspection.component.html index b42f72c44..2341e21a9 100644 --- a/src/app/components/inspection/inspection.component.html +++ b/src/app/components/inspection/inspection.component.html @@ -1,11 +1,6 @@ - +@if (fields) { + +} @if(optionsFields) { - - - - Options - - - - + } \ No newline at end of file diff --git a/src/app/components/inspection/inspection.component.ts b/src/app/components/inspection/inspection.component.ts index 82820482a..23706f4b7 100644 --- a/src/app/components/inspection/inspection.component.ts +++ b/src/app/components/inspection/inspection.component.ts @@ -1,5 +1,6 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; import { MatExpansionModule } from '@angular/material/expansion'; +import { MatToolbarModule } from '@angular/material/toolbar'; import { TaskOptions } from '@app/tasks/types'; import { Field } from '@app/types/column.type'; import { DataRaw, Status } from '@app/types/data'; @@ -12,6 +13,7 @@ import { InspectionObjectComponent } from './inspection-object.component'; imports: [ InspectionObjectComponent, MatExpansionModule, + MatToolbarModule, ], changeDetection: ChangeDetectionStrategy.OnPush, styleUrl: '../../../inspections.css', diff --git a/src/app/components/show-page.component.css b/src/app/components/show-page.component.css new file mode 100644 index 000000000..9a240258e --- /dev/null +++ b/src/app/components/show-page.component.css @@ -0,0 +1,5 @@ +section { + display: flex; + flex-direction: column; + gap: 1rem; +} \ No newline at end of file diff --git a/src/app/components/show-page.component.html b/src/app/components/show-page.component.html index 7002a3e48..3f5f71134 100644 --- a/src/app/components/show-page.component.html +++ b/src/app/components/show-page.component.html @@ -7,8 +7,11 @@ -@if (data) { - - - -} +
+ @if (data) { + + + + + } +
\ No newline at end of file diff --git a/src/app/components/show-page.component.ts b/src/app/components/show-page.component.ts index 9d392b7bf..1a1a53845 100644 --- a/src/app/components/show-page.component.ts +++ b/src/app/components/show-page.component.ts @@ -8,21 +8,13 @@ import { InspectionJsonComponent } from './inspection/inspection-json.component' import { InspectionListGridComponent } from './inspection/inspection-list-grid.component'; import { InspectionHeaderComponent } from './inspection-header.component'; import { InspectionToolbarComponent } from './inspection-toolbar.component'; -import { ShowActionsComponent } from './show-actions.component'; -import { ShowCardComponent } from './show-card.component'; @Component({ selector: 'app-show-page', templateUrl: './show-page.component.html', - styles: [` -span { - font-style: italic; -} - `], + styleUrl: 'show-page.component.css', standalone: true, imports: [ - ShowCardComponent, - ShowActionsComponent, InspectionCardComponent, InspectionHeaderComponent, InspectionListGridComponent, diff --git a/src/app/dashboard/components/lines/applications-line.component.ts b/src/app/dashboard/components/lines/applications-line.component.ts index 15b87535c..e3d9dfeee 100644 --- a/src/app/dashboard/components/lines/applications-line.component.ts +++ b/src/app/dashboard/components/lines/applications-line.component.ts @@ -55,6 +55,7 @@ export class ApplicationsLineComponent extends DashboardLineTableComponent { }, { key: 'createdBy', + link: 'tasks', + }, + { + key: 'payloadId', + link: 'results', }, { key: 'createdAt', @@ -46,7 +51,7 @@ export class TasksInspectionService extends InspectionService { type: 'date' }, { - key: 'fetchedAt', + key: 'receivedAt', type: 'date' }, { @@ -54,7 +59,7 @@ export class TasksInspectionService extends InspectionService { type: 'date' }, { - key: 'receivedAt', + key: 'fetchedAt', type: 'date' }, { diff --git a/src/app/types/components/dashboard-line-table.ts b/src/app/types/components/dashboard-line-table.ts index f6a21a33d..e9b88ccd8 100644 --- a/src/app/types/components/dashboard-line-table.ts +++ b/src/app/types/components/dashboard-line-table.ts @@ -64,7 +64,6 @@ export abstract class DashboardLineTableComponent