Skip to content

Commit

Permalink
NAS-133384: Use red color for destructive actions (#11280)
Browse files Browse the repository at this point in the history
  • Loading branch information
undsoft authored Jan 6, 2025
1 parent 87e4e4b commit 2ec11c8
Show file tree
Hide file tree
Showing 79 changed files with 107 additions and 41 deletions.
2 changes: 1 addition & 1 deletion src/app/interfaces/dialog.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface ConfirmOptions {
cancelText?: string;
disableClose?: boolean;
confirmationCheckboxText?: string;
buttonColor?: 'primary' | 'red';
buttonColor?: 'primary' | 'warn';
}

export interface ConfirmOptionsWithSecondaryCheckbox extends ConfirmOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ describe('SlideInComponent', () => {
message: 'You have unsaved changes. Are you sure you want to close?',
cancelText: 'No',
buttonText: 'Yes',
buttonColor: 'red',
buttonColor: 'warn',
hideCheckbox: true,
});
discardPeriodicTasks();
Expand All @@ -236,14 +236,7 @@ describe('SlideInComponent', () => {
const backdrop = spectator.query('.ix-slide-in2-background')!;
backdrop.dispatchEvent(new Event('click'));

expect(spectator.inject(DialogService).confirm).not.toHaveBeenCalledWith({
title: 'Unsaved Changes',
message: 'You have unsaved changes. Are you sure you want to close?',
cancelText: 'No',
buttonText: 'Yes',
buttonColor: 'red',
hideCheckbox: true,
});
expect(spectator.inject(DialogService).confirm).not.toHaveBeenCalled();
discardPeriodicTasks();
}));
});
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class SlideInComponent implements OnInit, OnDestroy {
message: this.translate.instant('You have unsaved changes. Are you sure you want to close?'),
cancelText: this.translate.instant('No'),
buttonText: this.translate.instant('Yes'),
buttonColor: 'red',
buttonColor: 'warn',
hideCheckbox: true,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h1 matDialogTitle>
<button
mat-button
type="submit"
color="primary"
color="warn"
ixTest="delete"
[disabled]="form.invalid"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h1 matDialogTitle>{{ 'Delete' | translate }}</h1>
<button
mat-button
type="submit"
color="primary"
color="warn"
ixTest="delete"
[disabled]="form.invalid || !!runningCount"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export class CloudCredentialsCardComponent implements OnInit {
message: this.translate.instant('Are you sure you want to delete the <b>{name}</b>?', {
name: credential.name,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
})
.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export class SshConnectionCardComponent implements OnInit {
message: this.translate.instant('Are you sure you want to delete the <b>{name}</b> SSH Connection?', {
name: credential.name,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
})
.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export class SshKeypairCardComponent implements OnInit {
message: this.translate.instant('Are you sure you want to delete the <b>{name}</b>?', {
name: credential.name,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
})
.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export class AcmeDnsAuthenticatorListComponent implements OnInit {
message: this.translate.instant('Are you sure you want to delete the <b>{name}</b> DNS Authenticator?', {
name: authenticator.name,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
})
.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ describe('CertificateAuthorityListComponent', () => {

expect(dialog.confirm).toHaveBeenCalledWith({
buttonText: 'Delete',
buttonColor: 'warn',
message: 'Are you sure you want to delete the <b>certificate-authority-0</b> certificate authority?',
title: 'Delete Certificate Authority',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ export class CertificateAuthorityListComponent implements OnInit {
message: this.translate.instant('Are you sure you want to delete the <b>{name}</b> certificate authority?', {
name: authority.name,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
})
.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ describe('CertificateListComponent', () => {
hideCheckbox: true,
secondaryCheckbox: true,
secondaryCheckboxText: 'Force',
buttonColor: 'red',
buttonColor: 'warn',
buttonText: 'Delete',
});
expect(spectator.inject(DialogService).jobDialog).toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export class CertificateListComponent implements OnInit {
message: this.translate.instant('Are you sure you want to delete "{name}"?', { name: certificate.name }),
hideCheckbox: true,
secondaryCheckbox: true,
buttonColor: 'red',
buttonColor: 'warn',
secondaryCheckboxText: this.translate.instant('Force'),
buttonText: this.translate.instant('Delete'),
}).pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe('CertificateSigningRequestsListComponent', () => {
hideCheckbox: true,
secondaryCheckbox: true,
secondaryCheckboxText: 'Force',
buttonColor: 'red',
buttonColor: 'warn',
buttonText: 'Delete',
});
expect(spectator.inject(DialogService).jobDialog).toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class CertificateSigningRequestsListComponent implements OnInit {
hideCheckbox: true,
secondaryCheckbox: true,
secondaryCheckboxText: this.translate.instant('Force'),
buttonColor: 'red',
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
}).pipe(
filter((confirmation: DialogWithSecondaryCheckboxResult) => confirmation.confirmed),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h1 mat-dialog-title>{{ 'Delete Group' | translate }}</h1>
<button
*ixRequiresRoles="requiredRoles"
mat-button
color="primary"
color="warn"
ixTest="delete"
(click)="onDelete()"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export class PrivilegeListComponent implements OnInit {
message: this.translate.instant('Are you sure you want to delete the <b>{name}</b>?', {
name: privilege.name,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
})
.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ describe('UserApiKeysComponent', () => {
expect(spectator.inject(DialogService).confirm).toHaveBeenCalledWith({
title: 'Delete API Key',
buttonText: 'Delete',
cancelText: 'Cancel',
buttonColor: 'warn',
message: 'Are you sure you want to delete the <b>first-api-key</b> API Key?',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export class UserApiKeysComponent implements OnInit {
title: this.translate.instant('Delete API Key'),
message: this.translate.instant('Are you sure you want to delete the <b>{name}</b> API Key?', { name: apiKey.name }),
buttonText: this.translate.instant('Delete'),
cancelText: this.translate.instant('Cancel'),
buttonColor: 'warn',
}).pipe(
filter(Boolean),
tap(() => this.loader.open()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1 mat-dialog-title>{{ 'Delete User' | translate }}</h1>
<button
*ixRequiresRoles="requiredRoles"
mat-button
color="primary"
color="warn"
ixTest="delete"
(click)="onDelete()"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ describe('CloudBackupCardComponent', () => {
expect(spectator.inject(DialogService).confirm).toHaveBeenCalledWith({
title: 'Confirmation',
message: 'Delete Cloud Backup <b>"test one"</b>?',
buttonColor: 'warn',
buttonText: 'Delete',
});

expect(spectator.inject(ApiService).call).toHaveBeenCalledWith('cloud_backup.delete', [1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ export class CloudBackupCardComponent implements OnInit {
message: this.translate.instant('Delete Cloud Backup <b>"{name}"</b>?', {
name: row.description,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
}).pipe(
filter(Boolean),
switchMap(() => this.api.call('cloud_backup.delete', [row.id]).pipe(this.appLoader.withLoader())),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export class CloudBackupSnapshotsComponent implements OnChanges {
message: this.translate.instant('Are you sure you want to delete the <b>{name}</b>?', {
name: row.hostname,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
})
.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ describe('CloudBackupListComponent', () => {
expect(spectator.inject(DialogService).confirm).toHaveBeenCalledWith({
title: 'Confirmation',
message: 'Delete Cloud Backup <b>"UA"</b>?',
buttonColor: 'warn',
buttonText: 'Delete',
});

expect(spectator.inject(ApiService).call).toHaveBeenCalledWith('cloud_backup.delete', [1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ export class CloudBackupListComponent implements OnInit {
doDelete(row: CloudBackup): void {
this.dialogService.confirm({
title: this.translate.instant('Confirmation'),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
message: this.translate.instant('Delete Cloud Backup <b>"{name}"</b>?', {
name: row.description,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ describe('CloudSyncListComponent', () => {
expect(spectator.inject(DialogService).confirm).toHaveBeenCalledWith({
title: 'Confirmation',
message: 'Delete Cloud Sync Task <b>"custom-cloudlist"</b>?',
buttonColor: 'warn',
buttonText: 'Delete',
});

expect(spectator.inject(ApiService).call).toHaveBeenCalledWith('cloudsync.delete', [1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ export class CloudSyncListComponent implements OnInit {
message: this.translate.instant('Delete Cloud Sync Task <b>"{name}"</b>?', {
name: row.description,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
}).pipe(
filter(Boolean),
switchMap(() => this.api.call('cloudsync.delete', [row.id])),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ describe('CloudSyncTaskCardComponent', () => {
expect(spectator.inject(DialogService).confirm).toHaveBeenCalledWith({
title: 'Confirmation',
message: 'Delete Cloud Sync Task <b>"custom-cloudsync"</b>?',
buttonColor: 'warn',
buttonText: 'Delete',
});

expect(spectator.inject(ApiService).call).toHaveBeenCalledWith('cloudsync.delete', [3]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ export class CloudSyncTaskCardComponent implements OnInit {
message: this.translate.instant('Delete Cloud Sync Task <b>"{name}"</b>?', {
name: cloudsyncTask.description,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
}).pipe(
filter(Boolean),
switchMap(() => this.api.call('cloudsync.delete', [cloudsyncTask.id])),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ describe('ReplicationListComponent', () => {
expect(spectator.inject(DialogService).confirm).toHaveBeenCalledWith({
title: 'Confirmation',
message: 'Delete Replication Task <b>"pewl - pewl"</b>?',
buttonColor: 'warn',
buttonText: 'Delete',
});

expect(spectator.inject(ApiService).call).toHaveBeenCalledWith('replication.delete', [1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ export class ReplicationListComponent implements OnInit {
message: this.translate.instant('Delete Replication Task <b>"{name}"</b>?', {
name: row.name,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
}).pipe(
filter(Boolean),
switchMap(() => this.api.call('replication.delete', [row.id]).pipe(this.appLoader.withLoader())),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ describe('ReplicationTaskCardComponent', () => {
expect(spectator.inject(DialogService).confirm).toHaveBeenCalledWith({
title: 'Confirmation',
message: 'Delete Replication Task <b>"APPS/test2 - APPS/test3"</b>?',
buttonColor: 'warn',
buttonText: 'Delete',
});

expect(spectator.inject(ApiService).call).toHaveBeenCalledWith('replication.delete', [1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ export class ReplicationTaskCardComponent implements OnInit {
message: this.translate.instant('Delete Replication Task <b>"{name}"</b>?', {
name: replicationTask.name,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
}).pipe(
filter(Boolean),
switchMap(() => this.api.call('replication.delete', [replicationTask.id])),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ describe('RsyncTaskCardComponent', () => {
expect(spectator.inject(DialogService).confirm).toHaveBeenCalledWith({
title: 'Confirmation',
message: 'Delete Rsync Task <b>"asd - asdad"</b>?',
buttonColor: 'warn',
buttonText: 'Delete',
});

expect(spectator.inject(ApiService).call).toHaveBeenCalledWith('rsynctask.delete', [1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ export class RsyncTaskCardComponent implements OnInit {
message: this.translate.instant('Delete Rsync Task <b>"{name}"</b>?', {
name: `${row.remotehost || row.path} ${row.remotemodule ? '- ' + row.remotemodule : ''}`,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
}).pipe(
filter(Boolean),
switchMap(() => this.api.call('rsynctask.delete', [row.id])),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export class RsyncTaskListComponent implements OnInit {
title: this.translate.instant('Delete Task'),
message: this.translate.instant('Are you sure you want to delete this task?'),
buttonText: this.translate.instant('Delete'),
buttonColor: 'warn',
})
.pipe(
filter(Boolean),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export class ScrubListComponent implements OnInit {
title: this.translate.instant('Delete Task'),
message: this.translate.instant('Are you sure you want to delete this task?'),
buttonText: this.translate.instant('Delete'),
buttonColor: 'warn',
})
.pipe(
filter(Boolean),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ describe('ScrubTaskCardComponent', () => {
expect(spectator.inject(DialogService).confirm).toHaveBeenCalledWith({
title: 'Confirmation',
message: 'Delete Scrub Task <b>"APPS"</b>?',
buttonColor: 'warn',
buttonText: 'Delete',
});

expect(spectator.inject(ApiService).call).toHaveBeenCalledWith('pool.scrub.delete', [1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ export class ScrubTaskCardComponent implements OnInit {
this.dialogService.confirm({
title: this.translate.instant('Confirmation'),
message: this.translate.instant('Delete Scrub Task <b>"{name}"</b>?', { name: scrubTask.pool_name }),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
}).pipe(
filter(Boolean),
switchMap(() => this.api.call('pool.scrub.delete', [scrubTask.id])),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ describe('SmartTaskCardComponent', () => {
expect(spectator.inject(DialogService).confirm).toHaveBeenCalledWith({
title: 'Confirmation',
message: 'Delete S.M.A.R.T. Test <b>"LONG - test"</b>?',
buttonColor: 'warn',
buttonText: 'Delete',
});

expect(spectator.inject(ApiService).call).toHaveBeenCalledWith('smart.test.delete', [1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ export class SmartTaskCardComponent implements OnInit {
message: this.translate.instant('Delete S.M.A.R.T. Test <b>"{name}"</b>?', {
name: `${smartTask.type} - ${smartTask.desc}`,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
}).pipe(
filter(Boolean),
switchMap(() => this.api.call('smart.test.delete', [smartTask.id])),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ describe('SmartTaskCardComponent', () => {
expect(spectator.inject(DialogService).confirm).toHaveBeenCalledWith({
title: 'Confirmation',
message: 'Delete S.M.A.R.T. Test <b>"LONG - test"</b>?',
buttonColor: 'warn',
buttonText: 'Delete',
});

expect(spectator.inject(ApiService).call).toHaveBeenCalledWith('smart.test.delete', [1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ export class SmartTaskListComponent implements OnInit {
message: this.translate.instant('Delete S.M.A.R.T. Test <b>"{name}"</b>?', {
name: `${smartTask.type} - ${smartTask.desc}`,
}),
buttonColor: 'warn',
buttonText: this.translate.instant('Delete'),
}).pipe(
filter(Boolean),
switchMap(() => this.api.call('smart.test.delete', [smartTask.id])),
Expand Down
Loading

0 comments on commit 2ec11c8

Please sign in to comment.