-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#226 added generic Alert Dialog for messaging
- Loading branch information
1 parent
218da45
commit 1b0da3d
Showing
3 changed files
with
146 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<h1 mat-dialog-title>{{title}}</h1> | ||
<div mat-dialog-content>{{message}}</div> | ||
<div mat-dialog-actions> | ||
<button *ngIf="showOkButton" mat-stroked-button color="primary" cdkFocusInitial (click)="onOkClick()">{{okButtonText}}</button> | ||
<button *ngIf="showCancelButton" mat-stroked-button color="secondary" cdkFocusInitial (click)="onNoClick()">{{cancelButtonText}}</button> | ||
</div> |
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,75 @@ | ||
:host { | ||
h1.mat-dialog-title { | ||
width: auto; | ||
background-color: #333; | ||
color: #fff; | ||
font-size: 1em; | ||
margin: 0; | ||
padding: 5px 10px; | ||
font-weight: normal; | ||
} | ||
|
||
.mat-dialog-content { | ||
margin: 20px -24px 0 -24px; | ||
} | ||
|
||
.section-instructions { | ||
margin: 20px 0; | ||
font-size: .8rem; | ||
} | ||
|
||
.stream-parameters { | ||
border: 1px solid rgb(41, 41, 41); | ||
margin: 20px 0 20px 0; | ||
|
||
|
||
.parameters-body { | ||
padding: 20px; | ||
} | ||
} | ||
.mat-dialog-actions { | ||
justify-content: flex-end; | ||
} | ||
|
||
.row { | ||
display: block; | ||
} | ||
.sc-row-1 { | ||
mat-form-field { | ||
margin-right: 2rem; | ||
} | ||
} | ||
.sc-row-2 { | ||
mat-form-field { | ||
width: 182px; | ||
margin-right: 2rem; | ||
/*font-size: 13px;*/ | ||
} | ||
} | ||
.sc-row-3 { | ||
mat-form-field { | ||
margin-right: 2rem; | ||
/*font-size: 13px;*/ | ||
} | ||
} | ||
.sc-row-5 { | ||
mat-form-field { | ||
margin-left: 1rem; | ||
} | ||
} | ||
|
||
.test-status { | ||
border-radius: 5px; | ||
border: 1px solid rgb(53, 53, 53); | ||
background-color: #bababa; | ||
padding: 8px; | ||
font-size: .7rem; | ||
color: #373737; | ||
-ms-user-select:none; | ||
-moz-user-select:none; | ||
-webkit-user-select:none; | ||
-webkit-touch-callout: none; | ||
-khtml-user-select: none; | ||
user-select:none; | ||
} | ||
} |
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,65 @@ | ||
import { AfterViewInit, Component, Inject, OnDestroy, OnInit } from '@angular/core'; | ||
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; | ||
import { WebSocketService } from '../../services/websocket.service'; | ||
import { AdminBulkDataService } from '../../services/admin.bulk-data.service'; | ||
import { AdminStreamConnProperties, AdminStreamAnalysisConfig, AdminStreamLoadConfig } from '../models/AdminStreamConnection'; | ||
import { Subject } from 'rxjs'; | ||
|
||
@Component({ | ||
selector: 'alert-dialog', | ||
templateUrl: 'alert-dialog.component.html', | ||
styleUrls: ['alert-dialog.component.scss'] | ||
}) | ||
export class AlertDialogComponent implements OnInit, OnDestroy, AfterViewInit { | ||
/** subscription to notify subscribers to unbind */ | ||
public unsubscribe$ = new Subject<void>(); | ||
public testStatus = ""; | ||
public isTesting = false; | ||
public title = "Alert"; | ||
public message = ''; | ||
public okButtonText = "Ok"; | ||
public cancelButtonText = "Cancel"; | ||
public showOkButton = true; | ||
public showCancelButton = false; | ||
|
||
constructor( | ||
public dialogRef: MatDialogRef<AlertDialogComponent>, | ||
@Inject(MAT_DIALOG_DATA) public data: { | ||
title: string, | ||
message: string, | ||
okText?: string, | ||
cancelText?: string, | ||
showOkButton?: boolean, | ||
showCancelButton?: boolean | ||
}) { | ||
this.title = (data && data.title) ? data.title : this.title; | ||
this.message = (data && data.message) ? data.message : this.message; | ||
this.okButtonText = (data && data.okText) ? data.okText : this.okButtonText; | ||
this.cancelButtonText = (data && data.cancelText) ? data.cancelText : this.cancelButtonText; | ||
this.showOkButton = (data && data.showOkButton !== undefined) ? data.showOkButton : this.showOkButton; | ||
this.showCancelButton = (data && data.showCancelButton !== undefined) ? data.showCancelButton : this.showCancelButton; | ||
} | ||
/** | ||
* listen for websocket service errors | ||
*/ | ||
ngOnInit() { | ||
|
||
} | ||
|
||
ngAfterViewInit() {} | ||
|
||
/** | ||
* unsubscribe event streams | ||
*/ | ||
ngOnDestroy() { | ||
this.unsubscribe$.next(); | ||
this.unsubscribe$.complete(); | ||
} | ||
|
||
onNoClick(): void { | ||
this.dialogRef.close(false); | ||
} | ||
onOkClick(): void { | ||
this.dialogRef.close(true) | ||
} | ||
} |