-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NAS-132777: iSCSI authorized networks cards (#11113)
- Loading branch information
Showing
98 changed files
with
283 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...l-targets/target-details/authorized-networks-card/authorized-networks-card.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<mat-card class="card"> | ||
<mat-card-header> | ||
<h3 mat-card-title> | ||
{{ 'iSCSI Authorized Networks' | translate }} | ||
</h3> | ||
</mat-card-header> | ||
<mat-card-content> | ||
@for (network of target().auth_networks; track network) { | ||
<div class="network"> | ||
{{ network }} | ||
</div> | ||
} | ||
</mat-card-content> | ||
</mat-card> |
7 changes: 7 additions & 0 deletions
7
...l-targets/target-details/authorized-networks-card/authorized-networks-card.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.network { | ||
margin-bottom: 2px; | ||
|
||
&:last-of-type { | ||
margin-bottom: 0; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...argets/target-details/authorized-networks-card/authorized-networks-card.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { createComponentFactory, Spectator } from '@ngneat/spectator/jest'; | ||
import { IscsiTarget } from 'app/interfaces/iscsi.interface'; | ||
import { | ||
AuthorizedNetworksCardComponent, | ||
} from 'app/pages/sharing/iscsi/target/all-targets/target-details/authorized-networks-card/authorized-networks-card.component'; | ||
|
||
describe('AuthorizedNetworksCardComponent', () => { | ||
let spectator: Spectator<AuthorizedNetworksCardComponent>; | ||
const createComponent = createComponentFactory({ | ||
component: AuthorizedNetworksCardComponent, | ||
}); | ||
|
||
beforeEach(() => { | ||
spectator = createComponent({ | ||
props: { | ||
target: { | ||
auth_networks: ['192.168.1.10/24', '10.0.0.1/24'], | ||
} as IscsiTarget, | ||
}, | ||
}); | ||
}); | ||
|
||
it('shows a list of networks authorized for the target', () => { | ||
const networks = spectator.queryAll('.network'); | ||
|
||
expect(networks).toHaveLength(2); | ||
expect(networks[0]).toHaveText('192.168.1.10/24'); | ||
expect(networks[1]).toHaveText('10.0.0.1/24'); | ||
}); | ||
}); |
24 changes: 24 additions & 0 deletions
24
...all-targets/target-details/authorized-networks-card/authorized-networks-card.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { ChangeDetectionStrategy, Component, input } from '@angular/core'; | ||
import { | ||
MatCard, MatCardContent, MatCardHeader, MatCardTitle, | ||
} from '@angular/material/card'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { IscsiTarget } from 'app/interfaces/iscsi.interface'; | ||
|
||
@Component({ | ||
selector: 'ix-authorized-networks-card', | ||
styleUrls: ['./authorized-networks-card.component.scss'], | ||
templateUrl: './authorized-networks-card.component.html', | ||
standalone: true, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
imports: [ | ||
MatCard, | ||
MatCardHeader, | ||
MatCardTitle, | ||
TranslateModule, | ||
MatCardContent, | ||
], | ||
}) | ||
export class AuthorizedNetworksCardComponent { | ||
readonly target = input.required<IscsiTarget>(); | ||
} |
6 changes: 5 additions & 1 deletion
6
src/app/pages/sharing/iscsi/target/all-targets/target-details/target-details.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
<div class="cards"> | ||
<div class="scroll-window"> | ||
<p>// TODO: Implement cards 🧑💻 </p> | ||
@if (hasIscsiCards()) { | ||
@if (target().auth_networks.length) { | ||
<ix-authorized-networks-card [target]="target()"></ix-authorized-networks-card> | ||
} | ||
} | ||
</div> | ||
</div> |
17 changes: 14 additions & 3 deletions
17
src/app/pages/sharing/iscsi/target/all-targets/target-details/target-details.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
import { | ||
ChangeDetectionStrategy, Component, | ||
ChangeDetectionStrategy, Component, computed, input, | ||
} from '@angular/core'; | ||
import { IscsiTargetMode } from 'app/enums/iscsi.enum'; | ||
import { IscsiTarget } from 'app/interfaces/iscsi.interface'; | ||
import { | ||
AuthorizedNetworksCardComponent, | ||
} from 'app/pages/sharing/iscsi/target/all-targets/target-details/authorized-networks-card/authorized-networks-card.component'; | ||
|
||
@Component({ | ||
selector: 'ix-target-details', | ||
templateUrl: './target-details.component.html', | ||
standalone: true, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
imports: [], | ||
imports: [ | ||
AuthorizedNetworksCardComponent, | ||
], | ||
}) | ||
export class TargetDetailsComponent {} | ||
export class TargetDetailsComponent { | ||
readonly target = input.required<IscsiTarget>(); | ||
|
||
protected hasIscsiCards = computed(() => [IscsiTargetMode.Iscsi, IscsiTargetMode.Both].includes(this.target().mode)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.