LP1779158 Angular alert dialog component
authorBill Erickson <berickxx@gmail.com>
Fri, 4 Jan 2019 16:05:17 +0000 (11:05 -0500)
committerDan Wells <dbw2@calvin.edu>
Tue, 19 Feb 2019 22:56:42 +0000 (17:56 -0500)
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
Open-ILS/src/eg2/src/app/share/dialog/alert.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/share/dialog/alert.component.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.ts

index c83ad39..9361042 100644 (file)
@@ -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';
 // 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';
 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,
   declarations: [
     PrintComponent,
     DialogComponent,
+    AlertDialogComponent,
     ConfirmDialogComponent,
     PromptDialogComponent,
     ProgressInlineComponent,
     ConfirmDialogComponent,
     PromptDialogComponent,
     ProgressInlineComponent,
@@ -46,6 +48,7 @@ import {ProgressDialogComponent} from '@eg/share/dialog/progress.component';
     FormsModule,
     PrintComponent,
     DialogComponent,
     FormsModule,
     PrintComponent,
     DialogComponent,
+    AlertDialogComponent,
     ConfirmDialogComponent,
     PromptDialogComponent,
     ProgressInlineComponent,
     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 (file)
index 0000000..e81f697
--- /dev/null
@@ -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 (file)
index 0000000..a09e972
--- /dev/null
@@ -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;
+}
+
+
index cd51da6..185d88b 100644 (file)
@@ -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> {
 
     // Extract selected queue ID or create a new queue when requested.
     resolveQueue(): Promise<number> {
 
+        if (this.selectedQueue.freetext) {
+        /*
         if (this.selectedQueue && this.selectedQueue.freetext) {
         if (this.selectedQueue && this.selectedQueue.freetext) {
+        */
             // Free text queue selector means create a new entry.
             // TODO: first check for name dupes
 
             // 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 {
             );
 
         } 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);
             var queue_id = this.startQueueId;
             if (this.selectedQueue) queue_id = this.selectedQueue.id;
             return Promise.resolve(queue_id);
+            */
         }
     }
 
         }
     }