Skip to content

Commit

Permalink
NAS-117805: Added disk name to title
Browse files Browse the repository at this point in the history
  • Loading branch information
RehanY147 committed Sep 22, 2022
1 parent b62369f commit 24cf47c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { MAT_DIALOG_DATA } from '@angular/material/dialog';

@Component({
templateUrl: './exported-pools-dialog.component.html',
styleUrls: ['./exported-pools-dialog.component.scss'],
})
export class ExportedPoolsDialogComponent {
constructor(
Expand Down
10 changes: 5 additions & 5 deletions src/app/pages/storage/components/manager/manager.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,9 +576,9 @@ export class ManagerComponent implements OnInit, AfterViewInit {
handleSelectAll(selectFn: (flag: boolean) => void, allSelectedFlag: boolean): void {
if (allSelectedFlag) {
for (const disk of this.disks) {
if (this.shouldWarnAboutExportedPool(disk)) {
if (this.shouldWarnForExportedPool(disk)) {
this.dialog.warn(
this.translate.instant('Warning: ' + disk.name),
this.translate.instant('Warning') + ': ' + disk.name,
this.translate.instant(helptext.exported_pool_warning, { pool: `'${disk.exported_zpool}'` }),
);
}
Expand Down Expand Up @@ -783,10 +783,10 @@ export class ManagerComponent implements OnInit, AfterViewInit {
}

warnAboutExportedPool(selectedDisks: ManagerDisk[]): void {
if (selectedDisks.length && this.shouldWarnAboutExportedPool(selectedDisks[selectedDisks.length - 1])) {
if (selectedDisks.length && this.shouldWarnForExportedPool(selectedDisks[selectedDisks.length - 1])) {
const lastSelectedItem = selectedDisks[selectedDisks.length - 1];
this.dialog.warn(
this.translate.instant('Warning'),
this.translate.instant('Warning') + ': ' + lastSelectedItem.name,
this.translate.instant(helptext.exported_pool_warning, { pool: `'${lastSelectedItem.exported_zpool}'` }),
);
}
Expand All @@ -800,7 +800,7 @@ export class ManagerComponent implements OnInit, AfterViewInit {
);
}

shouldWarnAboutExportedPool(disk: ManagerDisk): boolean {
shouldWarnForExportedPool(disk: ManagerDisk): boolean {
const lastSelectedDisk = disk;
const wasAlreadyWarnedAboutThisDisk = this.exportedPoolsWarnings.find(
(warningDisk) => warningDisk === lastSelectedDisk.devname,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ export class ExtendDialogComponent implements OnInit {

setupWarningForExportedPools(): void {
this.newDiskControl.valueChanges.pipe(untilDestroyed(this)).subscribe(
this.warnAboutExportedPoolForDiskIfRequired.bind(this),
this.warnForExportedPools.bind(this),
);
}

warnAboutExportedPoolForDiskIfRequired(diskName: string): void {
warnForExportedPools(diskName: string): void {
const unusedDisk = this.unusedDisks.find((unusedDisk) => unusedDisk.name === diskName);
if (!unusedDisk?.exported_zpool) {
return;
}
this.dialogService.warn(
this.translate.instant('Warning'),
this.translate.instant('Warning') + ': ' + unusedDisk.name,
this.translate.instant(helptext.exported_pool_warning, { pool: `'${unusedDisk.exported_zpool}'` }),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class ReplaceDiskDialogComponent implements OnInit {
return;
}
this.dialogService.warn(
this.translate.instant('Warning'),
this.translate.instant('Warning') + ': ' + unusedDisk.name,
this.translate.instant(
'This disk is part of the exported pool {pool}. Wiping this disk will make {pool} unable\
to import. You will lose any and all data in {pool}. Please make sure that any sensitive data in {pool} is backed up before reusing/repurposing this disk.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class BootPoolAttachFormComponent implements OnInit {
return;
}
this.dialogService.warn(
this.translate.instant('Warning'),
this.translate.instant('Warning') + ': ' + unusedDisk.name,
this.translate.instant(
'This disk is part of the exported pool {pool}. Reusing this disk will make {pool} unable to import. You will lose any and all data in {pool}. Please make sure any sensitive data in {pool} is backed up before reusing/repusposing this disk.',
{ pool: `'${unusedDisk.exported_zpool}'` },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class BootPoolReplaceFormComponent implements OnInit {
return;
}
this.dialogService.warn(
this.translate.instant('Warning'),
this.translate.instant('Warning') + ': ' + unusedDisk.name,
this.translate.instant(
'This disk is part of the exported pool {pool}. Reusing this disk will make {pool} unable to import. You will lose any and all data in {pool}. Please make sure any sensitive data in {pool} is backed up before reusing/repurposing this disk.',
{ pool: `'${unusedDisk.exported_zpool}'` },
Expand Down

0 comments on commit 24cf47c

Please sign in to comment.