diff --git a/src/app/components/inspection-header.component.spec.ts b/src/app/components/inspection-header.component.spec.ts index c738f86f5..7b666c4e8 100644 --- a/src/app/components/inspection-header.component.spec.ts +++ b/src/app/components/inspection-header.component.spec.ts @@ -38,8 +38,8 @@ describe('InspectionHeaderComponent', () => { expect(component.id).toEqual(id); }); - it('should not change "id" if a undefined value is provided', () => { - component.id = undefined; + it('should not change "id" if a null value is provided', () => { + component.id = null; expect(component.id).toEqual(id); }); }); diff --git a/src/app/components/inspection-header.component.ts b/src/app/components/inspection-header.component.ts index 53341e156..be7433c4d 100644 --- a/src/app/components/inspection-header.component.ts +++ b/src/app/components/inspection-header.component.ts @@ -40,7 +40,7 @@ export class InspectionHeaderComponent { private _id = ''; - @Input({ required: true }) set id(entry: string | undefined) { + @Input({ required: true }) set id(entry: string | null) { if (entry) { this._id = entry; } diff --git a/src/app/components/show-page.component.html b/src/app/components/show-page.component.html index 2baed7130..d9de8ce8c 100644 --- a/src/app/components/show-page.component.html +++ b/src/app/components/show-page.component.html @@ -1,11 +1,12 @@ - - - {{ id }} - - + + + - + + + + - \ No newline at end of file + + + \ No newline at end of file diff --git a/src/app/components/show-page.component.spec.ts b/src/app/components/show-page.component.spec.ts index fe6224b7b..335dad5b3 100644 --- a/src/app/components/show-page.component.spec.ts +++ b/src/app/components/show-page.component.spec.ts @@ -1,20 +1,14 @@ import { TestBed } from '@angular/core/testing'; import { DataRaw } from '@app/types/data'; -import { NotificationService } from '@services/notification.service'; import { ShowPageComponent } from './show-page.component'; describe('ShowPageComponent', () => { let component: ShowPageComponent; - - const mockNotificationService = { - success: jest.fn() - }; beforeEach(() => { component = TestBed.configureTestingModule({ providers: [ ShowPageComponent, - {provide: NotificationService, useValue: mockNotificationService} ] }).inject(ShowPageComponent); }); @@ -23,11 +17,6 @@ describe('ShowPageComponent', () => { expect(component).toBeTruthy(); }); - it('should call a notification success on copy', () => { - component.onCopiedTaskId(); - expect(mockNotificationService.success).toHaveBeenCalledWith('Task ID copied to clipboard'); - }); - it('should emit on refresh', () => { const refreshSpy = jest.spyOn(component.refresh, 'emit'); component.onRefresh(); diff --git a/src/app/components/show-page.component.ts b/src/app/components/show-page.component.ts index 4e9f70ac0..16aaaddb2 100644 --- a/src/app/components/show-page.component.ts +++ b/src/app/components/show-page.component.ts @@ -1,13 +1,12 @@ -import { ClipboardModule } from '@angular/cdk/clipboard'; -import { CommonModule } from '@angular/common'; -import { Component, EventEmitter, Input, Output, inject } from '@angular/core'; -import { MatButtonModule } from '@angular/material/button'; -import { MatIconModule } from '@angular/material/icon'; -import { MatSnackBar } from '@angular/material/snack-bar'; +import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'; +import { TaskOptions } from '@app/tasks/types'; +import { Field } from '@app/types/column.type'; import { ShowActionButton } from '@app/types/components/show'; import { DataRaw } from '@app/types/data'; -import { NotificationService } from '@services/notification.service'; -import { PageHeaderComponent } from './page-header.component'; +import { InspectionCardComponent } from './inspection/inspection-card.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'; @@ -20,33 +19,27 @@ span { } `], standalone: true, - providers: [ - NotificationService, - MatSnackBar - ], imports: [ - PageHeaderComponent, ShowCardComponent, ShowActionsComponent, - CommonModule, - MatIconModule, - ClipboardModule, - MatButtonModule - ] + InspectionCardComponent, + InspectionHeaderComponent, + InspectionListGridComponent, + InspectionToolbarComponent, + ], + changeDetection: ChangeDetectionStrategy.OnPush }) -export class ShowPageComponent{ +export class ShowPageComponent{ @Input({ required: true }) id: string | null = null; @Input({required: true }) data: T | null; @Input() statuses: Record = []; @Input() sharableURL: string | null = null; - @Input({ required: true }) actionsButton: ShowActionButton[]; + @Input({ required: false }) actionsButton: ShowActionButton[]; @Output() refresh = new EventEmitter(); - - #notificationService = inject(NotificationService); - - onCopiedTaskId() { - this.#notificationService.success('Task ID copied to clipboard'); - } + @Input({ required: false }) arrays: Field[]; + @Input({ required: false }) status: string | undefined; + @Input({ required: false }) fields: Field[]; + @Input({ required: false }) optionsFields: Field[]; onRefresh() { this.refresh.emit(); diff --git a/src/app/partitions/show.component.ts b/src/app/partitions/show.component.ts index 8e6f69a4c..33b898d1a 100644 --- a/src/app/partitions/show.component.ts +++ b/src/app/partitions/show.component.ts @@ -39,7 +39,8 @@ import { PartitionRaw } from './types'; TableStorageService, NotificationService, MatSnackBar, - FiltersService + FiltersService, + PartitionsInspectionService, ], imports: [ ShowPageComponent, diff --git a/src/app/sessions/services/sessions-filters.service.ts b/src/app/sessions/services/sessions-filters.service.ts index 244091ee5..ff65c514d 100644 --- a/src/app/sessions/services/sessions-filters.service.ts +++ b/src/app/sessions/services/sessions-filters.service.ts @@ -30,7 +30,7 @@ export class SessionsFiltersService implements FiltersServiceOptionsInterface = { + readonly optionsFields: Record = { [SessionTaskOptionEnumField.TASK_OPTION_ENUM_FIELD_UNSPECIFIED]: $localize`Unspecified`, [SessionTaskOptionEnumField.TASK_OPTION_ENUM_FIELD_MAX_DURATION]: $localize`Max Duration`, [SessionTaskOptionEnumField.TASK_OPTION_ENUM_FIELD_MAX_RETRIES]: $localize`Max Retries`, @@ -171,7 +171,7 @@ export class SessionsFiltersService implements FiltersServiceOptionsInterface value.toLowerCase() === filterField.toLowerCase()); return { for: 'options', index: index }; } diff --git a/src/app/tasks/services/tasks-filters.service.ts b/src/app/tasks/services/tasks-filters.service.ts index ed9e2541e..34b12f086 100644 --- a/src/app/tasks/services/tasks-filters.service.ts +++ b/src/app/tasks/services/tasks-filters.service.ts @@ -38,7 +38,7 @@ export class TasksFiltersService implements FiltersServiceOptionsInterface = { + readonly optionsFields: Record = { [TaskOptionEnumField.TASK_OPTION_ENUM_FIELD_UNSPECIFIED]: $localize`Unspecified`, [TaskOptionEnumField.TASK_OPTION_ENUM_FIELD_MAX_DURATION]: $localize`Max Duration`, [TaskOptionEnumField.TASK_OPTION_ENUM_FIELD_MAX_RETRIES]: $localize`Max Retries`, @@ -211,7 +211,7 @@ export class TasksFiltersService implements FiltersServiceOptionsInterface value.toLowerCase() === filterField.toLowerCase()); return { for: 'options', index: index }; } diff --git a/src/app/types/services/filtersService.ts b/src/app/types/services/filtersService.ts index 460ebf8ba..bcefbc7e6 100644 --- a/src/app/types/services/filtersService.ts +++ b/src/app/types/services/filtersService.ts @@ -36,7 +36,7 @@ export interface FiltersServiceInterface> extends FiltersServiceInterface { - readonly optionsField: Record; + readonly optionsFields: Record; } export interface FiltersServiceStatusesInterface {