Skip to content

Commit

Permalink
AUS-3693 Enable 'Analytics' tab only when there are MSCL observations…
Browse files Browse the repository at this point in the history
… available
  • Loading branch information
vjf committed Dec 1, 2022
1 parent d09bf7c commit 8663054
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 33 deletions.
15 changes: 0 additions & 15 deletions src/app/menupanel/common/filterpanel/filterpanel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,6 @@ export class FilterPanelComponent implements OnInit {
optionalFilters: _.cloneDeep(this.optionalFilters)
};

// VT: append advance filter to mandatory filter.
/*
// deprecated, use AdvanceFilterDirective
for (const idx in this.advancedParam) {
if (!this.layer.filterCollection.mandatoryFilters) {
this.layer.filterCollection.mandatoryFilters = [];
}
this.layer.filterCollection.mandatoryFilters.push({
parameter: idx,
value: this.advancedParam[idx]
});
}
*/
// VT: End append

// TODO: Store time period with state
// WMS layers may have a time set
if (this.layerTimes.currentTime) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { LayerAnalyticInterface } from './layer.analytic.interface';
export class DynamicLayerAnalyticComponent {
private _layer: LayerModel;
@ViewChild('dynamicLayerContentAnalyticPlaceholder', { read: ViewContainerRef, static: true })
dyanmicAnalyticHost: ViewContainerRef;
dynamicAnalyticHost: ViewContainerRef;


constructor(private componentFactoryResolver: ComponentFactoryResolver, private changeDetectorRef: ChangeDetectorRef ) { }
Expand All @@ -34,7 +34,7 @@ export class DynamicLayerAnalyticComponent {

const componentFactory = this.componentFactoryResolver.resolveComponentFactory(ref.layeranalytic[this._layer.id]);

const viewContainerRef = this.dyanmicAnalyticHost
const viewContainerRef = this.dynamicAnalyticHost
viewContainerRef.clear();
const componentRef = viewContainerRef.createComponent(componentFactory);

Expand Down
8 changes: 5 additions & 3 deletions src/app/modalwindow/querier/dynamic.analytic.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class DynamicAnalyticComponent {
@Input() doc: QuerierInfoModel;
private _load: boolean;
@ViewChild('dynamicContentAnalyticPlaceholder', { read: ViewContainerRef, static: true })
dyanmicAnalyticHost: ViewContainerRef;
dynamicAnalyticHost: ViewContainerRef;


constructor(private changeDetectorRef: ChangeDetectorRef) { }
Expand All @@ -36,9 +36,11 @@ export class DynamicAnalyticComponent {

loadComponent() {

const viewContainerRef = this.dyanmicAnalyticHost
const viewContainerRef = this.dynamicAnalyticHost
viewContainerRef.clear();
const componentRef = viewContainerRef.createComponent(ref.analytic[this.layer.id]);
// Default to MSCLComponent
const component = this.layer.id in ref.analytic? ref.analytic[this.layer.id]: MSCLComponent;
const componentRef = viewContainerRef.createComponent(component);

(<NVCLDatasetListComponent>componentRef.instance).layer = this.layer;
(<NVCLDatasetListComponent>componentRef.instance).onlineResource = this.onlineResource;
Expand Down
15 changes: 8 additions & 7 deletions src/app/modalwindow/querier/querier.modal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h4 class="card-title">
<div class="card-header">
<ul id="querier-card-tab" class="nav nav-tabs float-right">
<li (click)="doc.home=true;doc.analytic=false;onDataChange()" [ngClass]="{'active':doc.home}"><a href="#{{doc.key}}-card-tab-home" data-toggle="tab"><i class="fa fa-list"></i><span class="d-none d-md-inline"> WFS</span></a></li>
<li (click)="doc.home=false;doc.analytic=true;onDataChange()" [ngClass]="{'active':doc.analytic}" title="Show analytic" *ngIf="(isNVCL(doc.layer.id) && flagAnalytic || !isNVCL(doc.layer.id)) && analyticMap[doc.layer.id] || hasMsclAnalytics" ><a href="#{{doc.key}}-card-tab-profile" data-toggle="tab"><i class="fa fa-line-chart"></i><span class="d-none d-md-inline">&nbsp;Analytic</span></a></li>
<li (click)="doc.home=false;doc.analytic=true;onDataChange()" [ngClass]="{'active':doc.analytic}" title="Show analytic" *ngIf="(isNVCL(doc.layer.id) && flagNVCLAnalytic || !isNVCL(doc.layer.id)) && analyticMap[doc.layer.id] || hasMsclAnalytics" ><a href="#{{doc.key}}-card-tab-profile" data-toggle="tab"><i class="fa fa-line-chart"></i><span class="d-none d-md-inline">&nbsp;Analytic</span></a></li>
</ul>
<h4 *ngIf="doc.home" class="card-title">Feature Detail</h4>
<h4 *ngIf="doc.analytic" class="card-title">Analytic</h4>
Expand All @@ -53,6 +53,7 @@ <h4 *ngIf="doc.analytic" class="card-title">Analytic</h4>
<!-- BEGIN tab-content -->
<div id="card-tab-content" class="tab-content" style="max-height:calc(75vh)">
<!-- BEGIN tab-pane -->
<!-- Content of WFS Tab -->
<div *ngIf="doc.key !== 'Server Error'" class="tab-pane fade" [ngClass]="{'active show':doc.home}" id="{{doc.key}}-card-tab-home">
<div *ngIf="bToClipboard || supportOpenInNewWindow(doc)" style="position: inherit;padding-top: unset;margin-bottom: 20px;">
<div class="float-left d-none d-md-inline mt-0 w-100">
Expand All @@ -64,11 +65,10 @@ <h4 *ngIf="doc.analytic" class="card-title">Analytic</h4>
<!-- Show HTML if XML is transformed -->
<div *ngIf="doc.transformed" [innerHtml]="doc.transformed"></div>
<!-- Show default XML Tree if there is no HTML transformation -->
<mat-tree *ngIf="flatTreeDataSource[doc.key]" [dataSource]="flatTreeDataSource[doc.key]" [treeControl]="flatTreeControl[doc.key]"
class="example-tree">
<mat-tree *ngIf="flatTreeDataSource[doc.key]" [dataSource]="flatTreeDataSource[doc.key]" [treeControl]="flatTreeControl[doc.key]">
<dl>
<!-- Node without children -->
<mat-tree-node *matTreeNodeDef="let node" style="font-size: 12px !important; min-height: 0px" [matTreeNodePaddingIndent]="15" matTreeNodePadding>
<mat-tree-node *matTreeNodeDef="let node" style="font-size: 12px !important; min-height: 0px" [matTreeNodePaddingIndent]="10" matTreeNodePadding>
<dt style="flex: auto;">{{node.filename}}</dt>
<dd>{{node.type}}
<a *ngIf="node.type && node.type.toString().startsWith('http')" target="_blank" href="{{node.type}}">
Expand All @@ -77,7 +77,7 @@ <h4 *ngIf="doc.analytic" class="card-title">Analytic</h4>
</dd>
</mat-tree-node>
<!-- Node with children -->
<mat-tree-node *matTreeNodeDef="let node; when: hasChild" [matTreeNodePaddingIndent]="15" matTreeNodePadding>
<mat-tree-node *matTreeNodeDef="let node; when: hasChild" [matTreeNodePaddingIndent]="10" matTreeNodePadding>
<dt style="flex: auto; font-size: 12px !important">
<button mat-icon-button matTreeNodeToggle [matTreeNodeToggleRecursive]="true" [attr.aria-label]="'toggle ' + node.filename">
<mat-icon class="mat-icon-rtl-mirror">
Expand All @@ -98,10 +98,11 @@ <h4 *ngIf="doc.analytic" class="card-title">Analytic</h4>
<div *ngIf="doc.key === 'Server Error'" class="tab-pane fade" [ngClass]="{'active show':doc.home}" id="{{doc.key}}-card-tab-home">
<p>Sorry - {{doc.onlineResource.url}} server has returned an error message. See browser console for more information</p>
</div>

<!-- END tab-pane -->

<!-- BEGIN tab-pane -->
<div *ngIf="analyticMap[doc.layer.id]" class="tab-pane fade" [ngClass]="{'active show':doc.analytic}" id="{{doc.key}}-card-tab-profile">
<!-- Content of Analytics Tab -->
<div *ngIf="analyticMap[doc.layer.id] || hasMsclAnalytics" class="tab-pane fade" [ngClass]="{'active show':doc.analytic}" id="{{doc.key}}-card-tab-profile">
<app-custom-analytic [layer]="doc.layer" [load]="doc.loadSubComponent" [onlineResource] = "doc.onlineResource" [featureId]="doc.key" [doc] = "doc"></app-custom-analytic>
</div>
<!-- END tab-pane -->
Expand Down
10 changes: 6 additions & 4 deletions src/app/modalwindow/querier/querier.modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,26 @@ export class QuerierModalComponent implements OnInit {
*
* If this was not done the two components would not see the same state of the service variable "isAnalytic"
*/
public flagAnalytic: boolean;
public flagNVCLAnalytic: boolean;

constructor(public nvclService: NVCLService, public bsModalRef: BsModalRef, public csClipboardService: CsClipboardService,
private manageStateService: ManageStateService, private gmlParserService: GMLParserService,
private http: HttpClient, @Inject('env') private env, private sanitizer: DomSanitizer,
private changeDetectorRef: ChangeDetectorRef, private appRef: ApplicationRef,
private msclService: MSCLService) {
this.analyticMap = ref.analytic;
this.flagAnalytic = false;
this.flagNVCLAnalytic = false;
}

ngOnInit() {

/**
* Checks the state of "isAnalytic" variable in the nvclService - observable
* and updates the local variable "flagAnalytic" - which updates the Analytic TAB in the html
* and updates the local variable "flagNVCLAnalytic" - which updates the Analytic TAB in the html
*/
this.nvclService.getAnalytic().subscribe((result) => {
// console.log("[querier]ngOnInit().getAnalytic() = "+result);
this.flagAnalytic = result;
this.flagNVCLAnalytic = result;

// Calling this to update the UI
this.onDataChange();
Expand Down Expand Up @@ -289,6 +289,8 @@ export class QuerierModalComponent implements OnInit {
this.flatTreeControl[name] = new FlatTreeControl<FlatNode>(node => node.level, node => node.expandable);
this.flatTreeDataSource[name] = new MatTreeFlatDataSource(this.flatTreeControl[name], this.treeFlattener);
this.flatTreeDataSource[name].data = data;
this.flatTreeControl[name].expandAll();
this.changeDetectorRef.detectChanges();
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/environments/ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export const ref = {
'tima-geosample': TIMAComponent,
'remanent-anomalies': RemanentAnomaliesComponent,
'remanent-anomalies-EMAG': RemanentAnomaliesComponent,
'mscl-borehole': MSCLComponent,
'mscl-gssa-borehole': MSCLComponent
'mscl-borehole': MSCLComponent
},
layeranalytic: {
'nvcl-v2-borehole': NVCLBoreholeAnalyticComponent
Expand Down

0 comments on commit 8663054

Please sign in to comment.