From aaada17fe3fc128e651113c27ee3d0ac1093b4c7 Mon Sep 17 00:00:00 2001 From: Steven Zhang Date: Mon, 26 Oct 2026 11:23:03 -0700 Subject: [PATCH 1/2] Auto fix lint issues --- .../app/common/api/risks-http.service.ts | 8 +- .../app/common/services/containers.service.ts | 4 +- .../websrc/app/common/types/common/common.ts | 35 +----- .../app/common/types/settings/settings.ts | 7 +- .../app/frame/header/header.component.ts | 5 +- ...-report-assets-images-table.component.html | 20 +++- ...port-assets-platforms-table.component.html | 10 +- ...risk-view-report-impact-col.component.html | 4 +- .../container-details.component.html | 4 +- .../node-details/node-details.component.html | 42 ++++--- .../registries-communication.service.ts | 103 ++++++++++-------- .../add-registry-dialog.component.ts | 4 +- .../registries-table.component.ts | 14 ++- .../registry-details-dialog.component.html | 9 +- .../registry-details-os-cell.spec.ts | 5 +- .../registry-details-os-cell.ts | 6 +- .../registry-details-table.component.ts | 5 +- ...etails-vulnerabilities-cell.component.html | 1 - ...-details-vulnerabilities-cell.component.ts | 14 ++- .../registry-details.component.ts | 3 +- .../group-domain-role.component.html | 8 +- .../config-form/config-form.component.html | 7 +- .../config-form/config-form.component.ts | 8 +- .../saml/saml-form/saml-form.component.html | 16 ++- .../vulnerabilities.component.ts | 7 +- .../vulnerabilities.service.ts | 7 +- .../vulnerability-items-charts.component.ts | 9 +- ...rability-items-table-filter.component.html | 97 +++++++++++++---- ...nerability-items-table-filter.component.ts | 6 +- 29 files changed, 298 insertions(+), 170 deletions(-) diff --git a/admin/webapp/websrc/app/common/api/risks-http.service.ts b/admin/webapp/websrc/app/common/api/risks-http.service.ts index 505548f9f..9aeb95cd9 100644 --- a/admin/webapp/websrc/app/common/api/risks-http.service.ts +++ b/admin/webapp/websrc/app/common/api/risks-http.service.ts @@ -145,12 +145,16 @@ export class RisksHttpService { ); } - postAssetsViewData(queryId: string, lastModifiedTime: number, includeNoVulAssets: boolean = false) { + postAssetsViewData( + queryId: string, + lastModifiedTime: number, + includeNoVulAssets: boolean = false + ) { return GlobalVariable.http.patch( PathConstant.ASSETS_VULS_URL, { last_modified_timestamp: lastModifiedTime, - include_no_vul_assets: includeNoVulAssets + include_no_vul_assets: includeNoVulAssets, }, { params: { queryId: queryId } } ); diff --git a/admin/webapp/websrc/app/common/services/containers.service.ts b/admin/webapp/websrc/app/common/services/containers.service.ts index 952cba75b..87cbb7bd5 100644 --- a/admin/webapp/websrc/app/common/services/containers.service.ts +++ b/admin/webapp/websrc/app/common/services/containers.service.ts @@ -317,7 +317,9 @@ export class ContainersService { ].join(','); const csvRows = vulnerabilities.map(vul => { - const { image_name, tags } = this.splitImageNameAndTag(vul.workload_image); + const { image_name, tags } = this.splitImageNameAndTag( + vul.workload_image + ); const digest = vul.workload_image_digest || ''; const workload_name = vul.workload_name || ''; const namespace = vul.workload_domain || ''; diff --git a/admin/webapp/websrc/app/common/types/common/common.ts b/admin/webapp/websrc/app/common/types/common/common.ts index 918f18e64..90ca38523 100644 --- a/admin/webapp/websrc/app/common/types/common/common.ts +++ b/admin/webapp/websrc/app/common/types/common/common.ts @@ -5,34 +5,20 @@ export type PolicyMode = 'Discover' | 'Monitor' | 'Protect' | ''; export type ProfileBaseline = 'basic' | 'zero-drift'; export type ScannerAutoscaleStrategy = - | 'immediate' - | 'delayed' - | 'disabled' - | 'n/a' - | ''; + 'immediate' | 'delayed' | 'disabled' | 'n/a' | ''; export type VulnerabilityView = - | 'all' - | 'containers' - | 'infrastructure' - | 'registry'; + 'all' | 'containers' | 'infrastructure' | 'registry'; export type DataOps = 'add' | 'edit' | 'delete'; export type VulQueryPublishedTimeOption = 'all' | 'before' | 'after'; export type VulQueryPackageTypeOption = - | 'all' - | 'withFix' - | 'withoutFix' - | 'withFixAll'; + 'all' | 'withFix' | 'withoutFix' | 'withFixAll'; export type VulQuerySeverityTypeOption = - | 'all' - | 'critical' - | 'high' - | 'medium' - | 'low'; + 'all' | 'critical' | 'high' | 'medium' | 'low'; export type VulQueryScoreTypeOption = 'v2' | 'v3'; @@ -47,21 +33,12 @@ export type VulQueryOrderByColumnOption = | 'impact'; export type ImageQueryOrderByColumnOption = - | 'repository' - | 'imageid' - | 'createdat' - | 'os' - | 'size' - | 'scannedat'; + 'repository' | 'imageid' | 'createdat' | 'os' | 'size' | 'scannedat'; export type OrderByOption = 'desc' | 'asc'; export type LastModifiedDateOption = - | 'all' - | 'twoweeks' - | 'onemonth' - | 'threemonths' - | 'custom'; + 'all' | 'twoweeks' | 'onemonth' | 'threemonths' | 'custom'; export type CfgType = 'ground' | 'user_created' | ''; diff --git a/admin/webapp/websrc/app/common/types/settings/settings.ts b/admin/webapp/websrc/app/common/types/settings/settings.ts index f1f8ac558..ea8fb8d7d 100644 --- a/admin/webapp/websrc/app/common/types/settings/settings.ts +++ b/admin/webapp/websrc/app/common/types/settings/settings.ts @@ -220,12 +220,7 @@ export interface Role { } export type ApikeyExpiration = - | 'never' - | 'onehour' - | 'oneday' - | 'onemonth' - | 'oneyear' - | 'hours'; + 'never' | 'onehour' | 'oneday' | 'onemonth' | 'oneyear' | 'hours'; export interface Apikey { expiration_type: ApikeyExpiration; diff --git a/admin/webapp/websrc/app/frame/header/header.component.ts b/admin/webapp/websrc/app/frame/header/header.component.ts index 63537185f..7772bba91 100644 --- a/admin/webapp/websrc/app/frame/header/header.component.ts +++ b/admin/webapp/websrc/app/frame/header/header.component.ts @@ -146,9 +146,8 @@ export class HeaderComponent implements OnInit, OnDestroy { this.email = this.localStorage.get( GlobalConstant.LOCAL_STORAGE_TOKEN )?.emailHash; - this.username = this.localStorage.get( - GlobalConstant.LOCAL_STORAGE_TOKEN - )?.token?.username; + this.username = this.localStorage.get(GlobalConstant.LOCAL_STORAGE_TOKEN) + ?.token?.username; const role = this.localStorage.get(GlobalConstant.LOCAL_STORAGE_TOKEN) ?.token?.role; this.displayRole = role diff --git a/admin/webapp/websrc/app/routes/components/security-risk-printable-report/assets-view-report/assets-view-report-assets-images-table/assets-view-report-assets-images-table.component.html b/admin/webapp/websrc/app/routes/components/security-risk-printable-report/assets-view-report/assets-view-report-assets-images-table/assets-view-report-assets-images-table.component.html index d1e14277b..d4d3efd9d 100644 --- a/admin/webapp/websrc/app/routes/components/security-risk-printable-report/assets-view-report/assets-view-report-assets-images-table/assets-view-report-assets-images-table.component.html +++ b/admin/webapp/websrc/app/routes/components/security-risk-printable-report/assets-view-report/assets-view-report-assets-images-table/assets-view-report-assets-images-table.component.html @@ -61,20 +61,26 @@ " [attr.data-index]="i"> -
{{ reportPage === 'vulnerabilities' ? image.name : image.image_name }}
-
+
+ {{ reportPage === 'vulnerabilities' ? image.name : image.image_name }} +
+
{{ image.digest }}
+ class="print-cell" + style="width: 10%">
{{ image.cvedb_version }}
{{ 'scan.report.gridHeader.CVE_DB_LAST_UPDATED' | translate }}
- {{ image.cvedb_create_time | date:'yyyy-MM-dd HH:mm:ss' }} + {{ image.cvedb_create_time | date: 'yyyy-MM-dd HH:mm:ss' }}
- + diff --git a/admin/webapp/websrc/app/routes/components/security-risk-printable-report/assets-view-report/assets-view-report-assets-platforms-table/assets-view-report-assets-platforms-table.component.html b/admin/webapp/websrc/app/routes/components/security-risk-printable-report/assets-view-report/assets-view-report-assets-platforms-table/assets-view-report-assets-platforms-table.component.html index bc1f532a8..d15d1adc5 100644 --- a/admin/webapp/websrc/app/routes/components/security-risk-printable-report/assets-view-report/assets-view-report-assets-platforms-table/assets-view-report-assets-platforms-table.component.html +++ b/admin/webapp/websrc/app/routes/components/security-risk-printable-report/assets-view-report/assets-view-report-assets-platforms-table/assets-view-report-assets-platforms-table.component.html @@ -80,7 +80,10 @@
0 @@ -103,7 +106,10 @@
{{ diff --git a/admin/webapp/websrc/app/routes/components/security-risk-printable-report/risks-view-report/risk-view-report-impact-col/risk-view-report-impact-col.component.html b/admin/webapp/websrc/app/routes/components/security-risk-printable-report/risks-view-report/risk-view-report-impact-col/risk-view-report-impact-col.component.html index 56243eca6..00e8d0a6a 100644 --- a/admin/webapp/websrc/app/routes/components/security-risk-printable-report/risks-view-report/risk-view-report-impact-col/risk-view-report-impact-col.component.html +++ b/admin/webapp/websrc/app/routes/components/security-risk-printable-report/risks-view-report/risk-view-report-impact-col/risk-view-report-impact-col.component.html @@ -31,7 +31,9 @@
{{ image.display_name }}
-
+
{{ image.digest }}
diff --git a/admin/webapp/websrc/app/routes/containers/container-details/container-details.component.html b/admin/webapp/websrc/app/routes/containers/container-details/container-details.component.html index 40153f76e..c7aae15a8 100644 --- a/admin/webapp/websrc/app/routes/containers/container-details/container-details.component.html +++ b/admin/webapp/websrc/app/routes/containers/container-details/container-details.component.html @@ -60,7 +60,9 @@ class="me-3" (click)="toggleAcceptedVuls()" mat-icon-button> - {{ !showAcceptedVuls ? 'visibility' : 'visibility_off' }} + {{ + !showAcceptedVuls ? 'visibility' : 'visibility_off' + }}
diff --git a/admin/webapp/websrc/app/routes/registries/registries-communication.service.ts b/admin/webapp/websrc/app/routes/registries/registries-communication.service.ts index 832767f2f..cd52fb0b7 100644 --- a/admin/webapp/websrc/app/routes/registries/registries-communication.service.ts +++ b/admin/webapp/websrc/app/routes/registries/registries-communication.service.ts @@ -1,5 +1,12 @@ import { Injectable } from '@angular/core'; -import { BehaviorSubject, combineLatest, Observable, Subject, timer, of } from 'rxjs'; +import { + BehaviorSubject, + combineLatest, + Observable, + Subject, + timer, + of, +} from 'rxjs'; import { RepoGetResponse, Summary } from '@common/types'; import { filter, @@ -10,7 +17,7 @@ import { tap, takeWhile, take, - catchError + catchError, } from 'rxjs/operators'; import { RegistriesService } from '@services/registries.service'; import { FormControl } from '@angular/forms'; @@ -41,44 +48,30 @@ export class RegistriesCommunicationService { registryDetails$ = combineLatest([ this.selectedRegistry$.pipe(filter(summary => summary !== undefined)), this.refreshDetailsSubject$.pipe(startWith(null)), - ]) - .pipe( - switchMap(([summary]) => { - if (!!summary!.isAllView) { - return this.registriesService.getAllScannedImagesSummary().pipe( - map(allScannedImagesSummary => ({ - selectedRegistry: summary!, - isAllView: true, - isFedRepo: false, - allScannedImagesSummary, - })), - finalize(() => { - if (this.refreshingDetailsSubject$.value) { - this.refreshingDetailsSubject$.next(false); - } - }) - ); - } else if (!!summary!.isFedRepo) { - return this.registriesService - .getFederatedRepoScanRegistrySummary(summary!.name) - .pipe( - map(repositories => ({ - selectedRegistry: summary!, - isAllView: false, - isFedRepo: true, - repositories, - })), - finalize(() => { - if (this.refreshingDetailsSubject$.value) { - this.refreshingDetailsSubject$.next(false); - } - }) - ); - } else { - return this.registriesService.getRepo(summary!.name).pipe( + ]).pipe( + switchMap(([summary]) => { + if (!!summary!.isAllView) { + return this.registriesService.getAllScannedImagesSummary().pipe( + map(allScannedImagesSummary => ({ + selectedRegistry: summary!, + isAllView: true, + isFedRepo: false, + allScannedImagesSummary, + })), + finalize(() => { + if (this.refreshingDetailsSubject$.value) { + this.refreshingDetailsSubject$.next(false); + } + }) + ); + } else if (!!summary!.isFedRepo) { + return this.registriesService + .getFederatedRepoScanRegistrySummary(summary!.name) + .pipe( map(repositories => ({ selectedRegistry: summary!, isAllView: false, + isFedRepo: true, repositories, })), finalize(() => { @@ -87,9 +80,22 @@ export class RegistriesCommunicationService { } }) ); - } - }) - ) as Observable; + } else { + return this.registriesService.getRepo(summary!.name).pipe( + map(repositories => ({ + selectedRegistry: summary!, + isAllView: false, + repositories, + })), + finalize(() => { + if (this.refreshingDetailsSubject$.value) { + this.refreshingDetailsSubject$.next(false); + } + }) + ); + } + }) + ) as Observable; private startingScanSubject$ = new BehaviorSubject(false); startingScan$ = this.startingScanSubject$.asObservable(); @@ -141,11 +147,19 @@ export class RegistriesCommunicationService { } } - refreshUntilFound(expectedName: string, maxAttempts = 20, intervalMs = 500): void { + refreshUntilFound( + expectedName: string, + maxAttempts = 20, + intervalMs = 500 + ): void { timer(0, intervalMs) .pipe( take(maxAttempts), - switchMap(() => this.registriesService.getRegistries().pipe(catchError(() => of({ summarys: [] })))), + switchMap(() => + this.registriesService + .getRegistries() + .pipe(catchError(() => of({ summarys: [] }))) + ), tap(({ summarys }) => { const found = summarys.some(s => s.name === expectedName); if (found) { @@ -153,7 +167,10 @@ export class RegistriesCommunicationService { this.refreshRegistriesSubject$.next(true); } }), - takeWhile(({ summarys }) => !summarys.some(s => s.name === expectedName), true) + takeWhile( + ({ summarys }) => !summarys.some(s => s.name === expectedName), + true + ) ) .subscribe(); } diff --git a/admin/webapp/websrc/app/routes/registries/registries-table/add-registry-dialog/add-registry-dialog.component.ts b/admin/webapp/websrc/app/routes/registries/registries-table/add-registry-dialog/add-registry-dialog.component.ts index 8f424dade..912bb264f 100644 --- a/admin/webapp/websrc/app/routes/registries/registries-table/add-registry-dialog/add-registry-dialog.component.ts +++ b/admin/webapp/websrc/app/routes/registries/registries-table/add-registry-dialog/add-registry-dialog.component.ts @@ -175,7 +175,9 @@ export class AddRegistryDialogComponent implements OnInit, AfterViewChecked { .subscribe({ complete: () => { this.dialogRef.close(true); - this.registriesCommunicationService.refreshUntilFound(body.config.name); + this.registriesCommunicationService.refreshUntilFound( + body.config.name + ); }, error: ({ error }: { error: ErrorResponse }) => { this.notificationService.open( diff --git a/admin/webapp/websrc/app/routes/registries/registries-table/registries-table.component.ts b/admin/webapp/websrc/app/routes/registries/registries-table/registries-table.component.ts index c16378ed7..5ca54b1dc 100644 --- a/admin/webapp/websrc/app/routes/registries/registries-table/registries-table.component.ts +++ b/admin/webapp/websrc/app/routes/registries/registries-table/registries-table.component.ts @@ -239,12 +239,16 @@ export class RegistriesTableComponent implements OnInit, OnChanges { onSelectionChanged(params: GridReadyEvent): void { if (params.api.getSelectedNodes().length > 0) { const newSelectedRegistry = params.api.getSelectedNodes()[0].data; - const currentSelectedRegistry = this.registriesCommunicationService.selectedRegistry; + const currentSelectedRegistry = + this.registriesCommunicationService.selectedRegistry; this.registriesCommunicationService.setSelectedRegistry( newSelectedRegistry ); - if(!currentSelectedRegistry || currentSelectedRegistry.name !== newSelectedRegistry.name) { + if ( + !currentSelectedRegistry || + currentSelectedRegistry.name !== newSelectedRegistry.name + ) { this.registriesCommunicationService.detailFilter.setValue(''); } } @@ -419,7 +423,11 @@ export class RegistriesTableComponent implements OnInit, OnChanges { }); dialog.afterClosed().subscribe(change => { if (change) { - if (isEdit && this.gridApi && this.gridApi.getSelectedNodes().length > 0) { + if ( + isEdit && + this.gridApi && + this.gridApi.getSelectedNodes().length > 0 + ) { this.registriesCommunicationService.setSelectedRegistry( this.gridApi.getSelectedNodes()[0].data ); diff --git a/admin/webapp/websrc/app/routes/registries/registry-details/registry-details-table/registry-details-dialog/registry-details-dialog.component.html b/admin/webapp/websrc/app/routes/registries/registry-details/registry-details-table/registry-details-dialog/registry-details-dialog.component.html index f662bfc36..042962f0c 100644 --- a/admin/webapp/websrc/app/routes/registries/registry-details/registry-details-table/registry-details-dialog/registry-details-dialog.component.html +++ b/admin/webapp/websrc/app/routes/registries/registry-details/registry-details-table/registry-details-dialog/registry-details-dialog.component.html @@ -1,10 +1,11 @@
-

+

{{ registryTitle }}

diff --git a/admin/webapp/websrc/app/routes/settings/configuration/config-form/config-form.component.html b/admin/webapp/websrc/app/routes/settings/configuration/config-form/config-form.component.html index ca2d7e0b6..90dc236ab 100644 --- a/admin/webapp/websrc/app/routes/settings/configuration/config-form/config-form.component.html +++ b/admin/webapp/websrc/app/routes/settings/configuration/config-form/config-form.component.html @@ -12,7 +12,12 @@ *appDisplayControl="'write_config'" [appearance]="'mat-raised-button'" [color]="'primary'" - [disabled]="hasPendingCertificateEdit || !configForm.valid || (!configForm.dirty && !hasWebhookValueChanged) || submittingForm" + [disabled]=" + hasPendingCertificateEdit || + !configForm.valid || + (!configForm.dirty && !hasWebhookValueChanged) || + submittingForm + " [loading]="submittingForm" [text]="'setting.SUBMIT' | translate" [type]="'submit'"> diff --git a/admin/webapp/websrc/app/routes/settings/configuration/config-form/config-form.component.ts b/admin/webapp/websrc/app/routes/settings/configuration/config-form/config-form.component.ts index 83d2fc20b..ff0d71097 100644 --- a/admin/webapp/websrc/app/routes/settings/configuration/config-form/config-form.component.ts +++ b/admin/webapp/websrc/app/routes/settings/configuration/config-form/config-form.component.ts @@ -82,8 +82,7 @@ export class ConfigFormComponent implements OnInit, OnDestroy { private updatePendingCertificateEdit(): void { const formValue = this.configForm?.getRawValue() as any; - const certs = - formValue?.tls?.cacerts ?? this._config?.tls?.cacerts ?? []; + const certs = formValue?.tls?.cacerts ?? this._config?.tls?.cacerts ?? []; this.hasPendingCertificateEdit = Array.isArray(certs) && certs.some(c => c?.isEditable === true); } @@ -92,7 +91,10 @@ export class ConfigFormComponent implements OnInit, OnDestroy { const formValue = this.configForm?.getRawValue() as any; const currentWebhooks = cloneDeep(formValue?.webhooks ?? []); - if (!Array.isArray(currentWebhooks) || !Array.isArray(this.originalWebhooks)) { + if ( + !Array.isArray(currentWebhooks) || + !Array.isArray(this.originalWebhooks) + ) { this.hasWebhookValueChanged = false; return; } diff --git a/admin/webapp/websrc/app/routes/settings/saml/saml-form/saml-form.component.html b/admin/webapp/websrc/app/routes/settings/saml/saml-form/saml-form.component.html index d037b4549..195267f06 100644 --- a/admin/webapp/websrc/app/routes/settings/saml/saml-form/saml-form.component.html +++ b/admin/webapp/websrc/app/routes/settings/saml/saml-form/saml-form.component.html @@ -98,7 +98,9 @@ class="mb-4" mat-icon-button type="button"> - {{ sloCertVisible ? 'visibility' : 'visibility_off' }} + {{ + sloCertVisible ? 'visibility' : 'visibility_off' + }}
@@ -125,7 +127,9 @@ class="mb-4" mat-icon-button type="button"> - {{ sloKeyVisible ? 'visibility' : 'visibility_off' }} + {{ + sloKeyVisible ? 'visibility' : 'visibility_off' + }}
@@ -152,7 +156,9 @@ class="mb-4" mat-icon-button type="button"> - {{ x509CertVisible[i] ? 'visibility' : 'visibility_off' }} + {{ + x509CertVisible[i] ? 'visibility' : 'visibility_off' + }} @@ -173,7 +179,9 @@ class="mb-4" mat-icon-button type="button"> - {{ x509CertVisible[i] ? 'visibility' : 'visibility_off' }} + {{ + x509CertVisible[i] ? 'visibility' : 'visibility_off' + }}