From: Afreen Misbah Date: Wed, 25 Feb 2026 09:58:12 +0000 (+0530) Subject: mgr/dashboard: Fix auth logic in subsystem and remove traffic encryption columns X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F67480%2Fhead;p=ceph.git mgr/dashboard: Fix auth logic in subsystem and remove traffic encryption columns Signed-off-by: Afreen Misbah --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-form/nvmeof-initiators-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-form/nvmeof-initiators-form.component.spec.ts index 89d7d6a794b..7d50e1a8c56 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-form/nvmeof-initiators-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-form/nvmeof-initiators-form.component.spec.ts @@ -65,7 +65,7 @@ describe('NvmeofInitiatorsFormComponent', () => { describe('should test form', () => { beforeEach(() => { nvmeofService = TestBed.inject(NvmeofService); - spyOn(nvmeofService, 'addInitiators').and.stub(); + spyOn(nvmeofService, 'addSubsystemInitiators').and.stub(); }); it('should be creating request correctly', () => { @@ -75,13 +75,15 @@ describe('NvmeofInitiatorsFormComponent', () => { const payload: any = { hostType: HOST_TYPE.SPECIFIC, - addedHosts: ['host1'] + hostDchapKeyList: [{ dhchap_key: '', host_nqn: 'host1' }], + gw_group: 'test-group' }; component.onSubmit(payload); - expect(nvmeofService.addInitiators).toHaveBeenCalledWith(subsystemNQN, { - host_nqn: 'host1', - gw_group: 'test-group' + expect(nvmeofService.addSubsystemInitiators).toHaveBeenCalledWith(subsystemNQN, { + allow_all: false, + gw_group: 'test-group', + hosts: [{ dhchap_key: '', host_nqn: 'host1' }] }); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-form/nvmeof-initiators-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-form/nvmeof-initiators-form.component.ts index 3876795c10f..d1c0d1fcb12 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-form/nvmeof-initiators-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-form/nvmeof-initiators-form.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { Step } from 'carbon-components-angular'; -import { InitiatorRequest, NvmeofService } from '~/app/shared/api/nvmeof.service'; +import { NvmeofService, SubsystemInitiatorRequest } from '~/app/shared/api/nvmeof.service'; import { FinishedTask } from '~/app/shared/models/finished-task'; import { HOST_TYPE, NvmeofSubsystemInitiator } from '~/app/shared/models/nvmeof'; import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service'; @@ -68,8 +68,9 @@ export class NvmeofInitiatorsFormComponent implements OnInit { this.isSubmitLoading = true; const taskUrl = `nvmeof/initiator/add`; - const request: InitiatorRequest = { - host_nqn: payload.hostType === HOST_TYPE.ALL ? '*' : payload.addedHosts.join(','), + const request: SubsystemInitiatorRequest = { + allow_all: payload.hostType === HOST_TYPE.ALL, + hosts: payload.hostType === HOST_TYPE.SPECIFIC ? payload.hostDchapKeyList : [], gw_group: this.group }; this.taskWrapperService @@ -77,7 +78,7 @@ export class NvmeofInitiatorsFormComponent implements OnInit { task: new FinishedTask(taskUrl, { nqn: this.subsystemNQN }), - call: this.nvmeofService.addInitiators(this.subsystemNQN, request) + call: this.nvmeofService.addSubsystemInitiators(this.subsystemNQN, request) }) .subscribe({ error: () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-list/nvmeof-initiators-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-list/nvmeof-initiators-list.component.spec.ts index 7152385931c..2b42b8c339d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-list/nvmeof-initiators-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-list/nvmeof-initiators-list.component.spec.ts @@ -15,7 +15,7 @@ import { NvmeofInitiatorsListComponent } from './nvmeof-initiators-list.componen const mockInitiators = [ { nqn: '*', - use_dhchap: '' + use_dhchap: false } ]; @@ -82,17 +82,18 @@ describe('NvmeofInitiatorsListComponent', () => { })); it('should update authStatus when initiator has dhchap_key', fakeAsync(() => { - const initiatorsWithKey = [{ nqn: 'nqn1', use_dhchap: 'key1' }]; + const initiatorsWithKey = [{ nqn: 'nqn1', use_dhchap: true }]; spyOn(TestBed.inject(NvmeofService), 'getInitiators').and.returnValue(of(initiatorsWithKey)); component.listInitiators(); tick(); expect(component.authStatus).toBe('Unidirectional'); })); - it('should update authStatus when subsystem has psk', fakeAsync(() => { - const subsystemWithPsk = { ...mockSubsystem, has_dhchap_key: true }; - component.initiators = [{ nqn: 'nqn1', use_dhchap: 'key1' }]; - spyOn(TestBed.inject(NvmeofService), 'getSubsystem').and.returnValue(of(subsystemWithPsk)); + it('should update authStatus when subsystem has dhchap_key', fakeAsync(() => { + const initiatorsWithKey = [{ nqn: 'nqn1', use_dhchap: true }]; + component.initiators = initiatorsWithKey; + const subsystemWithKey = { ...mockSubsystem, has_dhchap_key: true }; + spyOn(TestBed.inject(NvmeofService), 'getSubsystem').and.returnValue(of(subsystemWithKey)); component.getSubsystem(); tick(); expect(component.authStatus).toBe('Bi-directional'); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystem-step-3/nvmeof-subsystem-step-3.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystem-step-3/nvmeof-subsystem-step-3.component.html index 3eec171ba32..85008935660 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystem-step-3/nvmeof-subsystem-step-3.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystem-step-3/nvmeof-subsystem-step-3.component.html @@ -62,7 +62,7 @@ helperText="A secret key for the subsystem to authenticate itself to hosts." i18n-helperText [invalid]="subDK.isInvalid" - [invalidText]="subsystemDchapKeyInvalidTemplate"> + [invalidText]="INVALID_TEXTS['required']"> Subsystem DH-HMAC-CHAP key + class="cds-mb-3" + [invalid]="hostKey.isInvalid" + [invalidText]="INVALID_TEXTS['required']"> DHCHAP Key | {{hostDchapKeyItem.get('host_nqn')?.value }} + autocomplete + [invalid]="hostKey.isInvalid"> } @@ -108,9 +113,3 @@ - - -@for (err of formGroup.get('subsystemDchapKey').errors | keyvalue; track err.key) { -{{ INVALID_TEXTS[err.key] }} -} - diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystem-step-3/nvmeof-subsystem-step-3.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystem-step-3/nvmeof-subsystem-step-3.component.ts index 4cd4cc11071..ea83d7d5e4a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystem-step-3/nvmeof-subsystem-step-3.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystem-step-3/nvmeof-subsystem-step-3.component.ts @@ -1,9 +1,10 @@ import { Component, Input, OnInit } from '@angular/core'; -import { FormArray, UntypedFormControl } from '@angular/forms'; +import { FormArray, UntypedFormControl, Validators } from '@angular/forms'; import { ActionLabelsI18n } from '~/app/shared/constants/app.constants'; import { CdFormGroup } from '~/app/shared/forms/cd-form-group'; -import { AUTHENTICATION, StepTwoType } from '~/app/shared/models/nvmeof'; +import { CdValidators } from '~/app/shared/forms/cd-validators'; +import { AUTHENTICATION, HostStepType } from '~/app/shared/models/nvmeof'; import { TearsheetStep } from '~/app/shared/models/tearsheet-step'; @Component({ @@ -14,7 +15,7 @@ import { TearsheetStep } from '~/app/shared/models/tearsheet-step'; }) export class NvmeofSubsystemsStepThreeComponent implements OnInit, TearsheetStep { @Input() group!: string; - @Input() set stepTwoValue(value: StepTwoType | null) { + @Input() set stepTwoValue(value: HostStepType | null) { this._addedHosts = value?.addedHosts ?? []; if (this.formGroup) { this.syncHostList(); @@ -56,7 +57,11 @@ export class NvmeofSubsystemsStepThreeComponent implements OnInit, TearsheetStep private createForm() { this.formGroup = new CdFormGroup({ authType: new UntypedFormControl(AUTHENTICATION.Unidirectional), - subsystemDchapKey: new UntypedFormControl(null), + subsystemDchapKey: new UntypedFormControl(null, [ + CdValidators.requiredIf({ + authType: AUTHENTICATION.Bidirectional + }) + ]), hostDchapKeyList: new FormArray([]) }); @@ -65,7 +70,9 @@ export class NvmeofSubsystemsStepThreeComponent implements OnInit, TearsheetStep private createHostDhchapKeyFormGroup(hostNQN: string = '', key: string | null = null) { return new CdFormGroup({ - dhchap_key: new UntypedFormControl(key), + dhchap_key: new UntypedFormControl(key, { + validators: [Validators.required] + }), host_nqn: new UntypedFormControl(hostNQN) }); } @@ -78,5 +85,9 @@ export class NvmeofSubsystemsStepThreeComponent implements OnInit, TearsheetStep return this.formGroup.get('hostDchapKeyList') as FormArray; } + hostDhchapKeyCtrl(i: number) { + return (this.hostDchapKeyList.at(i) as CdFormGroup).get('dhchap_key'); + } + trackByIndex = (i: number) => i; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystem-step-4/nvmeof-subsystem-step-4.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystem-step-4/nvmeof-subsystem-step-4.component.ts index b885702a53c..518b9697847 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystem-step-4/nvmeof-subsystem-step-4.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystem-step-4/nvmeof-subsystem-step-4.component.ts @@ -3,7 +3,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ActionLabelsI18n } from '~/app/shared/constants/app.constants'; import { CdFormGroup } from '~/app/shared/forms/cd-form-group'; -import { AUTHENTICATION, HOST_TYPE } from '~/app/shared/models/nvmeof'; +import { AUTHENTICATION, HOST_TYPE, NO_AUTH } from '~/app/shared/models/nvmeof'; import { TearsheetStep } from '~/app/shared/models/tearsheet-step'; @Component({ @@ -45,6 +45,7 @@ export class NvmeofSubsystemsStepFourComponent implements OnInit, TearsheetStep } get authTypeLabel(): string { + if (this.authType === AUTHENTICATION.None) return NO_AUTH; return this.authType === AUTHENTICATION.Bidirectional ? $localize`Bidirectional` : $localize`Unidirectional`; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.html index 6a48e878694..57955f967d0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.html @@ -4,12 +4,7 @@ [description]="description" [isSubmitLoading]="isSubmitLoading" (submitRequested)="onSubmit($event)" -<<<<<<< HEAD - (stepChanged)="populateReviewData()" -======= - (stepChanged)="onStepChanged($event)" ->>>>>>> 6d877ea7101 (mgr/dashboard: Allow adding authentication to subsystem flow) - > + (stepChanged)="populateReviewData()"> -<<<<<<< HEAD + } -======= - } ->>>>>>> 6d877ea7101 (mgr/dashboard: Allow adding authentication to subsystem flow) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.spec.ts index 5b1f36f4722..57185bdc150 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.spec.ts @@ -93,7 +93,7 @@ describe('NvmeofSubsystemsFormComponent', () => { beforeEach(() => { nvmeofService = TestBed.inject(NvmeofService); spyOn(nvmeofService, 'createSubsystem').and.returnValue(of({})); - spyOn(nvmeofService, 'addInitiators').and.returnValue(of({})); + spyOn(nvmeofService, 'addSubsystemInitiators').and.returnValue(of({})); }); it('should be creating request correctly', () => { @@ -115,25 +115,17 @@ describe('NvmeofSubsystemsFormComponent', () => { addedHosts: [], hostType: HOST_TYPE.ALL, subsystemDchapKey: 'Q2VwaE52bWVvRkNoYXBTeW50aGV0aWNLZXkxMjM0NTY=', -<<<<<<< HEAD - listeners: [] -======= + listeners: [], authType: AUTHENTICATION.Bidirectional, hostDchapKeyList: [] ->>>>>>> 6d877ea7101 (mgr/dashboard: Allow adding authentication to subsystem flow) }; component.group = mockGroupName; component.onSubmit(payload); -<<<<<<< HEAD - expect(nvmeofService.addInitiators).toHaveBeenCalledWith('test-nqn.default', { - host_nqn: '*', -======= expect(nvmeofService.addSubsystemInitiators).toHaveBeenCalledWith('test-nqn.default', { allow_all: true, hosts: [], ->>>>>>> 6d877ea7101 (mgr/dashboard: Allow adding authentication to subsystem flow) gw_group: mockGroupName }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.ts index 9e3a32fac19..3ab7ecd585f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.ts @@ -7,8 +7,14 @@ import { ActivatedRoute, Router } from '@angular/router'; import { Step } from 'carbon-components-angular'; import { NvmeofService, SubsystemInitiatorRequest } from '~/app/shared/api/nvmeof.service'; import { TearsheetComponent } from '~/app/shared/components/tearsheet/tearsheet.component'; -import { HOST_TYPE, ListenerItem, AUTHENTICATION } from '~/app/shared/models/nvmeof'; -import { AUTHENTICATION, HOST_TYPE, StepTwoType } from '~/app/shared/models/nvmeof'; +import { + AUTHENTICATION, + HOST_TYPE, + HostStepType, + ListenerItem, + AuthStepType, + DetailsStepType +} from '~/app/shared/models/nvmeof'; import { from, Observable, of } from 'rxjs'; import { NotificationService } from '~/app/shared/services/notification.service'; import { NotificationType } from '~/app/shared/enum/notification-type.enum'; @@ -28,6 +34,13 @@ export type SubsystemPayload = { type StepResult = { step: string; success: boolean; error?: string }; +const STEP_LABELS = { + DETAILS: 'Subsystem details', + HOSTS: 'Host access control', + AUTH: 'Authentication', + REVIEW: 'Review' +} as const; + @Component({ selector: 'cd-nvmeof-subsystems-form', templateUrl: './nvmeof-subsystems-form.component.html', @@ -42,7 +55,7 @@ export class NvmeofSubsystemsFormComponent implements OnInit { description: string = $localize`Subsytems define how hosts connect to NVMe namespaces and ensure secure access to storage.`; isSubmitLoading: boolean = false; private lastCreatedNqn: string; - stepTwoValue: StepTwoType = null; + stepTwoValue: HostStepType = null; showAuthStep = true; @ViewChild(TearsheetComponent) tearsheet!: TearsheetComponent; @@ -74,53 +87,61 @@ export class NvmeofSubsystemsFormComponent implements OnInit { this.rebuildSteps(); } + private setAuthStepVisibility(nextShowAuth: boolean) { + if (this.showAuthStep === nextShowAuth) return; + this.showAuthStep = nextShowAuth; + this.rebuildSteps(); + } + populateReviewData() { - if (!this.tearsheet?.stepContents) return; - const steps = this.tearsheet.stepContents.toArray(); - - // Step 1: Subsystem details - const step1Form = steps[0]?.stepComponent?.formGroup; - if (step1Form) { - this.reviewNqn = step1Form.get('nqn')?.value || ''; - this.reviewListeners = step1Form.get('listeners')?.value || []; + if (!this.tearsheet) return; + + const step1 = this.tearsheet.getStepValueByLabel(STEP_LABELS.DETAILS); + const step2 = this.tearsheet.getStepValueByLabel(STEP_LABELS.HOSTS); + + if (step1) { + this.reviewNqn = step1.nqn ?? ''; + this.reviewListeners = step1.listeners ?? []; } - // Step 2: Host access control - const step2Form = steps[1]?.stepComponent?.formGroup; - if (step2Form) { - this.reviewHostType = step2Form.get('hostType')?.value || HOST_TYPE.SPECIFIC; - this.reviewAddedHosts = step2Form.get('addedHosts')?.value || []; + if (step2) { + this.reviewHostType = step2.hostType ?? HOST_TYPE.SPECIFIC; + this.reviewAddedHosts = step2.addedHosts ?? []; + this.stepTwoValue = step2; } - // Step 3: Authentication - const step3Form = steps[2]?.stepComponent?.formGroup; - if (step3Form) { - this.reviewAuthType = step3Form.get('authType')?.value || AUTHENTICATION.Unidirectional; - this.reviewSubsystemDchapKey = step3Form.get('subsystemDchapKey')?.value || ''; - const hostKeys = step3Form.get('hostDchapKeyList')?.value || []; - this.reviewHostDchapKeyCount = hostKeys.filter((k: any) => k?.key).length; - - } } - onStepChanged(_e: { current: number }) { - const stepTwo = this.tearsheet?.getStepValue(1); - this.stepTwoValue = stepTwo; - - this.showAuthStep = stepTwo?.hostType !== HOST_TYPE.ALL; + const nextShowAuth = (step2?.hostType ?? HOST_TYPE.SPECIFIC) === HOST_TYPE.SPECIFIC; - this.rebuildSteps(); + if (nextShowAuth !== this.showAuthStep) { + this.setAuthStepVisibility(nextShowAuth); + return; + } + + const authStep = this.tearsheet.getStepValueByLabel(STEP_LABELS.AUTH); + + if (this.showAuthStep && authStep) { + this.reviewAuthType = authStep.authType ?? AUTHENTICATION.Unidirectional; + this.reviewSubsystemDchapKey = authStep.subsystemDchapKey ?? ''; + const hostKeyList = authStep.hostDchapKeyList ?? []; + this.reviewHostDchapKeyCount = hostKeyList.filter((item) => !!item?.dhchap_key)?.length; + } else { + this.reviewAuthType = null; + this.reviewSubsystemDchapKey = ''; + this.reviewHostDchapKeyCount = 0; + } } rebuildSteps() { const steps: Step[] = [ - { label: 'Subsystem details', invalid: false }, - { label: 'Host access control', invalid: false } + { label: STEP_LABELS.DETAILS, invalid: false }, + { label: STEP_LABELS.HOSTS, invalid: false } ]; if (this.showAuthStep) { - steps.push({ label: 'Authentication', invalid: false }); + steps.push({ label: STEP_LABELS.AUTH, invalid: false }); } - steps.push({ label: 'Review', invalid: false }); + steps.push({ label: STEP_LABELS.REVIEW, invalid: false }); this.steps = steps; @@ -165,7 +186,10 @@ export class NvmeofSubsystemsFormComponent implements OnInit { sequentialSteps.push({ step: this.steps[1].label, call: () => - this.nvmeofService.addInitiators(`${payload.nqn}.${this.group}`, initiatorRequest) + this.nvmeofService.addSubsystemInitiators( + `${payload.nqn}.${this.group}`, + initiatorRequest + ) }); this.runSequentialSteps(sequentialSteps, stepResults).subscribe({ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/tearsheet/tearsheet.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/tearsheet/tearsheet.component.ts index c3806ea0920..99fdbfa1f20 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/tearsheet/tearsheet.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/tearsheet/tearsheet.component.ts @@ -90,6 +90,16 @@ export class TearsheetComponent implements OnInit, AfterViewInit, OnDestroy { return wrapper?.stepComponent?.formGroup?.value ?? null; } + getStepIndexByLabel(label: string): number { + return this.steps?.findIndex((s) => s.label === label) ?? -1; + } + + getStepValueByLabel(label: string): T | null { + const idx = this.getStepIndexByLabel(label); + if (idx < 0) return null; + return this.getStepValue(idx); + } + currentStep: number = 0; lastStep: number = null; isOpen: boolean = true; @@ -160,7 +170,7 @@ export class TearsheetComponent implements OnInit, AfterViewInit, OnDestroy { } handleSubmit() { - if (this.steps[this.currentStep].invalid) return; + if (this.steps.some((step) => step?.invalid)) return; const mergedPayloads = this.getMergedPayload(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/models/nvmeof.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/models/nvmeof.ts index 5107b671578..11d7edab3b0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/models/nvmeof.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/models/nvmeof.ts @@ -33,7 +33,7 @@ export interface NvmeofSubsystemData extends NvmeofSubsystem { export interface NvmeofSubsystemInitiator { nqn: string; - use_dhchap?: string; + use_dhchap?: boolean; } export interface NvmeofListener { @@ -74,9 +74,12 @@ export interface NvmeofGatewayGroup extends CephServiceSpec { export enum AUTHENTICATION { Unidirectional = 'unidirectional', - Bidirectional = 'bidirectional' + Bidirectional = 'bidirectional', + None = 'none' } +export const NO_AUTH = 'No authentication'; + export const HOST_TYPE = { ALL: 'all', SPECIFIC: 'specific' @@ -96,10 +99,11 @@ export function getSubsystemAuthStatus( _initiators: NvmeofSubsystemInitiator[] | { hosts?: NvmeofSubsystemInitiator[] } ): string { // Import enum value strings to avoid circular dependency - const NO_AUTH = 'No authentication'; const UNIDIRECTIONAL = 'Unidirectional'; const BIDIRECTIONAL = 'Bi-directional'; + let auth = NO_AUTH; + let hostsList: NvmeofSubsystemInitiator[] = []; if (_initiators && 'hosts' in _initiators && Array.isArray(_initiators.hosts)) { hostsList = _initiators.hosts; @@ -107,8 +111,6 @@ export function getSubsystemAuthStatus( hostsList = _initiators as NvmeofSubsystemInitiator[]; } - let auth = NO_AUTH; - const hostHasDhchapKey = hostsList.some((host) => !!host.use_dhchap); if (hostHasDhchapKey) { @@ -149,8 +151,22 @@ export type NvmeofInitiatorCandidate = { selected: boolean; }; -export type StepTwoType = { +export type HostStepType = { addedHosts: Array; hostname: string; hostType: string; }; + +export type AuthStepType = { + authType: AUTHENTICATION; + subsystemDchapKey: string; + hostDchapKeyList: Array<{ + dhchap_key: string; + host_nqn: string; + }>; +}; + +export type DetailsStepType = { + nqn: string; + listeners: Array; +};