]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: "Any" initiator entry appears in the Initiator table after selecting... 69550/head
authorpujashahu <pshahu@redhat.com>
Wed, 17 Jun 2026 13:07:24 +0000 (18:37 +0530)
committerpujashahu <pshahu@redhat.com>
Fri, 26 Jun 2026 19:04:48 +0000 (00:34 +0530)
Fixes: https://tracker.ceph.com/issues/77467
Signed-off-by: pujaoshahu <pshahu@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/block.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-gateway-node/nvmeof-gateway-node.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-gateway-subsystem/nvmeof-gateway-subsystem.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-list/nvmeof-initiators-list.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-list/nvmeof-initiators-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-list/nvmeof-initiators-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems/nvmeof-subsystems.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/enum/nvmeof.enum.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/models/nvmeof.ts

index b0852ec9b6b45b41a19cee951d8834a06b85f9e8..cadf130be266eae1b84c6302c0265c880fce6381 100644 (file)
@@ -97,7 +97,7 @@ import { NvmeofGatewaySubsystemComponent } from './nvmeof-gateway-subsystem/nvme
 import { NvmeofNamespaceExpandModalComponent } from './nvmeof-namespace-expand-modal/nvmeof-namespace-expand-modal.component';
 import { NvmeGatewayViewComponent } from './nvme-gateway-view/nvme-gateway-view.component';
 import { NvmeGatewayViewBreadcrumbResolver } from './nvme-gateway-view/nvme-gateway-view-breadcrumb.resolver';
-import { NvmeofGatewayNodeMode } from '~/app/shared/enum/nvmeof.enum';
+import { NvmeofGatewayNodeMode } from '~/app/shared/models/nvmeof';
 import { NvmeofGatewayNodeAddModalComponent } from './nvmeof-gateway-node/nvmeof-gateway-node-add-modal/nvmeof-gateway-node-add-modal.component';
 import { NvmeofSubsystemNamespacesListComponent } from './nvmeof-subsystem-namespaces-list/nvmeof-subsystem-namespaces-list.component';
 import { NvmeofSubsystemOverviewComponent } from './nvmeof-subsystem-overview/nvmeof-subsystem-overview.component';
index 32549d1a828fc653d30639ab608f13288ce4891f..2de89e3a478400ff7dd608f9a55ad9128dd1100d 100644 (file)
@@ -17,7 +17,6 @@ import _ from 'lodash';
 import { TableComponent } from '~/app/shared/datatable/table/table.component';
 import { HostStatus } from '~/app/shared/enum/host-status.enum';
 import { Icons } from '~/app/shared/enum/icons.enum';
-import { NvmeofGatewayNodeMode } from '~/app/shared/enum/nvmeof.enum';
 import { CdTableAction } from '~/app/shared/models/cd-table-action';
 import { CdTableColumn } from '~/app/shared/models/cd-table-column';
 import { CdTableFetchDataContext } from '~/app/shared/models/cd-table-fetch-data-context';
@@ -26,6 +25,7 @@ import { OrchestratorStatus } from '~/app/shared/models/orchestrator.interface';
 import { Permission } from '~/app/shared/models/permissions';
 
 import { Host } from '~/app/shared/models/host.interface';
+import { NvmeofGatewayNodeMode } from '~/app/shared/models/nvmeof';
 import { CephServiceSpec, CephServiceSpecUpdate } from '~/app/shared/models/service.interface';
 import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
 import { CephServiceService } from '~/app/shared/api/ceph-service.service';
index ef6575e47eab9d350577ed4c5c3c22b902477d9d..de6732de69ea24d6584ec13d8fe8337fb533f9bf 100644 (file)
@@ -7,13 +7,13 @@ import {
   NvmeofSubsystem,
   NvmeofSubsystemData,
   NvmeofSubsystemInitiator,
+  NvmeofSubsystemAuthType,
   getSubsystemAuthStatus
 } from '~/app/shared/models/nvmeof';
 import { CdTableColumn } from '~/app/shared/models/cd-table-column';
 import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
 
 import { ICON_TYPE, EMPTY_STATE_IMAGE } from '~/app/shared/enum/icons.enum';
-import { NvmeofSubsystemAuthType } from '~/app/shared/enum/nvmeof.enum';
 
 @Component({
   selector: 'cd-nvmeof-gateway-subsystem',
index 97a520db0c6a6b36f52cf0c3508002a97d2776c7..8c924ce015221ce6b45b4bf7c357c8e2d4fcd7a6 100644 (file)
@@ -1,27 +1,21 @@
-<cd-alert-panel
-  *ngIf="hasAllHostsAllowed()"
-  type="info"
-  [showTitle]="false">
-  <div cdsStack="horizontal"
-       gap="2">
+@if (hasAllHostsAllowed()) {
+  <cd-alert-panel
+    class="cds-mb-4"
+    type="warning"
+    [showTitle]="false">
     <div cdsStack="vertical"
-         gap="2">
-      <strong i18n>Host access: All hosts allowed</strong>
-      <p
-        class="cds-mb-0 cds-mt-1"
-        i18n
-      >
+         gap="1">
+      <strong class="cds-mb-1"
+              i18n>All hosts allowed</strong>
+      <p class="cds-mb-0"
+         i18n>
         Allowing all hosts grants access to every initiator on the network. Authentication is not supported in this mode, which may expose the subsystem to unauthorized access.
       </p>
     </div>
-    <a cdsLink
-       class="text-nowrap cds-ml-3 text-muted"
-       (click)="editHostAccess()"
-       i18n>Edit host access</a>
-  </div>
-</cd-alert-panel>
+  </cd-alert-panel>
+}
 
-<cd-table [data]="hasAllHostsAllowed() ? [] : initiators"
+<cd-table [data]="initiators"
           columnMode="flex"
           (fetchData)="listInitiators()"
           [columns]="initiatorColumns"
     </cd-table-actions>
   </div>
 </cd-table>
-<ng-template #dhchapTpl>
+
+<ng-template #hostNqnTpl
+             let-row="data.row">
+  {{ getDisplayedHostNqn(row.nqn) }}
+</ng-template>
+
+<ng-template #dhchapTpl
+             let-row="data.row">
   <div cdsStack="horizontal"
        gap="4">
-    {{ authStatus !== authType.NO_AUTH ? 'Yes' : 'No' }}
+    @if (row.nqn === allowAllHost) {
+      {{ '-' }}
+    } @else {
+      {{ authStatus !== authType.NO_AUTH ? yesLabel : noLabel }}
+    }
   </div>
 </ng-template>
index 2b42b8c339d855cb34a029f70846614749a484e0..05d956256cbebff42b6b02fd5c3446f505e9c184 100644 (file)
@@ -9,12 +9,13 @@ import { NvmeofService } from '~/app/shared/api/nvmeof.service';
 import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
 import { ModalService } from '~/app/shared/services/modal.service';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
+import { ALLOW_ALL_HOST } from '~/app/shared/models/nvmeof';
 
 import { NvmeofInitiatorsListComponent } from './nvmeof-initiators-list.component';
 
 const mockInitiators = [
   {
-    nqn: '*',
+    nqn: ALLOW_ALL_HOST,
     use_dhchap: false
   }
 ];
@@ -79,6 +80,8 @@ describe('NvmeofInitiatorsListComponent', () => {
     expect(component.initiators).toEqual(mockInitiators);
     expect(component.subsystem).toEqual(mockSubsystem);
     expect(component.authStatus).toBe('No authentication');
+    expect(component.initiatorColumns.length).toBe(2);
+    expect(component.getDisplayedHostNqn(ALLOW_ALL_HOST)).toBe('Any');
   }));
 
   it('should update authStatus when initiator has dhchap_key', fakeAsync(() => {
index e4f4bb14fb24e93e72b7a6449e63792a4671b850..4aa5fccb4603d06b4da065225b77f160fc11f623 100644 (file)
@@ -12,10 +12,11 @@ import { FinishedTask } from '~/app/shared/models/finished-task';
 import {
   NvmeofSubsystem,
   NvmeofSubsystemInitiator,
+  ALLOW_ALL_HOST,
+  NvmeofSubsystemAuthType,
   getSubsystemAuthStatus
 } from '~/app/shared/models/nvmeof';
 import { Permission } from '~/app/shared/models/permissions';
-import { NvmeofSubsystemAuthType } from '~/app/shared/enum/nvmeof.enum';
 import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
@@ -35,6 +36,8 @@ export class NvmeofInitiatorsListComponent implements OnInit {
 
   @ViewChild('dhchapTpl', { static: true })
   dhchapTpl: TemplateRef<any>;
+  @ViewChild('hostNqnTpl', { static: true })
+  hostNqnTpl: TemplateRef<any>;
 
   initiatorColumns: CdTableColumn[];
   tableActions: CdTableAction[];
@@ -44,6 +47,9 @@ export class NvmeofInitiatorsListComponent implements OnInit {
   subsystem: NvmeofSubsystem;
   authStatus: string;
   authType = NvmeofSubsystemAuthType;
+  allowAllHost = ALLOW_ALL_HOST;
+  yesLabel = $localize`Yes`;
+  noLabel = $localize`No`;
 
   constructor(
     public actionLabels: ActionLabelsI18n,
@@ -78,7 +84,8 @@ export class NvmeofInitiatorsListComponent implements OnInit {
     this.initiatorColumns = [
       {
         name: $localize`Host NQN`,
-        prop: 'nqn'
+        prop: 'nqn',
+        cellTemplate: this.hostNqnTpl
       },
       {
         name: $localize`DHCHAP key`,
@@ -96,8 +103,7 @@ export class NvmeofInitiatorsListComponent implements OnInit {
             queryParams: { group: this.group },
             relativeTo: this.route.parent
           }),
-        canBePrimary: (selection: CdTableSelection) => !selection.hasSelection,
-        disable: () => this.hasAllHostsAllowed()
+        canBePrimary: (selection: CdTableSelection) => !selection.hasSelection
       },
       {
         name: $localize`Edit host key`,
@@ -137,11 +143,11 @@ export class NvmeofInitiatorsListComponent implements OnInit {
   }
 
   getAllowAllHostIndex() {
-    return this.selection.selected.findIndex((selected) => selected.nqn === '*');
+    return this.selection.selected.findIndex((selected) => selected.nqn === ALLOW_ALL_HOST);
   }
 
   hasAllHostsAllowed(): boolean {
-    return this.initiators.some((initiator) => initiator.nqn === '*');
+    return this.initiators.some((initiator) => initiator.nqn === ALLOW_ALL_HOST);
   }
 
   updateSelection(selection: CdTableSelection) {
@@ -175,6 +181,10 @@ export class NvmeofInitiatorsListComponent implements OnInit {
     return this.selection.selected.map((selected) => selected.nqn);
   }
 
+  getDisplayedHostNqn(hostNqn: string): string {
+    return hostNqn === ALLOW_ALL_HOST ? $localize`Any` : hostNqn;
+  }
+
   removeInitiatorModal() {
     const hostNQNs = this.getSelectedNQNs();
     const allowAllHostIndex = this.getAllowAllHostIndex();
index 71c954d34ae0c33936d966f85078fe743e2a8cde..85590b314b5f583d17a4fe18894c3b1f0981d38c 100644 (file)
@@ -5,6 +5,7 @@ import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
 import {
   NvmeofSubsystem,
   NvmeofSubsystemInitiator,
+  NvmeofSubsystemAuthType,
   getSubsystemAuthStatus
 } from '~/app/shared/models/nvmeof';
 import { Permissions } from '~/app/shared/models/permissions';
@@ -14,7 +15,6 @@ import { CdTableFetchDataContext } from '~/app/shared/models/cd-table-fetch-data
 import { CdTableAction } from '~/app/shared/models/cd-table-action';
 
 import { Icons } from '~/app/shared/enum/icons.enum';
-import { NvmeofSubsystemAuthType } from '~/app/shared/enum/nvmeof.enum';
 import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { FinishedTask } from '~/app/shared/models/finished-task';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/nvmeof.enum.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/nvmeof.enum.ts
deleted file mode 100644 (file)
index 816613d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-export enum NvmeofSubsystemAuthType {
-  NO_AUTH = 'No authentication',
-  UNIDIRECTIONAL = 'Unidirectional',
-  BIDIRECTIONAL = 'Bi-directional'
-}
-
-export enum NvmeofGatewayNodeMode {
-  SELECTOR = 'selector',
-  DETAILS = 'details'
-}
index 11d7edab3b0e8b5a4cb33d2077b7faf0838fbf31..ccc43e7249905972ff038552c77d7066246c03bc 100644 (file)
@@ -72,12 +72,24 @@ export interface NvmeofGatewayGroup extends CephServiceSpec {
   nodeCount: number;
 }
 
+export enum NvmeofSubsystemAuthType {
+  NO_AUTH = 'No authentication',
+  UNIDIRECTIONAL = 'Unidirectional',
+  BIDIRECTIONAL = 'Bi-directional'
+}
+
+export enum NvmeofGatewayNodeMode {
+  SELECTOR = 'selector',
+  DETAILS = 'details'
+}
+
 export enum AUTHENTICATION {
   Unidirectional = 'unidirectional',
   Bidirectional = 'bidirectional',
   None = 'none'
 }
 
+export const ALLOW_ALL_HOST = '*';
 export const NO_AUTH = 'No authentication';
 
 export const HOST_TYPE = {