Skip to content

Commit

Permalink
NAS-132996 / 25.04 / Add fibre channel connections card (#11181)
Browse files Browse the repository at this point in the history
* NAS-132996: Add fibre channel connections card

* NAS-132996: Update tests

* NAS-132996: Clean up
  • Loading branch information
denysbutenko authored Dec 18, 2024
1 parent ef1717a commit 2dd4566
Show file tree
Hide file tree
Showing 96 changed files with 465 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/interfaces/fibre-channel.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface FibreChannelStatusNode {
physical: boolean;
wwpn?: string;
wwpn_b?: string;
sessions: unknown[];
sessions: string[];
}

export interface FibreChannelStatus {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<mat-card class="card">
<mat-card-header>
<h3 mat-card-title>
{{ 'Fibre Channel Connections' | translate }}
</h3>
</mat-card-header>
<mat-card-content>
@for(connection of connections(); track connection) {
@if (connection?.A?.wwpn && connection?.A?.sessions?.length) {
<p>{{ connection.A.wwpn }} ({{ 'Active Controller' | translate }})</p>
}
@if (connection?.B?.wwpn_b && connection?.B?.sessions?.length) {
<p>{{ connection.B.wwpn_b }} ({{ 'Passive Controller' | translate }})</p>
}
} @empty {
<p>{{ 'No connections' | translate }}</p>
}
</mat-card-content>
</mat-card>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:host {
box-sizing: border-box;
display: block;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { createComponentFactory, Spectator } from '@ngneat/spectator/jest';
import { TranslateModule } from '@ngx-translate/core';
import { FibreChannelStatus } from 'app/interfaces/fibre-channel.interface';
import { FibreChannelConnectionsCardComponent } from './fibre-channel-connections-card.component';

describe('FibreChannelConnectionsCardComponent', () => {
let spectator: Spectator<FibreChannelConnectionsCardComponent>;
const createComponent = createComponentFactory({
component: FibreChannelConnectionsCardComponent,
imports: [TranslateModule.forRoot()],
});

beforeEach(() => {
spectator = createComponent({
props: {
connections: [{
A: {
port_type: 'NPort (fabric via point-to-point)',
port_state: 'Online',
speed: '16 Gbit',
physical: true,
wwpn: 'naa.210034800d75aec4',
sessions: [
'21:00:00:24:ff:19:a2:e2',
'21:00:00:24:ff:19:a5:80',
'21:00:00:24:ff:19:a9:0a',
'21:00:00:24:ff:19:a2:e3',
'21:00:00:24:ff:19:a5:81',
'21:00:00:24:ff:19:a9:0b',
'21:00:00:0e:1e:25:24:80',
],
},
port: 'fc0',
B: {
port_type: 'Unknown',
port_state: 'Offline',
speed: 'unknown',
physical: true,
wwpn_b: 'naa.210034800d75aed8',
sessions: [],
},
}] as FibreChannelStatus[],
},
});
});

it('shows fibre channel connections heading', () => {
const title = spectator.query('h3');
expect(title).toHaveText('Fibre Channel Connections');
});

it('shows connections', () => {
const content = spectator.queryAll('mat-card-content p');
expect(content).toHaveLength(1);
expect(content[0]).toHaveText('naa.210034800d75aec4 (Active Controller)');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {
Component, ChangeDetectionStrategy, input,
} from '@angular/core';
import {
MatCard, MatCardContent, MatCardHeader, MatCardTitle,
} from '@angular/material/card';
import { TranslateModule } from '@ngx-translate/core';
import { FibreChannelStatus } from 'app/interfaces/fibre-channel.interface';

@Component({
standalone: true,
selector: 'ix-fibre-channel-connections-card',
templateUrl: './fibre-channel-connections-card.component.html',
styleUrls: ['./fibre-channel-connections-card.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [
MatCard,
MatCardTitle,
MatCardContent,
MatCardHeader,
TranslateModule,
],
})
export class FibreChannelConnectionsCardComponent {
connections = input<FibreChannelStatus[]>([]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
@if (hasFibreCards()) {
@if (targetPort()) {
<ix-fibre-channel-port-card [port]="targetPort()"></ix-fibre-channel-port-card>
<ix-fibre-channel-connections-card [connections]="connections()"></ix-fibre-channel-connections-card>
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ describe('TargetDetailsComponent', () => {
providers: [
mockApi([
mockCall('fcport.query', [mockPort]),
mockCall('fcport.status', []),
mockCall('iscsi.extent.query', []),
mockCall('iscsi.targetextent.query', []),
mockCall('iscsi.global.sessions', []),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
ChangeDetectionStrategy, Component, computed, effect, input,
signal,
} from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { take } from 'rxjs';
import { IscsiTargetMode } from 'app/enums/iscsi.enum';
Expand All @@ -12,6 +13,7 @@ import {
AuthorizedNetworksCardComponent,
} from 'app/pages/sharing/iscsi/target/all-targets/target-details/authorized-networks-card/authorized-networks-card.component';
import { ConnectionsCardComponent } from 'app/pages/sharing/iscsi/target/all-targets/target-details/connections-card/connections-card.component';
import { FibreChannelConnectionsCardComponent } from 'app/pages/sharing/iscsi/target/all-targets/target-details/fibre-channel-connections-card/fibre-channel-connections-card.component';
import { FibreChannelPortCardComponent } from 'app/pages/sharing/iscsi/target/all-targets/target-details/fibre-channel-port-card/fibre-channel-port-card.component';
import { ApiService } from 'app/services/websocket/api.service';

Expand All @@ -24,6 +26,7 @@ import { ApiService } from 'app/services/websocket/api.service';
imports: [
AuthorizedNetworksCardComponent,
FibreChannelPortCardComponent,
FibreChannelConnectionsCardComponent,
AssociatedExtentsCardComponent,
ConnectionsCardComponent,
],
Expand All @@ -32,6 +35,7 @@ export class TargetDetailsComponent {
readonly target = input.required<IscsiTarget>();

targetPort = signal<FibreChannelPort>(null);
connections = toSignal(this.api.call('fcport.status'));

protected hasIscsiCards = computed(() => [
IscsiTargetMode.Iscsi,
Expand Down
4 changes: 4 additions & 0 deletions src/assets/i18n/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"Activates the configuration. Unset to disable the configuration without deleting it.": "",
"Activates the replication schedule.": "",
"Active": "",
"Active Controller": "",
"Active Directory": "",
"Active Directory - Primary Domain": "",
"Active Directory and LDAP are disabled.": "",
Expand Down Expand Up @@ -1903,6 +1904,7 @@
"Fetching Encryption Summary": "",
"Fetching Encryption Summary for {dataset}": "",
"Fibre Channel": "",
"Fibre Channel Connections": "",
"Fibre Channel Port": "",
"Fibre Channel Ports": "",
"Field is required": "",
Expand Down Expand Up @@ -2936,6 +2938,7 @@
"No VDEVs added.": "",
"No arguments are passed": "",
"No available licensed Expansion Shelves ": "",
"No connections": "",
"No containers are available.": "",
"No descriptor provided": "",
"No devices added.": "",
Expand Down Expand Up @@ -3122,6 +3125,7 @@
"Parent Path": "",
"Parent dataset path (read-only).": "",
"Partition": "",
"Passive Controller": "",
"Passphrase": "",
"Passphrase and confirmation should match.": "",
"Passphrase value must match Confirm Passphrase": "",
Expand Down
4 changes: 4 additions & 0 deletions src/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"Activates the configuration. Unset to disable the configuration without deleting it.": "",
"Activates the replication schedule.": "",
"Active": "",
"Active Controller": "",
"Active Directory": "",
"Active Directory - Primary Domain": "",
"Active Directory and LDAP are disabled.": "",
Expand Down Expand Up @@ -1903,6 +1904,7 @@
"Fetching Encryption Summary": "",
"Fetching Encryption Summary for {dataset}": "",
"Fibre Channel": "",
"Fibre Channel Connections": "",
"Fibre Channel Port": "",
"Fibre Channel Ports": "",
"Field is required": "",
Expand Down Expand Up @@ -2936,6 +2938,7 @@
"No VDEVs added.": "",
"No arguments are passed": "",
"No available licensed Expansion Shelves ": "",
"No connections": "",
"No containers are available.": "",
"No descriptor provided": "",
"No devices added.": "",
Expand Down Expand Up @@ -3122,6 +3125,7 @@
"Parent Path": "",
"Parent dataset path (read-only).": "",
"Partition": "",
"Passive Controller": "",
"Passphrase": "",
"Passphrase and confirmation should match.": "",
"Passphrase value must match Confirm Passphrase": "",
Expand Down
4 changes: 4 additions & 0 deletions src/assets/i18n/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"Activates the configuration. Unset to disable the configuration without deleting it.": "",
"Activates the replication schedule.": "",
"Active": "",
"Active Controller": "",
"Active Directory": "",
"Active Directory - Primary Domain": "",
"Active Directory and LDAP are disabled.": "",
Expand Down Expand Up @@ -1903,6 +1904,7 @@
"Fetching Encryption Summary": "",
"Fetching Encryption Summary for {dataset}": "",
"Fibre Channel": "",
"Fibre Channel Connections": "",
"Fibre Channel Port": "",
"Fibre Channel Ports": "",
"Field is required": "",
Expand Down Expand Up @@ -2936,6 +2938,7 @@
"No VDEVs added.": "",
"No arguments are passed": "",
"No available licensed Expansion Shelves ": "",
"No connections": "",
"No containers are available.": "",
"No descriptor provided": "",
"No devices added.": "",
Expand Down Expand Up @@ -3122,6 +3125,7 @@
"Parent Path": "",
"Parent dataset path (read-only).": "",
"Partition": "",
"Passive Controller": "",
"Passphrase": "",
"Passphrase and confirmation should match.": "",
"Passphrase value must match Confirm Passphrase": "",
Expand Down
4 changes: 4 additions & 0 deletions src/assets/i18n/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"Activates the configuration. Unset to disable the configuration without deleting it.": "",
"Activates the replication schedule.": "",
"Active": "",
"Active Controller": "",
"Active Directory": "",
"Active Directory - Primary Domain": "",
"Active Directory and LDAP are disabled.": "",
Expand Down Expand Up @@ -1903,6 +1904,7 @@
"Fetching Encryption Summary": "",
"Fetching Encryption Summary for {dataset}": "",
"Fibre Channel": "",
"Fibre Channel Connections": "",
"Fibre Channel Port": "",
"Fibre Channel Ports": "",
"Field is required": "",
Expand Down Expand Up @@ -2936,6 +2938,7 @@
"No VDEVs added.": "",
"No arguments are passed": "",
"No available licensed Expansion Shelves ": "",
"No connections": "",
"No containers are available.": "",
"No descriptor provided": "",
"No devices added.": "",
Expand Down Expand Up @@ -3122,6 +3125,7 @@
"Parent Path": "",
"Parent dataset path (read-only).": "",
"Partition": "",
"Passive Controller": "",
"Passphrase": "",
"Passphrase and confirmation should match.": "",
"Passphrase value must match Confirm Passphrase": "",
Expand Down
4 changes: 4 additions & 0 deletions src/assets/i18n/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"Activates the configuration. Unset to disable the configuration without deleting it.": "",
"Activates the replication schedule.": "",
"Active": "",
"Active Controller": "",
"Active Directory": "",
"Active Directory - Primary Domain": "",
"Active Directory and LDAP are disabled.": "",
Expand Down Expand Up @@ -1903,6 +1904,7 @@
"Fetching Encryption Summary": "",
"Fetching Encryption Summary for {dataset}": "",
"Fibre Channel": "",
"Fibre Channel Connections": "",
"Fibre Channel Port": "",
"Fibre Channel Ports": "",
"Field is required": "",
Expand Down Expand Up @@ -2936,6 +2938,7 @@
"No VDEVs added.": "",
"No arguments are passed": "",
"No available licensed Expansion Shelves ": "",
"No connections": "",
"No containers are available.": "",
"No descriptor provided": "",
"No devices added.": "",
Expand Down Expand Up @@ -3122,6 +3125,7 @@
"Parent Path": "",
"Parent dataset path (read-only).": "",
"Partition": "",
"Passive Controller": "",
"Passphrase": "",
"Passphrase and confirmation should match.": "",
"Passphrase value must match Confirm Passphrase": "",
Expand Down
4 changes: 4 additions & 0 deletions src/assets/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"Activates the configuration. Unset to disable the configuration without deleting it.": "",
"Activates the replication schedule.": "",
"Active": "",
"Active Controller": "",
"Active Directory": "",
"Active Directory - Primary Domain": "",
"Active Directory and LDAP are disabled.": "",
Expand Down Expand Up @@ -1903,6 +1904,7 @@
"Fetching Encryption Summary": "",
"Fetching Encryption Summary for {dataset}": "",
"Fibre Channel": "",
"Fibre Channel Connections": "",
"Fibre Channel Port": "",
"Fibre Channel Ports": "",
"Field is required": "",
Expand Down Expand Up @@ -2936,6 +2938,7 @@
"No VDEVs added.": "",
"No arguments are passed": "",
"No available licensed Expansion Shelves ": "",
"No connections": "",
"No containers are available.": "",
"No descriptor provided": "",
"No devices added.": "",
Expand Down Expand Up @@ -3122,6 +3125,7 @@
"Parent Path": "",
"Parent dataset path (read-only).": "",
"Partition": "",
"Passive Controller": "",
"Passphrase": "",
"Passphrase and confirmation should match.": "",
"Passphrase value must match Confirm Passphrase": "",
Expand Down
4 changes: 4 additions & 0 deletions src/assets/i18n/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"Activates the configuration. Unset to disable the configuration without deleting it.": "",
"Activates the replication schedule.": "",
"Active": "",
"Active Controller": "",
"Active Directory": "",
"Active Directory - Primary Domain": "",
"Active Directory and LDAP are disabled.": "",
Expand Down Expand Up @@ -1903,6 +1904,7 @@
"Fetching Encryption Summary": "",
"Fetching Encryption Summary for {dataset}": "",
"Fibre Channel": "",
"Fibre Channel Connections": "",
"Fibre Channel Port": "",
"Fibre Channel Ports": "",
"Field is required": "",
Expand Down Expand Up @@ -2936,6 +2938,7 @@
"No VDEVs added.": "",
"No arguments are passed": "",
"No available licensed Expansion Shelves ": "",
"No connections": "",
"No containers are available.": "",
"No descriptor provided": "",
"No devices added.": "",
Expand Down Expand Up @@ -3122,6 +3125,7 @@
"Parent Path": "",
"Parent dataset path (read-only).": "",
"Partition": "",
"Passive Controller": "",
"Passphrase": "",
"Passphrase and confirmation should match.": "",
"Passphrase value must match Confirm Passphrase": "",
Expand Down
Loading

0 comments on commit 2dd4566

Please sign in to comment.