Skip to content

Commit

Permalink
NAS-133002 / 25.04 / Minor iSCSI fixes (#11166)
Browse files Browse the repository at this point in the history
  • Loading branch information
undsoft authored Dec 11, 2024
1 parent 3f625f8 commit 8b4d4e2
Show file tree
Hide file tree
Showing 102 changed files with 332 additions and 95 deletions.
8 changes: 5 additions & 3 deletions src/app/pages/services/services.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ import {
} from 'app/pages/services/components/service-state-column/service-state-column.component';
import { ServiceUpsComponent } from 'app/pages/services/components/service-ups/service-ups.component';
import { ServicesComponent } from 'app/pages/services/services.component';
import {
GlobalTargetConfigurationComponent,
} from 'app/pages/sharing/iscsi/global-target-configuration/global-target-configuration.component';
import { IscsiService } from 'app/services/iscsi.service';
import { SlideInService } from 'app/services/slide-in.service';
import { ApiService } from 'app/services/websocket/api.service';
Expand Down Expand Up @@ -107,13 +110,12 @@ describe('ServicesComponent', () => {
});

describe('edit', () => {
it('should redirect and open form to configure iSCSI service page when edit button is pressed', async () => {
it('should open iSCSI global configuration form', async () => {
const serviceIndex = fakeDataSource.findIndex((item) => item.service === ServiceName.Iscsi) + 1;
const editButton = await table.getHarnessInCell(IxIconHarness.with({ name: 'edit' }), serviceIndex, 3);
await editButton.click();

expect(spectator.inject(NavigateAndInteractService).navigateAndInteract)
.toHaveBeenCalledWith(['/sharing', 'iscsi'], 'global-configuration');
expect(spectator.inject(SlideInService).open).toHaveBeenCalledWith(GlobalTargetConfigurationComponent);
});

it('should open FTP configuration when edit button is pressed', async () => {
Expand Down
5 changes: 4 additions & 1 deletion src/app/pages/services/services.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ import {
} from 'app/pages/services/components/service-state-column/service-state-column.component';
import { ServiceUpsComponent } from 'app/pages/services/components/service-ups/service-ups.component';
import { servicesElements } from 'app/pages/services/services.elements';
import {
GlobalTargetConfigurationComponent,
} from 'app/pages/sharing/iscsi/global-target-configuration/global-target-configuration.component';
import { ErrorHandlerService } from 'app/services/error-handler.service';
import { ServicesService } from 'app/services/services.service';
import { SlideInService } from 'app/services/slide-in.service';
Expand Down Expand Up @@ -212,7 +215,7 @@ export class ServicesComponent implements OnInit {
private configureService(row: Service): void {
switch (row.service) {
case ServiceName.Iscsi:
this.navigateAndInteract.navigateAndInteract(['/sharing', 'iscsi'], 'global-configuration');
this.slideInService.open(GlobalTargetConfigurationComponent);
break;
case ServiceName.Ftp:
this.slideInService.open(ServiceFtpComponent, { wide: true });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import { SnackbarService } from 'app/modules/snackbar/services/snackbar.service'
import { TestDirective } from 'app/modules/test-id/test.directive';
import { ServiceNfsComponent } from 'app/pages/services/components/service-nfs/service-nfs.component';
import { ServiceSmbComponent } from 'app/pages/services/components/service-smb/service-smb.component';
import {
GlobalTargetConfigurationComponent,
} from 'app/pages/sharing/iscsi/global-target-configuration/global-target-configuration.component';
import { ErrorHandlerService } from 'app/services/error-handler.service';
import { SlideInService } from 'app/services/slide-in.service';
import { UrlOptionsService } from 'app/services/url-options.service';
Expand Down Expand Up @@ -81,7 +84,7 @@ export class ServiceExtraActionsComponent {
configureService(service: Service): void {
switch (service.service) {
case ServiceName.Iscsi:
this.navigateAndInteract.navigateAndInteract(['/sharing', 'iscsi'], 'global-configuration');
this.slideInService.open(GlobalTargetConfigurationComponent);
break;
case ServiceName.Nfs:
this.slideInService.open(ServiceNfsComponent, { wide: true });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ix-modal-header
[requiredRoles]="requiredRoles"
[title]="'Global Configuration' | translate"
[title]="'iSCSI Global Configuration' | translate"
[loading]="isLoading()"
></ix-modal-header>

Expand Down
1 change: 0 additions & 1 deletion src/app/pages/sharing/iscsi/iscsi.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*ixRequiresRoles="requiredRoles"
mat-button
color="default"
id="global-configuration"
ixTest="global-target-configuration"
[ixUiSearch]="searchableElements.elements.config"
(click)="openGlobalTargetConfiguration()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ <h3 mat-card-title>
@if (isLoadingExtents()) {
<ngx-skeleton-loader class="button-loader"></ngx-skeleton-loader>
} @else {
@if (unassociatedExtents()?.length > 0) {
<div class="actions">
<button
*ixRequiresRoles="requiredRoles"
color="primary"
mat-button
[ixTest]="[target()?.name, 'associate-target']"
(click)="associateTarget()"
>
{{ 'Associate' | translate }}
</button>
</div>
}
<div
class="actions"
[matTooltip]="unassociatedExtents()?.length > 0 ? null : ('No unassociated extents available.' | translate)"
>
<button
*ixRequiresRoles="requiredRoles"
color="default"
mat-button
[disabled]="!unassociatedExtents()?.length"
[ixTest]="[target()?.name, 'associate-target']"
(click)="associateTarget()"
>
{{ 'Associate' | translate }}
</button>
</div>
}
</mat-card-header>
<mat-card-content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ <h1 matDialogTitle>
</ix-fieldset>

<ix-form-actions mat-dialog-actions class="form-actions">
<button
mat-button
type="button"
ixTest="cancel-associate-target"
[matDialogClose]="false"
>
{{ 'Cancel' | translate }}
</button>

<button
*ixRequiresRoles="requiredRoles"
mat-button
Expand All @@ -33,15 +42,6 @@ <h1 matDialogTitle>
>
{{ 'Associate' | translate }}
</button>

<button
mat-button
type="button"
ixTest="cancel-associate-target"
[matDialogClose]="false"
>
{{ 'Cancel' | translate }}
</button>
</ix-form-actions>
</form>
</mat-dialog-content>
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
padding: 0;
}
}

.form-actions {
padding: 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
import { FormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
import { MatButton } from '@angular/material/button';
import {
MAT_DIALOG_DATA, MatDialogClose, MatDialogContent, MatDialogRef,
MAT_DIALOG_DATA, MatDialogActions, MatDialogClose, MatDialogContent, MatDialogRef,
MatDialogTitle,
} from '@angular/material/dialog';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
Expand Down Expand Up @@ -45,6 +45,7 @@ import { ApiService } from 'app/services/websocket/api.service';
MatButton,
TestDirective,
TranslateModule,
MatDialogActions,
],
})
export class AssociatedTargetFormComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ <h3 mat-card-title>
<div class="network">
{{ network }}
</div>
} @empty {
<p>{{ 'No networks are authorized.' | translate }}</p>
}
</mat-card-content>
</mat-card>
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<div class="cards">
<div class="scroll-window">
@if (hasIscsiCards()) {
@if (target().auth_networks.length) {
<ix-authorized-networks-card [target]="target()"></ix-authorized-networks-card>
}
<ix-authorized-networks-card [target]="target()"></ix-authorized-networks-card>
}

@if (hasFibreCards()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { mockApi, mockCall } from 'app/core/testing/utils/mock-api.utils';
import { IscsiTargetMode } from 'app/enums/iscsi.enum';
import { FibreChannelPort } from 'app/interfaces/fibre-channel.interface';
import { IscsiTarget } from 'app/interfaces/iscsi.interface';
import {
AssociatedExtentsCardComponent,
} from 'app/pages/sharing/iscsi/target/all-targets/target-details/associated-extents-card/associated-extents-card.component';
import {
AuthorizedNetworksCardComponent,
} from 'app/pages/sharing/iscsi/target/all-targets/target-details/authorized-networks-card/authorized-networks-card.component';
Expand All @@ -19,15 +22,19 @@ describe('TargetDetailsComponent', () => {
let mockApiService: jest.Mocked<ApiService>;

const mockPort = {
id: 'Port-1',
id: 1,
wwpn: '10:00:00:00:c9:20:00:00',
wwpn_b: '10:00:00:00:c9:20:00:01',
} as unknown as FibreChannelPort;
} as FibreChannelPort;

const createComponent = createComponentFactory({
component: TargetDetailsComponent,
declarations: [
MockComponents(AuthorizedNetworksCardComponent, FibreChannelPortCardComponent),
MockComponents(
AuthorizedNetworksCardComponent,
FibreChannelPortCardComponent,
AssociatedExtentsCardComponent,
),
],
providers: [
mockApi([
Expand Down
5 changes: 2 additions & 3 deletions src/app/services/iscsi.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { Store } from '@ngrx/store';
import {
combineLatest, filter, map, Observable,
combineLatest, map, Observable,
} from 'rxjs';
import { LicenseFeature } from 'app/enums/license-feature.enum';
import { Choices } from 'app/interfaces/choices.interface';
Expand Down Expand Up @@ -70,8 +70,7 @@ export class IscsiService {
return combineLatest([
this.store$.pipe(
waitForSystemInfo,
filter((systemInfo) => !!systemInfo.license),
map((systemInfo) => systemInfo.license.features.includes(LicenseFeature.FibreChannel)),
map((systemInfo) => systemInfo.license?.features?.includes(LicenseFeature.FibreChannel)),
),
this.api.call('fc.capable'),
]).pipe(
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -2959,6 +2959,7 @@
"No longer keep this Boot Environment?": "",
"No matching results found": "",
"No network interfaces are marked critical for failover.": "",
"No networks are authorized.": "",
"No options": "",
"No options are passed": "",
"No pools are configured.": "",
Expand All @@ -2970,6 +2971,7 @@
"No similar apps found.": "",
"No snapshots sent yet": "",
"No temperature data was reported by the system. There can be a number of reasons why this might occur.": "",
"No unassociated extents available.": "",
"No unused disks": "",
"No update found.": "",
"No updates available.": "",
Expand Down Expand Up @@ -5147,6 +5149,7 @@
"iSCSI": "",
"iSCSI Authorized Networks": "",
"iSCSI Extent": "",
"iSCSI Global Configuration": "",
"iSCSI Group": "",
"iSCSI Initiator": "",
"iSCSI Service": "",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2959,6 +2959,7 @@
"No longer keep this Boot Environment?": "",
"No matching results found": "",
"No network interfaces are marked critical for failover.": "",
"No networks are authorized.": "",
"No options": "",
"No options are passed": "",
"No pools are configured.": "",
Expand All @@ -2970,6 +2971,7 @@
"No similar apps found.": "",
"No snapshots sent yet": "",
"No temperature data was reported by the system. There can be a number of reasons why this might occur.": "",
"No unassociated extents available.": "",
"No unused disks": "",
"No update found.": "",
"No updates available.": "",
Expand Down Expand Up @@ -5147,6 +5149,7 @@
"iSCSI": "",
"iSCSI Authorized Networks": "",
"iSCSI Extent": "",
"iSCSI Global Configuration": "",
"iSCSI Group": "",
"iSCSI Initiator": "",
"iSCSI Service": "",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -2959,6 +2959,7 @@
"No longer keep this Boot Environment?": "",
"No matching results found": "",
"No network interfaces are marked critical for failover.": "",
"No networks are authorized.": "",
"No options": "",
"No options are passed": "",
"No pools are configured.": "",
Expand All @@ -2970,6 +2971,7 @@
"No similar apps found.": "",
"No snapshots sent yet": "",
"No temperature data was reported by the system. There can be a number of reasons why this might occur.": "",
"No unassociated extents available.": "",
"No unused disks": "",
"No update found.": "",
"No updates available.": "",
Expand Down Expand Up @@ -5147,6 +5149,7 @@
"iSCSI": "",
"iSCSI Authorized Networks": "",
"iSCSI Extent": "",
"iSCSI Global Configuration": "",
"iSCSI Group": "",
"iSCSI Initiator": "",
"iSCSI Service": "",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -2959,6 +2959,7 @@
"No longer keep this Boot Environment?": "",
"No matching results found": "",
"No network interfaces are marked critical for failover.": "",
"No networks are authorized.": "",
"No options": "",
"No options are passed": "",
"No pools are configured.": "",
Expand All @@ -2970,6 +2971,7 @@
"No similar apps found.": "",
"No snapshots sent yet": "",
"No temperature data was reported by the system. There can be a number of reasons why this might occur.": "",
"No unassociated extents available.": "",
"No unused disks": "",
"No update found.": "",
"No updates available.": "",
Expand Down Expand Up @@ -5147,6 +5149,7 @@
"iSCSI": "",
"iSCSI Authorized Networks": "",
"iSCSI Extent": "",
"iSCSI Global Configuration": "",
"iSCSI Group": "",
"iSCSI Initiator": "",
"iSCSI Service": "",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -2959,6 +2959,7 @@
"No longer keep this Boot Environment?": "",
"No matching results found": "",
"No network interfaces are marked critical for failover.": "",
"No networks are authorized.": "",
"No options": "",
"No options are passed": "",
"No pools are configured.": "",
Expand All @@ -2970,6 +2971,7 @@
"No similar apps found.": "",
"No snapshots sent yet": "",
"No temperature data was reported by the system. There can be a number of reasons why this might occur.": "",
"No unassociated extents available.": "",
"No unused disks": "",
"No update found.": "",
"No updates available.": "",
Expand Down Expand Up @@ -5147,6 +5149,7 @@
"iSCSI": "",
"iSCSI Authorized Networks": "",
"iSCSI Extent": "",
"iSCSI Global Configuration": "",
"iSCSI Group": "",
"iSCSI Initiator": "",
"iSCSI Service": "",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2959,6 +2959,7 @@
"No longer keep this Boot Environment?": "",
"No matching results found": "",
"No network interfaces are marked critical for failover.": "",
"No networks are authorized.": "",
"No options": "",
"No options are passed": "",
"No pools are configured.": "",
Expand All @@ -2970,6 +2971,7 @@
"No similar apps found.": "",
"No snapshots sent yet": "",
"No temperature data was reported by the system. There can be a number of reasons why this might occur.": "",
"No unassociated extents available.": "",
"No unused disks": "",
"No update found.": "",
"No updates available.": "",
Expand Down Expand Up @@ -5147,6 +5149,7 @@
"iSCSI": "",
"iSCSI Authorized Networks": "",
"iSCSI Extent": "",
"iSCSI Global Configuration": "",
"iSCSI Group": "",
"iSCSI Initiator": "",
"iSCSI Service": "",
Expand Down
Loading

0 comments on commit 8b4d4e2

Please sign in to comment.