From a012d4e065066e921008adfb999797e661afe4b3 Mon Sep 17 00:00:00 2001 From: Denys Butenko Date: Mon, 23 Sep 2024 19:29:43 +0700 Subject: [PATCH] NAS-131244: Fix Roles card on datasets is missing "System Dataset" text (#10731) --- .../dataset-management.component.html | 5 ++++- .../dataset-management.component.spec.ts | 4 +++- .../dataset-management.component.ts | 20 ++----------------- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/app/pages/datasets/components/dataset-management/dataset-management.component.html b/src/app/pages/datasets/components/dataset-management/dataset-management.component.html index bebb2aeca27..d5e0bf8dae0 100644 --- a/src/app/pages/datasets/components/dataset-management/dataset-management.component.html +++ b/src/app/pages/datasets/components/dataset-management/dataset-management.component.html @@ -119,7 +119,10 @@ [loading]="isLoading$ | async" > } - + } diff --git a/src/app/pages/datasets/components/dataset-management/dataset-management.component.spec.ts b/src/app/pages/datasets/components/dataset-management/dataset-management.component.spec.ts index 1629ac2c7e5..c5b4d35cffe 100644 --- a/src/app/pages/datasets/components/dataset-management/dataset-management.component.spec.ts +++ b/src/app/pages/datasets/components/dataset-management/dataset-management.component.spec.ts @@ -29,7 +29,9 @@ describe('DatasetsManagementComponent', () => { imports: [TreeModule, SearchInput1Component, EmptyComponent], providers: [ mockAuth(), - mockWebSocket([mockCall('systemdataset.config', {} as SystemDatasetConfig)]), + mockWebSocket([ + mockCall('systemdataset.config', { pool: 'Second Dataset' } as SystemDatasetConfig), + ]), mockProvider(DatasetTreeStore, { datasets$, error$, diff --git a/src/app/pages/datasets/components/dataset-management/dataset-management.component.ts b/src/app/pages/datasets/components/dataset-management/dataset-management.component.ts index 82946d386bc..8e186084838 100644 --- a/src/app/pages/datasets/components/dataset-management/dataset-management.component.ts +++ b/src/app/pages/datasets/components/dataset-management/dataset-management.component.ts @@ -70,7 +70,7 @@ export class DatasetsManagementComponent implements OnInit, AfterViewInit, OnDes selectedDataset$ = this.datasetStore.selectedDataset$; @HostBinding('class.details-overlay') showMobileDetails = false; isMobileView = false; - systemDataset: string; + systemDataset = toSignal(this.ws.call('systemdataset.config').pipe(map((config) => config.pool))); isLoading = true; subscription = new Subscription(); ixTreeHeaderWidth: number | null = null; @@ -154,7 +154,6 @@ export class DatasetsManagementComponent implements OnInit, AfterViewInit, OnDes ngOnInit(): void { this.datasetStore.loadDatasets(); - this.loadSystemDatasetConfig(); this.setupTree(); this.listenForRouteChanges(); this.listenForLoading(); @@ -183,21 +182,6 @@ export class DatasetsManagementComponent implements OnInit, AfterViewInit, OnDes } } - loadSystemDatasetConfig(): void { - this.ws - .call('systemdataset.config') - .pipe( - map((config) => config.pool), - untilDestroyed(this), - ) - .subscribe({ - next: (systemDataset) => { - this.systemDataset = systemDataset; - }, - error: this.handleError, - }); - } - listenForLoading(): void { this.isLoading$.pipe(untilDestroyed(this)).subscribe((isLoading) => { this.isLoading = isLoading; @@ -214,7 +198,7 @@ export class DatasetsManagementComponent implements OnInit, AfterViewInit, OnDes }; isSystemDataset(dataset: DatasetDetails): boolean { - return dataset.name.split('/').length === 1 && this.systemDataset === dataset.name; + return dataset.name.split('/').length === 1 && this.systemDataset() === dataset.name; } treeHeaderScrolled(): void {