diff --git a/src/app/app.component.ts b/src/app/app.component.ts index f30ee673..0fd9de30 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -11,7 +11,6 @@ import { DebugComponent } from './debug/debug.component'; import { Router, RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router'; import { Tab } from './shared/interfaces/tab'; import { ReportData } from './shared/interfaces/report-data'; -import { HelperService } from './shared/services/helper.service'; import { ToastComponent } from './shared/components/toast/toast.component'; import { ReportComponent } from './report/report.component'; import { CloseTab } from './shared/interfaces/close-tab'; @@ -48,7 +47,6 @@ export class AppComponent implements OnInit, OnDestroy { private settingsService: SettingsService, private tabService: TabService, private router: Router, - private helperService: HelperService, private location: Location, private httpService: HttpService, private errorHandler: ErrorHandling, @@ -112,7 +110,7 @@ export class AppComponent implements OnInit, OnDestroy { } openNewCompareTab(data: CompareData): void { - const tabId = this.helperService.createCompareTabId(data.originalReport, data.runResultReport); + const tabId = this.tabService.createCompareTabId(data.originalReport, data.runResultReport); const tabIndex: number = this.tabs.findIndex((tab: Tab): boolean => tab.id == tabId); if (tabIndex == -1) { data.id = tabId; diff --git a/src/app/compare/compare-tree/compare-tree.component.ts b/src/app/compare/compare-tree/compare-tree.component.ts index d4882199..1610546d 100644 --- a/src/app/compare/compare-tree/compare-tree.component.ts +++ b/src/app/compare/compare-tree/compare-tree.component.ts @@ -1,7 +1,6 @@ import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core'; import { Report } from '../../shared/interfaces/report'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { TitleCasePipe } from '@angular/common'; import { ReportHierarchyTransformer } from '../../shared/classes/report-hierarchy-transformer'; import { ReportUtil } from '../../shared/util/report-util'; @@ -26,7 +25,7 @@ export type TreeSide = (typeof treeSideConst)[number]; templateUrl: './compare-tree.component.html', styleUrls: ['./compare-tree.component.css'], standalone: true, - imports: [ReactiveFormsModule, TitleCasePipe, FormsModule, NgSimpleFileTreeModule], + imports: [ReactiveFormsModule, FormsModule, NgSimpleFileTreeModule], }) export class CompareTreeComponent { @Output() compareEvent: EventEmitter = new EventEmitter(); diff --git a/src/app/debug/debug-tree/debug-tree.component.ts b/src/app/debug/debug-tree/debug-tree.component.ts index 6b84bdbd..86f95567 100644 --- a/src/app/debug/debug-tree/debug-tree.component.ts +++ b/src/app/debug/debug-tree/debug-tree.component.ts @@ -10,13 +10,6 @@ import { NgSimpleFileTree, NgSimpleFileTreeModule, } from 'ng-simple-file-tree'; -import { - NgbDropdown, - NgbDropdownButtonItem, - NgbDropdownItem, - NgbDropdownMenu, - NgbDropdownToggle, -} from '@ng-bootstrap/ng-bootstrap'; import { ReportHierarchyTransformer } from '../../shared/classes/report-hierarchy-transformer'; import { SimpleFileTreeUtil } from '../../shared/util/simple-file-tree-util'; import { View } from '../../shared/interfaces/view'; @@ -29,14 +22,7 @@ import { RefreshCondition } from '../../shared/interfaces/refresh-condition'; templateUrl: './debug-tree.component.html', styleUrls: ['./debug-tree.component.css'], standalone: true, - imports: [ - NgbDropdown, - NgbDropdownToggle, - NgbDropdownMenu, - NgbDropdownButtonItem, - NgbDropdownItem, - NgSimpleFileTreeModule, - ], + imports: [NgSimpleFileTreeModule], }) export class DebugTreeComponent implements OnDestroy { @ViewChild('tree') tree!: NgSimpleFileTree; diff --git a/src/app/debug/filter-side-drawer/filter-side-drawer.component.ts b/src/app/debug/filter-side-drawer/filter-side-drawer.component.ts index a270de53..fedb7276 100644 --- a/src/app/debug/filter-side-drawer/filter-side-drawer.component.ts +++ b/src/app/debug/filter-side-drawer/filter-side-drawer.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { FilterService } from './filter.service'; -import { Subscription, catchError } from 'rxjs'; +import { catchError, Subscription } from 'rxjs'; import { animate, style, transition, trigger } from '@angular/animations'; import { MatAutocompleteModule } from '@angular/material/autocomplete'; import { FormsModule } from '@angular/forms'; diff --git a/src/app/debug/table/table-settings-modal/table-settings-modal.component.ts b/src/app/debug/table/table-settings-modal/table-settings-modal.component.ts index 2df3fcbc..98827a33 100644 --- a/src/app/debug/table/table-settings-modal/table-settings-modal.component.ts +++ b/src/app/debug/table/table-settings-modal/table-settings-modal.component.ts @@ -6,7 +6,6 @@ import { SettingsService } from '../../../shared/services/settings.service'; import { catchError, Subscription } from 'rxjs'; import { ToastService } from '../../../shared/services/toast.service'; import { UploadParams } from 'src/app/shared/interfaces/upload-params'; -import { ToastComponent } from '../../../shared/components/toast/toast.component'; import { ErrorHandling } from 'src/app/shared/classes/error-handling.service'; import { OptionsSettings } from '../../../shared/interfaces/options-settings'; import { Transformation } from '../../../shared/interfaces/transformation'; @@ -18,7 +17,7 @@ import { CopyTooltipDirective } from '../../../shared/directives/copy-tooltip.di templateUrl: './table-settings-modal.component.html', styleUrls: ['./table-settings-modal.component.css'], standalone: true, - imports: [ReactiveFormsModule, ToastComponent, CopyTooltipDirective], + imports: [ReactiveFormsModule, CopyTooltipDirective], }) export class TableSettingsModalComponent implements OnDestroy { @ViewChild('modal') modal!: ElementRef; diff --git a/src/app/debug/table/table.component.ts b/src/app/debug/table/table.component.ts index d04fb777..4f7f888c 100644 --- a/src/app/debug/table/table.component.ts +++ b/src/app/debug/table/table.component.ts @@ -449,8 +449,7 @@ export class TableComponent implements OnInit, OnDestroy { const originalReport = this.transformCompareToReport(data[selectedReports[0]]); const runResultReport = this.transformCompareToReport(data[selectedReports[1]]); - const id: string = this.helperService.createCompareTabId(originalReport, runResultReport); - + const id: string = this.tabService.createCompareTabId(originalReport, runResultReport); this.tabService.openNewCompareTab({ id: id, originalReport: originalReport, diff --git a/src/app/report/edit-display/edit-display.component.ts b/src/app/report/edit-display/edit-display.component.ts index 239f276a..953209da 100644 --- a/src/app/report/edit-display/edit-display.component.ts +++ b/src/app/report/edit-display/edit-display.component.ts @@ -15,7 +15,6 @@ import { EditorComponent } from '../../editor/editor.component'; import { Report } from '../../shared/interfaces/report'; import { MetadataTableComponent } from '../../shared/components/metadata-table/metadata-table.component'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { NgClass, NgStyle, TitleCasePipe } from '@angular/common'; import { BooleanToStringPipe } from '../../shared/pipes/boolean-to-string.pipe'; import { catchError } from 'rxjs'; import { ClipboardModule } from '@angular/cdk/clipboard'; @@ -54,14 +53,11 @@ import { Router } from '@angular/router'; EditorComponent, MetadataTableComponent, BooleanToStringPipe, - NgStyle, ClipboardModule, EditFormComponent, - TitleCasePipe, DifferenceModalComponent, ToggleButtonComponent, MatTooltipModule, - NgClass, EncodingButtonComponent, FormsModule, ReportAlertMessageComponent, diff --git a/src/app/report/edit-display/encoding-button/encoding-button.component.ts b/src/app/report/edit-display/encoding-button/encoding-button.component.ts index 71be336b..ae1accc4 100644 --- a/src/app/report/edit-display/encoding-button/encoding-button.component.ts +++ b/src/app/report/edit-display/encoding-button/encoding-button.component.ts @@ -19,7 +19,7 @@ export class EncodingButtonComponent implements OnChanges { constructor(private toastService: ToastService) {} - ngOnChanges(changes: SimpleChanges) { + ngOnChanges() { this.showEncodingButton = ReportUtil.isCheckPoint(this.selectedNode) && this.selectedNode.encoding === 'Base64'; } diff --git a/src/app/shared/components/metadata-table/metadata-table.component.ts b/src/app/shared/components/metadata-table/metadata-table.component.ts index 41050551..a2450d83 100644 --- a/src/app/shared/components/metadata-table/metadata-table.component.ts +++ b/src/app/shared/components/metadata-table/metadata-table.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnChanges } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { ClipboardModule } from '@angular/cdk/clipboard'; import { MatTooltipModule } from '@angular/material/tooltip'; import { CopyTooltipDirective } from '../../directives/copy-tooltip.directive'; diff --git a/src/app/shared/interfaces/base-report.ts b/src/app/shared/interfaces/base-report.ts new file mode 100644 index 00000000..ae922099 --- /dev/null +++ b/src/app/shared/interfaces/base-report.ts @@ -0,0 +1,7 @@ +export interface BaseReport { + checked: boolean; + storageId: number; + path: string; + name: string; + description: string; +} diff --git a/src/app/shared/interfaces/report.ts b/src/app/shared/interfaces/report.ts index 437bf963..6504d426 100644 --- a/src/app/shared/interfaces/report.ts +++ b/src/app/shared/interfaces/report.ts @@ -1,27 +1,23 @@ import { Checkpoint } from './checkpoint'; +import { BaseReport } from './base-report'; -export interface Report { +export interface Report extends BaseReport { checkpoints: Checkpoint[]; correlationId: string; crudStorage: boolean; - description: string; endTime: number; estimatedMemoryUsage: number; fullPath: string; inputCheckpoint: Checkpoint; - name: string; numberOfCheckpoints: number; originalEndpointOrAbortpointForCurrentLevel?: Checkpoint; originalReport: Report; - path: string; reportFilterMatching: boolean; startTime: number; - storageId: number; stub: number; stubStrategy: string; transformation: string; variableCsv: string; - checked: boolean; storageName: string; variablesAsMap: any; // Map xml: string; // Custom for the xml representation of the report diff --git a/src/app/shared/interfaces/test-list-item.ts b/src/app/shared/interfaces/test-list-item.ts index cb44bce2..4ce77479 100644 --- a/src/app/shared/interfaces/test-list-item.ts +++ b/src/app/shared/interfaces/test-list-item.ts @@ -1,12 +1,8 @@ import { ReranReport } from './reran-report'; +import { BaseReport } from './base-report'; -export interface TestListItem { - checked: boolean; - name: string; - path: string; +export interface TestListItem extends BaseReport { fullPath?: string; - description: string; - storageId: number; variables?: string; extractedVariables?: string; reranReport?: ReranReport | null; diff --git a/src/app/shared/services/helper.service.ts b/src/app/shared/services/helper.service.ts index 37234ba4..8140d048 100644 --- a/src/app/shared/services/helper.service.ts +++ b/src/app/shared/services/helper.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Report } from '../interfaces/report'; +import { BaseReport } from '../interfaces/base-report'; @Injectable({ providedIn: 'root', @@ -9,7 +9,7 @@ export class HelperService { window.open(`api/report/download/${storage}/${exportBinary}/${exportXML}?${queryString.slice(0, -1)}`); } - getSelectedIds(reports: any[]): number[] { + getSelectedIds(reports: BaseReport[]): number[] { let copiedIds: number[] = []; for (const report of this.getSelectedReports(reports)) { copiedIds.push(report.storageId); @@ -17,11 +17,7 @@ export class HelperService { return copiedIds; } - getSelectedReports(reports: Report[]): Report[] { - return reports.filter((report: Report) => report.checked); - } - - createCompareTabId(originalReport: Report, runResultReport: Report): string { - return `${originalReport.storageId}-${runResultReport.storageId}`; + getSelectedReports(reports: BaseReport[]): BaseReport[] { + return reports.filter((report) => report.checked); } } diff --git a/src/app/shared/services/http.service.ts b/src/app/shared/services/http.service.ts index aebaac22..0e1ba7e5 100644 --- a/src/app/shared/services/http.service.ts +++ b/src/app/shared/services/http.service.ts @@ -1,7 +1,6 @@ import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; -import { map, Observable, tap } from 'rxjs'; -import { ToastService } from './toast.service'; +import { map, Observable } from 'rxjs'; import { View } from '../interfaces/view'; import { OptionsSettings } from '../interfaces/options-settings'; import { Report } from '../interfaces/report'; diff --git a/src/app/shared/services/tab.service.ts b/src/app/shared/services/tab.service.ts index 0b038db5..2e20d710 100644 --- a/src/app/shared/services/tab.service.ts +++ b/src/app/shared/services/tab.service.ts @@ -3,6 +3,7 @@ import { Observable, ReplaySubject, Subject } from 'rxjs'; import { ReportData } from '../interfaces/report-data'; import { CompareData } from '../../compare/compare-data'; import { CloseTab } from '../interfaces/close-tab'; +import { Report } from '../interfaces/report'; @Injectable({ providedIn: 'root', @@ -29,6 +30,10 @@ export class TabService { this.activeCompareTabs.set(value.id, value); } + createCompareTabId(originalReport: Report, runResultReport: Report): string { + return `${originalReport.storageId}-${runResultReport.storageId}`; + } + closeTab(value: CompareData | ReportData): void { let closeTab: CloseTab; if (this.isCompareData(value)) { diff --git a/src/app/shared/util/update-report-util.ts b/src/app/shared/util/update-report-util.ts deleted file mode 100644 index 2a6df0db..00000000 --- a/src/app/shared/util/update-report-util.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { UpdateReport } from '../interfaces/update-report'; -import { UpdateCheckpoint } from '../interfaces/update-checkpoint'; - -export const UpdateReportUtil = { - isUpdateReport(object: UpdateReport | UpdateCheckpoint): object is UpdateReport { - return !!(object as UpdateReport).name; - }, - - isUpdateCheckpoint(object: UpdateReport | UpdateCheckpoint): object is UpdateCheckpoint { - return !!(object as UpdateCheckpoint).checkpointMessage; - }, -}; diff --git a/src/app/test/test-settings-modal/test-settings-modal.component.ts b/src/app/test/test-settings-modal/test-settings-modal.component.ts index baef5b88..a3ba0408 100644 --- a/src/app/test/test-settings-modal/test-settings-modal.component.ts +++ b/src/app/test/test-settings-modal/test-settings-modal.component.ts @@ -1,6 +1,6 @@ import { Component, EventEmitter, Output, ViewChild } from '@angular/core'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; -import { UntypedFormControl, UntypedFormGroup, ReactiveFormsModule } from '@angular/forms'; +import { ReactiveFormsModule, UntypedFormControl, UntypedFormGroup } from '@angular/forms'; @Component({ selector: 'app-test-settings-modal', diff --git a/src/app/test/test-table/test-table.component.ts b/src/app/test/test-table/test-table.component.ts index f5fa635b..52e7b185 100644 --- a/src/app/test/test-table/test-table.component.ts +++ b/src/app/test/test-table/test-table.component.ts @@ -12,7 +12,6 @@ import { catchError } from 'rxjs'; import { HttpService } from '../../shared/services/http.service'; import { ErrorHandling } from '../../shared/classes/error-handling.service'; import { TabService } from '../../shared/services/tab.service'; -import { HelperService } from '../../shared/services/helper.service'; import { Report } from '../../shared/interfaces/report'; import { ReportData } from '../../shared/interfaces/report-data'; import { View } from '../../shared/interfaces/view'; @@ -31,8 +30,6 @@ import { MatRowDef, MatTable, } from '@angular/material/table'; -import { MatSortHeader } from '@angular/material/sort'; -import { TableCellShortenerPipe } from '../../shared/pipes/table-cell-shortener.pipe'; @Component({ selector: 'app-test-table', @@ -44,8 +41,6 @@ import { TableCellShortenerPipe } from '../../shared/pipes/table-cell-shortener. MatCell, MatCellDef, MatHeaderCell, - MatSortHeader, - TableCellShortenerPipe, MatHeaderCellDef, MatHeaderRow, MatHeaderRowDef, @@ -68,7 +63,6 @@ export class TestTableComponent implements OnChanges { private httpService: HttpService, private errorHandler: ErrorHandling, private tabService: TabService, - private helperService: HelperService, private testReportsService: TestReportsService, private toastService: ToastService, ) {} @@ -151,7 +145,7 @@ export class TestTableComponent implements OnChanges { compareReports(report: TestListItem): void { if (report.reranReport) { - const tabId: string = this.helperService.createCompareTabId( + const tabId: string = this.tabService.createCompareTabId( report.reranReport.originalReport, report.reranReport.runResultReport, );