diff --git a/src/app/menupanel/permanentlink/permanentlink.component.ts b/src/app/menupanel/permanentlink/permanentlink.component.ts index ac42d4f5..3a7b5468 100644 --- a/src/app/menupanel/permanentlink/permanentlink.component.ts +++ b/src/app/menupanel/permanentlink/permanentlink.component.ts @@ -41,7 +41,6 @@ export class PermanentLinkComponent { if (this.bShowDialog){ this.generateAnonymousPermanentLink(); } - return; } /** @@ -55,7 +54,7 @@ export class PermanentLinkComponent { this.permanentlink = link; this.shorteningMode = false; }, () => { - this.permanentlink = "Error on retrieving permanentLink!" + this.permanentlink = "Error retrieving permanentLink." this.shorteningMode = false; }); diff --git a/src/app/menupanel/search/searchpanel.component.ts b/src/app/menupanel/search/searchpanel.component.ts index f1dda0b0..071986d0 100644 --- a/src/app/menupanel/search/searchpanel.component.ts +++ b/src/app/menupanel/search/searchpanel.component.ts @@ -469,16 +469,6 @@ export class SearchPanelComponent implements OnInit { this.sidebarService.setOpenState(true); } - /** - * Scroll to the specified layer in sidebar (Featured Layers) - * Note: Unused, was originally for scrolling to layer in Featured Layers when that was part - * of the side-bar. Kept in case we ever want to highlight the browse menu (or similar) - * @param layer the layer - */ - public scrollToLayer(layer: LayerModel) { - this.manageStateService.setLayerToExpand(layer.id); - } - /** * Check whether layer has been added to the map * diff --git a/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.html b/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.html index 843c9a4b..04abdf09 100644 --- a/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.html +++ b/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.html @@ -213,7 +213,7 @@

Borehole Analytics

{{status.jobDescription}} diff --git a/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.ts b/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.ts index 989dc1ec..1be83aed 100644 --- a/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.ts +++ b/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.ts @@ -1,7 +1,6 @@ import { environment } from '../../../../environments/environment'; import { saveAs } from 'file-saver'; import { LayerModel } from '@auscope/portal-core-ui'; -import { ManageStateService } from '@auscope/portal-core-ui'; import { NVCLBoreholeAnalyticService } from './nvcl.boreholeanalytic.service'; import { Component, @@ -12,6 +11,7 @@ import { } from '@angular/core'; import { LayerAnalyticInterface } from '../layer.analytic.interface'; import { NgForm } from '@angular/forms'; +import { UserStateService } from 'app/services/user/user-state.service'; @Component({ @@ -52,7 +52,7 @@ export class NVCLBoreholeAnalyticComponent constructor( public nvclBoreholeAnalyticService: NVCLBoreholeAnalyticService, - private manageStateService: ManageStateService + private userStateService: UserStateService ) { this.nvclform = {}; } @@ -135,10 +135,10 @@ export class NVCLBoreholeAnalyticComponent .getNVCLClassifications(algorithmOutputIds) .subscribe(classifications => { classifications = classifications.sort((a,b)=> { - var a1 = a.classText.toLowerCase(); - var b1 = b.classText.toLowerCase(); - return a1 b1? 1 :0; - }) + const a1 = a.classText.toLowerCase(); + const b1 = b.classText.toLowerCase(); + return a1 < b1 ? -1 : a1 > b1 ? 1 : 0; + }) this.classifications = classifications; }); } @@ -161,8 +161,7 @@ export class NVCLBoreholeAnalyticComponent alert('Job has been successfully submitted. The results will be sent to your email.'); this.nvclBoreholeAnalyticService.setUserEmail(this.nvclform.email); } - }, - err => { + }, () => { alert('Failed on the job submission. Please contact cg-admin@csiro.au for help!'); } ); @@ -185,7 +184,8 @@ export class NVCLBoreholeAnalyticComponent } }); } - public ChangePublish(status: any) { + + public changePublish(status: any) { const jobid = status.jobid; const published = status.published; status.published = !published; @@ -215,19 +215,11 @@ export class NVCLBoreholeAnalyticComponent } public viewOnMap(jobid: string) { - if (window.confirm('This action will link you to an external URL. Please ensure you have grant access to allow pop up from this domain.')) { + if (window.confirm('This will open a link in a new window. Please ensure you grant access to allow pop ups from this domain.')) { this.layer.filterCollection.mandatoryFilters[0].value = jobid; - // Make a state object - const state = this.manageStateService.generateOneOffState( - this.layer.id, - this.layer.filterCollection, - [] - ); - // Store state object in DB & open up window - const uncompStateStr = JSON.stringify(state); - this.manageStateService.saveStateToDB(uncompStateStr).subscribe((response: any) => { - if (response.success === true) { - window.open(environment.hostUrl + '?state=' + response.id); + this.userStateService.addState("NVCL Job " + jobid, "Result of NVCL job run " + jobid, true, true).subscribe(response => { + if (response !== '') { + window.open(environment.hostUrl + '?state=' + response); } }); } diff --git a/src/app/modalwindow/querier/querier.modal.component.html b/src/app/modalwindow/querier/querier.modal.component.html index 9a9c7f8d..b18c070a 100644 --- a/src/app/modalwindow/querier/querier.modal.component.html +++ b/src/app/modalwindow/querier/querier.modal.component.html @@ -121,7 +121,7 @@

Feature Information

style="position: inherit;padding-top: unset;margin-bottom: 20px;">
+ (click)="copyToClipboard(currentDoc)" class="btn btn-primary btn-sm"> Copy to Clipboard
diff --git a/src/app/modalwindow/querier/querier.modal.component.ts b/src/app/modalwindow/querier/querier.modal.component.ts index 334cb862..dbb4e833 100644 --- a/src/app/modalwindow/querier/querier.modal.component.ts +++ b/src/app/modalwindow/querier/querier.modal.component.ts @@ -1,9 +1,8 @@ /* eslint-disable @typescript-eslint/member-ordering */ import { ApplicationRef, ChangeDetectorRef, Component, Inject, OnInit, ElementRef, ViewChild, AfterViewInit, Renderer2 } from '@angular/core'; -import { environment } from '../../../environments/environment'; import { config } from '../../../environments/config'; import { ref } from '../../../environments/ref'; -import { CsClipboardService, GMLParserService, ManageStateService, Polygon, QuerierInfoModel, RickshawService, UtilitiesService } from '@auscope/portal-core-ui'; +import { CsClipboardService, GMLParserService, Polygon, QuerierInfoModel } from '@auscope/portal-core-ui'; import { NVCLService } from './customanalytic/nvcl/nvcl.service'; import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; import { FlatTreeControl } from '@angular/cdk/tree'; @@ -14,7 +13,6 @@ import * as X2JS from 'x2js'; import { DomSanitizer } from '@angular/platform-browser'; import { MSCLService } from '../layeranalytic/mscl/mscl.service'; import { NVCLBoreholeAnalyticService } from '../layeranalytic/nvcl/nvcl.boreholeanalytic.service'; -import { saveAs } from 'file-saver'; import { MatDialog } from '@angular/material/dialog'; export class FileNode { @@ -33,10 +31,9 @@ interface FlatNode { @Component({ selector: 'app-querier-modal-window', templateUrl: './querier.modal.component.html', - providers: [RickshawService, NVCLBoreholeAnalyticService], + providers: [NVCLBoreholeAnalyticService], styleUrls: ['../modalwindow.scss', './querier.modal.component.scss'] }) - export class QuerierModalComponent implements OnInit, AfterViewInit { [x: string]: any; @ViewChild('childElement', { static: false }) childElement: ElementRef; @@ -123,12 +120,12 @@ export class QuerierModalComponent implements OnInit, AfterViewInit { public modalVisible = true; constructor(public nvclService: NVCLService, public bsModalRef: BsModalRef, public csClipboardService: CsClipboardService, - private manageStateService: ManageStateService, private gmlParserService: GMLParserService, + private gmlParserService: GMLParserService, private http: HttpClient, @Inject('env') private env, private sanitizer: DomSanitizer, public nvclBoreholeAnalyticService: NVCLBoreholeAnalyticService, private changeDetectorRef: ChangeDetectorRef, private appRef: ApplicationRef, - private msclService: MSCLService, private renderer: Renderer2, private elementRef: ElementRef, - private modalService: BsModalService, public dialog: MatDialog, private rickshawService: RickshawService) { + private msclService: MSCLService, private renderer: Renderer2, + private modalService: BsModalService, public dialog: MatDialog) { this.analyticMap = ref.analytic; this.flagNVCLAnalytic = false; this.initialScalarLoad = true; @@ -226,34 +223,11 @@ export class QuerierModalComponent implements OnInit, AfterViewInit { return config.supportOpenInNewWindow.includes(doc.layer.id); } - public newWindow(doc: QuerierInfoModel) { - const state = _.cloneDeep(this.manageStateService.getState()); - const layerid = doc.layer.id; - for (const key in state) { - if (key !== layerid && key !== 'map') { - delete state[key]; - } - if (key === layerid) { - state[key].raw = doc.raw; - state[key].onlineResource = doc.onlineResource; // TODO: currentDoc. ??? - state[key].gmlid = doc.key; - } - } - - // Store state object in DB & open up window - const uncompStateStr = JSON.stringify(state); - this.manageStateService.saveStateToDB(uncompStateStr).subscribe((response: any) => { - if (response.success === true) { - window.open(environment.hostUrl + '?state=' + response.id); - } - }); - } - /** * Copy drawn polygon to clipboard * @param document polygon as document */ - public CopyToClipboard(document) { + public copyToClipboard(document) { const name = document.key; const doc = document.value; let polygon: Polygon; diff --git a/src/app/services/user/user-state.service.ts b/src/app/services/user/user-state.service.ts index 54bf64bf..dd1af0a3 100644 --- a/src/app/services/user/user-state.service.ts +++ b/src/app/services/user/user-state.service.ts @@ -234,9 +234,8 @@ export class UserStateService { if (UtilitiesService.isEmpty(this.roiKey)) return; - let strROIs = JSON.stringify(this.roiList); - this.apiService.saveUserParams(this.roiKey,strROIs).subscribe(response => { - }); + const strROIs = JSON.stringify(this.roiList); + this.apiService.saveUserParams(this.roiKey, strROIs).subscribe(() => {}); } /** @@ -244,7 +243,7 @@ export class UserStateService { * @param user */ public updateUserROI(user:User){ - let key = 'roiId.'+ user.email; + const key = 'roiId.'+ user.email; this.roiKey = key.replace(' ','-'); this.apiService.getUserParams(key).subscribe(strROIs => { if (strROIs) {