From: Dnyaneshwari Talwekar Date: Tue, 24 Feb 2026 15:51:56 +0000 (+0530) Subject: mgr/dashboard : Cephfs Mirroring Entity Deselect fix X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f7c31b43180c9c16c9cbb9cc6cf1ab6ad7744482;p=ceph.git mgr/dashboard : Cephfs Mirroring Entity Deselect fix Signed-off-by: Dnyaneshwari Talwekar Fixes: https://tracker.ceph.com/issues/75140 --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-mirroring-entity/cephfs-mirroring-entity.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-mirroring-entity/cephfs-mirroring-entity.component.ts index 1fad704c9b5..8bba56da5d4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-mirroring-entity/cephfs-mirroring-entity.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-mirroring-entity/cephfs-mirroring-entity.component.ts @@ -1,9 +1,20 @@ -import { Component, OnInit, Output, EventEmitter, Input, inject } from '@angular/core'; +import { + Component, + OnInit, + OnChanges, + SimpleChanges, + Output, + EventEmitter, + Input, + inject, + ViewChild +} from '@angular/core'; import { BehaviorSubject, Observable, of } from 'rxjs'; import { catchError, map, switchMap, defaultIfEmpty } from 'rxjs/operators'; import { CdTableColumn } from '~/app/shared/models/cd-table-column'; import { CdTableSelection } from '~/app/shared/models/cd-table-selection'; +import { TableComponent } from '~/app/shared/datatable/table/table.component'; import { CdTableFetchDataContext } from '~/app/shared/models/cd-table-fetch-data-context'; import { CephfsService } from '~/app/shared/api/cephfs.service'; import { ClusterService } from '~/app/shared/api/cluster.service'; @@ -23,7 +34,8 @@ import { CephAuthUser } from '~/app/shared/models/cluster.model'; styleUrls: ['./cephfs-mirroring-entity.component.scss'], standalone: false }) -export class CephfsMirroringEntityComponent extends CdForm implements OnInit { +export class CephfsMirroringEntityComponent extends CdForm implements OnInit, OnChanges { + @ViewChild('table') table: TableComponent; columns: CdTableColumn[]; selection = new CdTableSelection(); @@ -55,6 +67,12 @@ export class CephfsMirroringEntityComponent extends CdForm implements OnInit { private taskWrapperService = inject(TaskWrapperService); private formBuilder = inject(CdFormBuilder); + ngOnChanges(changes: SimpleChanges): void { + if (changes['selectedFilesystem'] && !changes['selectedFilesystem'].firstChange) { + this.resetSelection(); + } + } + ngOnInit(): void { const noClientPrefix: ValidatorFn = (control: AbstractControl): ValidationErrors | null => { const value = (control.value ?? '').toString().trim(); @@ -200,7 +218,20 @@ export class CephfsMirroringEntityComponent extends CdForm implements OnInit { updateSelection(selection: CdTableSelection) { this.selection = selection; const selectedRow = selection?.first(); - this.entitySelected.emit(selectedRow ? selectedRow.entity : null); + if (!selectedRow) { + this.selection.selected = []; + this.entitySelected.emit(null); + return; + } + this.entitySelected.emit(selectedRow.entity); + } + + resetSelection() { + if (this.table) { + this.table.model.selectAll(false); + } + this.selection = new CdTableSelection(); + this.entitySelected.emit(null); } onCreateEntitySelected() { @@ -213,6 +244,7 @@ export class CephfsMirroringEntityComponent extends CdForm implements OnInit { this.isCreatingNewEntity = false; this.showSelectRequirementsWarning = true; this.showSelectEntityInfo = true; + this.resetSelection(); } onDismissCreateRequirementsWarning() { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts index 081c2433fb1..2ce7a5182d4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts @@ -1147,8 +1147,6 @@ export class TableComponent implements AfterViewInit, OnInit, OnChanges, OnDestr onDeselect(deselectedRowIndex: number) { this.model.selectRow(deselectedRowIndex, false); if (this.selectionType === 'single' || this.selectionType === 'singleRadio') { - this.selection.selected = []; - this.updateSelection.emit(this.selection); return; } this._toggleSelection(deselectedRowIndex, false);