LP1830391 Hatch core mod import/export repairs
authorBill Erickson <berickxx@gmail.com>
Mon, 5 Aug 2019 14:44:55 +0000 (10:44 -0400)
committerJason Boyer <JBoyer@eoli.info>
Fri, 13 Dec 2019 14:36:29 +0000 (09:36 -0500)
No need to import/export HatchService from the base common module since
it's now a core service which is exported automatically to root.

Includes minor lint repair.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jason Boyer <JBoyer@eoli.info>

Open-ILS/src/eg2/src/app/common.module.ts
Open-ILS/src/eg2/src/app/share/print/print.component.ts

index ab41d5a..56eddab 100644 (file)
@@ -14,7 +14,6 @@ They do not have to be added to the providers list.
 */
 
 // consider moving these to core...
-import {HatchService} from '@eg/share/print/hatch.service';
 import {HtmlToTxtService} from '@eg/share/util/htmltotxt.service';
 import {PrintService} from '@eg/share/print/print.service';
 
@@ -81,7 +80,6 @@ export class EgCommonModule {
             ngModule: EgCommonModule,
             providers: [
                 HtmlToTxtService,
-                HatchService,
                 PrintService,
                 ToastService
             ]
index 91341de..708ebf3 100644 (file)
@@ -28,8 +28,6 @@ export class PrintComponent implements OnInit {
 
     printQueue: PrintRequest[];
 
-    useHatch: boolean;
-
     constructor(
         private renderer: Renderer2,
         private elm: ElementRef,
@@ -50,9 +48,6 @@ export class PrintComponent implements OnInit {
 
         this.htmlContainer =
             this.renderer.selectRootElement('#eg-print-html-container');
-
-        this.serverStore.getItem('eg.hatch.enable.printing')
-            .then(use => this.useHatch = use);
     }
 
     handlePrintRequest(printReq: PrintRequest) {
@@ -171,7 +166,7 @@ export class PrintComponent implements OnInit {
             show_dialog: printReq.showDialog
         });
 
-        if (this.useHatch) {
+        if (this.useHatch()) {
             this.printViaHatch(printReq);
         } else {
             // Here the needed HTML is already in the page.
@@ -179,6 +174,11 @@ export class PrintComponent implements OnInit {
         }
     }
 
+    useHatch(): boolean {
+        return this.store.getLocalItem('eg.hatch.enable.printing')
+            && this.hatch.connect();
+    }
+
     printViaHatch(printReq: PrintRequest) {
         if (!printReq.contentType) {
             printReq.contentType = 'text/html';