Bläddra i källkod

refactor: Import HsLanguageModule for hsTranslate pipe

raitis 2 år sedan
förälder
incheckning
544f0c8ff0

+ 20 - 1
src/app/calculator/calculator-panel.component.ts

@@ -7,8 +7,10 @@ import {
   HsLayoutService,
   // eslint-disable-next-line import/named
   HsPanelComponent,
+  HsSidebarService,
 } from 'hslayers-ng';
 
+import {AppService} from '../app.service';
 import {FcCalculatorService, Index} from './calculator.service';
 import {FcFieldService} from './field.service';
 
@@ -31,7 +33,9 @@ export class FcCalculatorComponent implements HsPanelComponent, OnInit {
     public calcService: FcCalculatorService,
     private fieldService: FcFieldService,
     public hsLanguageService: HsLanguageService,
-    public hsLayoutService: HsLayoutService
+    public hsLayoutService: HsLayoutService,
+    private hsSidebarService: HsSidebarService,
+    private appService: AppService
   ) {
     this.fieldService.fieldSelects.subscribe(({features}) => {
       this.data.selectedFieldsProperties = [];
@@ -50,6 +54,21 @@ export class FcCalculatorComponent implements HsPanelComponent, OnInit {
 
   ngOnInit() {
     this.data.selectedProduct = null;
+    this.hsSidebarService.addButton(
+      {
+        panel: 'calculator',
+        module: 'calculator',
+        order: 0,
+        fits: true,
+        visible: true,
+        title: 'Field Calculator', //() =>
+        //this.hsLanguageService.getTranslation('ADJUSTER.adjustFactors'),
+        description: 'Adjust factors for computation',
+        icon: 'icon-analytics-piechart',
+      },
+      'default'
+    );
+    this.appService.init();
     this.calcService.addLayersFromComposition(
       'https://www.agrihub.cz/rest/hana_kubickova92/maps/voda',
       {path: 'Voda'}

+ 2 - 3
src/app/calculator/calculator.module.ts

@@ -2,9 +2,8 @@ import {CUSTOM_ELEMENTS_SCHEMA, NgModule} from '@angular/core';
 import {CommonModule} from '@angular/common';
 import {FormsModule} from '@angular/forms';
 import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
-import {TranslateModule} from '@ngx-translate/core';
 
-import {HsPanelHelpersModule} from 'hslayers-ng';
+import {HsLanguageModule, HsPanelHelpersModule} from 'hslayers-ng';
 
 import {FcCalculatorComponent} from './calculator-panel.component';
 
@@ -15,7 +14,7 @@ import {FcCalculatorComponent} from './calculator-panel.component';
     FormsModule,
     HsPanelHelpersModule,
     NgbModule,
-    TranslateModule,
+    HsLanguageModule,
   ],
   exports: [],
   declarations: [FcCalculatorComponent],