Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-132996 / 25.04 / Add fibre channel connections card #11181

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,33 @@
import {
Component, OnInit, 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';
import { ApiService } from 'app/services/websocket/api.service';

@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 implements OnInit {
connections = input<FibreChannelStatus[]>([]);

constructor(private api: ApiService) { }

ngOnInit(): void {
console.info('init');
}
}
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 @@ -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 @@ -11,6 +12,7 @@ import { AssociatedExtentsCardComponent } from 'app/pages/sharing/iscsi/target/a
import {
AuthorizedNetworksCardComponent,
} from 'app/pages/sharing/iscsi/target/all-targets/target-details/authorized-networks-card/authorized-networks-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 @@ -23,13 +25,15 @@ import { ApiService } from 'app/services/websocket/api.service';
imports: [
AuthorizedNetworksCardComponent,
FibreChannelPortCardComponent,
FibreChannelConnectionsCardComponent,
AssociatedExtentsCardComponent,
],
})
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 @@ -1895,6 +1896,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 @@ -2931,6 +2933,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 @@ -3117,6 +3120,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 @@ -1895,6 +1896,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 @@ -2931,6 +2933,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 @@ -3117,6 +3120,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 @@ -1895,6 +1896,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 @@ -2931,6 +2933,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 @@ -3117,6 +3120,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 @@ -1895,6 +1896,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 @@ -2931,6 +2933,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 @@ -3117,6 +3120,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 @@ -1895,6 +1896,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 @@ -2931,6 +2933,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 @@ -3117,6 +3120,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 @@ -1895,6 +1896,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 @@ -2931,6 +2933,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 @@ -3117,6 +3120,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 @@ -1895,6 +1896,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 @@ -2931,6 +2933,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 @@ -3117,6 +3120,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
Loading