41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import { DialogRef, DIALOG_DATA } from "@angular/cdk/dialog";
|
|
import { Component, Inject, OnInit } from "@angular/core";
|
|
|
|
export interface BulkStatusDetails {
|
|
title: string;
|
|
subTitle: string;
|
|
columnTitle: string;
|
|
message: string;
|
|
details: BulkOperationStatus[];
|
|
}
|
|
|
|
export class BulkOperationStatus {
|
|
id: string;
|
|
name: string;
|
|
errorMessage?: string;
|
|
}
|
|
|
|
@Component({
|
|
selector: "sm-bulk-status-dialog",
|
|
templateUrl: "./bulk-status-dialog.component.html",
|
|
})
|
|
export class BulkStatusDialogComponent implements OnInit {
|
|
constructor(public dialogRef: DialogRef, @Inject(DIALOG_DATA) public data: BulkStatusDetails) {}
|
|
|
|
ngOnInit(): void {
|
|
// TODO remove null checks once strictNullChecks in TypeScript is turned on.
|
|
if (
|
|
!this.data.title ||
|
|
!this.data.subTitle ||
|
|
!this.data.columnTitle ||
|
|
!this.data.message ||
|
|
!(this.data.details?.length >= 1)
|
|
) {
|
|
this.dialogRef.close();
|
|
throw new Error(
|
|
"The bulk status dialog was not called with the appropriate operation values."
|
|
);
|
|
}
|
|
}
|
|
}
|