From 03268d65d2699b7b402aff0037e48e6566a331f8 Mon Sep 17 00:00:00 2001
From: Bill Erickson <berickxx@gmail.com>
Date: Fri, 4 Jan 2019 11:05:17 -0500
Subject: [PATCH] LP1779158 Angular alert dialog component

Similar to the PromptDialogComponent except it displays a simple message
(formatted as 'danger') and the only option available to the user is to
close the dialog.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
---
 Open-ILS/src/eg2/src/app/common.module.ts              |  3 +++
 .../src/eg2/src/app/share/dialog/alert.component.html  |  9 +++++++++
 .../src/eg2/src/app/share/dialog/alert.component.ts    | 18 ++++++++++++++++++
 .../eg2/src/app/staff/cat/vandelay/import.component.ts |  6 ++++++
 4 files changed, 36 insertions(+)
 create mode 100644 Open-ILS/src/eg2/src/app/share/dialog/alert.component.html
 create mode 100644 Open-ILS/src/eg2/src/app/share/dialog/alert.component.ts

diff --git a/Open-ILS/src/eg2/src/app/common.module.ts b/Open-ILS/src/eg2/src/app/common.module.ts
index c83ad392bc..9361042074 100644
--- a/Open-ILS/src/eg2/src/app/common.module.ts
+++ b/Open-ILS/src/eg2/src/app/common.module.ts
@@ -19,6 +19,7 @@ import {PrintService} from '@eg/share/print/print.service';
 // Globally available components
 import {PrintComponent} from '@eg/share/print/print.component';
 import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {AlertDialogComponent} from '@eg/share/dialog/alert.component';
 import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
 import {PromptDialogComponent} from '@eg/share/dialog/prompt.component';
 import {ProgressInlineComponent} from '@eg/share/dialog/progress-inline.component';
@@ -28,6 +29,7 @@ import {ProgressDialogComponent} from '@eg/share/dialog/progress.component';
   declarations: [
     PrintComponent,
     DialogComponent,
+    AlertDialogComponent,
     ConfirmDialogComponent,
     PromptDialogComponent,
     ProgressInlineComponent,
@@ -46,6 +48,7 @@ import {ProgressDialogComponent} from '@eg/share/dialog/progress.component';
     FormsModule,
     PrintComponent,
     DialogComponent,
+    AlertDialogComponent,
     ConfirmDialogComponent,
     PromptDialogComponent,
     ProgressInlineComponent,
diff --git a/Open-ILS/src/eg2/src/app/share/dialog/alert.component.html b/Open-ILS/src/eg2/src/app/share/dialog/alert.component.html
new file mode 100644
index 0000000000..e81f697c6e
--- /dev/null
+++ b/Open-ILS/src/eg2/src/app/share/dialog/alert.component.html
@@ -0,0 +1,9 @@
+<ng-template #dialogContent>
+  <div class="modal-body">
+    <div class="alert alert-danger">{{dialogBody}}</div>
+  </div>
+  <div class="modal-footer">
+    <button type="button" class="btn btn-success" 
+      (click)="close()" i18n>OK</button>
+  </div>
+</ng-template>
diff --git a/Open-ILS/src/eg2/src/app/share/dialog/alert.component.ts b/Open-ILS/src/eg2/src/app/share/dialog/alert.component.ts
new file mode 100644
index 0000000000..a09e972541
--- /dev/null
+++ b/Open-ILS/src/eg2/src/app/share/dialog/alert.component.ts
@@ -0,0 +1,18 @@
+import {Component, Input, ViewChild, TemplateRef} from '@angular/core';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
+
+@Component({
+  selector: 'eg-alert-dialog',
+  templateUrl: './alert.component.html'
+})
+
+/**
+ * Alertation dialog that requests user input.
+ */
+export class AlertDialogComponent extends DialogComponent {
+
+    // What are we warning the user with?
+    @Input() public dialogBody: string;
+}
+
+
diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.ts
index cd51da658d..185d88bd67 100644
--- a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.ts
@@ -371,7 +371,10 @@ export class ImportComponent implements OnInit, AfterViewInit, OnDestroy {
     // Extract selected queue ID or create a new queue when requested.
     resolveQueue(): Promise<number> {
 
+        if (this.selectedQueue.freetext) {
+        /*
         if (this.selectedQueue && this.selectedQueue.freetext) {
+        */
             // Free text queue selector means create a new entry.
             // TODO: first check for name dupes
 
@@ -384,9 +387,12 @@ export class ImportComponent implements OnInit, AfterViewInit, OnDestroy {
             );
 
         } else {
+            return Promise.resolve(this.selectedQueue.id);
+            /*
             var queue_id = this.startQueueId;
             if (this.selectedQueue) queue_id = this.selectedQueue.id;
             return Promise.resolve(queue_id);
+            */
         }
     }
 
-- 
2.11.0