File

libs/depiction/src/lib/datasetlist/timeseries/first-latest-timeseries-entry/first-latest-timeseries-entry.component.ts

Description

Extends the ConfigurableTimeseriesEntryComponent, with the following functions:

  • first and latest validation
  • jump to first and latest value events

Extends

ConfigurableTimeseriesEntryComponent

Implements

OnChanges

Metadata

selector n52-first-latest-timeseries-entry
styleUrls ./first-latest-timeseries-entry.component.css
templateUrl ./first-latest-timeseries-entry.component.html

Index

Properties
Methods
Inputs
Outputs

Constructor

constructor(servicesConnector: HelgolandServicesConnector, internalIdHandler: InternalIdHandler, translateSrvc: TranslateService, timeSrvc: Time)
Parameters :
Name Type Optional
servicesConnector HelgolandServicesConnector No
internalIdHandler InternalIdHandler No
translateSrvc TranslateService No
timeSrvc Time No

Inputs

timeInterval
Type : TimeInterval
datasetOptions
Type : DatasetOptions
highlight
Type : boolean
datasetId
Type : string
selected
Type : boolean
datasetId
Type : string
Inherited from ListEntryComponent
selected
Type : boolean
Inherited from ListEntryComponent

Outputs

onSelectDate
Type : EventEmitter<Date>
onEditOptions
Type : EventEmitter<DatasetOptions>
onShowGeometry
Type : EventEmitter<GeoJSON.GeoJsonObject>
onUpdateOptions
Type : EventEmitter<DatasetOptions>
onDeleteDataset
Type : EventEmitter<boolean>
onSelectDataset
Type : EventEmitter<boolean>
onDeleteDataset
Type : EventEmitter<boolean>
Inherited from ListEntryComponent
onSelectDataset
Type : EventEmitter<boolean>
Inherited from ListEntryComponent

Methods

Private checkDataInTimespan
checkDataInTimespan()
Returns : void
Public jumpToFirstTimeStamp
jumpToFirstTimeStamp()
Returns : void
Public jumpToLastTimeStamp
jumpToLastTimeStamp()
Returns : void
Public ngOnChanges
ngOnChanges(changes: SimpleChanges)
Parameters :
Name Type Optional
changes SimpleChanges No
Returns : void
Protected setParameters
setParameters()
Returns : void
Public editDatasetOptions
editDatasetOptions()
Returns : void
Public showGeometry
showGeometry()
Returns : void
Public toggleVisibility
toggleVisibility()
Returns : void
Protected loadDataset
loadDataset(lang?: string)
Parameters :
Name Type Optional
lang string Yes
Returns : void
Protected setDataset
setDataset(timeseries: HelgolandTimeseries)
Parameters :
Name Type Optional
timeseries HelgolandTimeseries No
Returns : void
Protected setParameters
setParameters()
Returns : void
Protected Abstract loadDataset
loadDataset(lang?: string)
Parameters :
Name Type Optional
lang string Yes
Returns : void
Public ngOnDestroy
ngOnDestroy()
Returns : void
Public ngOnInit
ngOnInit()
Returns : void
Protected onLanguageChanged
onLanguageChanged(langChangeEvent: LangChangeEvent)
Parameters :
Name Type Optional
langChangeEvent LangChangeEvent No
Returns : void
Public removeDataset
removeDataset()
Returns : void
Public toggleSelection
toggleSelection()
Returns : void
Protected loadDataset
loadDataset(lang?: string)
Parameters :
Name Type Optional
lang string Yes
Returns : void
Protected setDataset
setDataset(timeseries: HelgolandTimeseries)
Parameters :
Name Type Optional
timeseries HelgolandTimeseries No
Returns : void
Protected setParameters
setParameters()
Returns : void
Protected Abstract loadDataset
loadDataset(lang?: string)
Inherited from ListEntryComponent
Parameters :
Name Type Optional
lang string Yes
Returns : void
Public ngOnDestroy
ngOnDestroy()
Inherited from ListEntryComponent
Returns : void
Public ngOnInit
ngOnInit()
Inherited from ListEntryComponent
Returns : void
Protected onLanguageChanged
onLanguageChanged(langChangeEvent: LangChangeEvent)
Inherited from ListEntryComponent
Parameters :
Name Type Optional
langChangeEvent LangChangeEvent No
Returns : void
Public removeDataset
removeDataset()
Inherited from ListEntryComponent
Returns : void
Public toggleSelection
toggleSelection()
Inherited from ListEntryComponent
Returns : void

Properties

Public firstValue
Type : FirstLastValue
Public hasData
Default value : true
Public lastValue
Type : FirstLastValue
Public categoryLabel
Type : string
Public dataset
Type : HelgolandTimeseries
Public phenomenonLabel
Type : string
Public platformLabel
Type : string
Public procedureLabel
Type : string
Public uom
Type : string
Protected internalId
Type : InternalDatasetId
Private langChangeSubscription
Type : Subscription
Public loading
Type : boolean
Public categoryLabel
Type : string
Public dataset
Type : HelgolandTimeseries
Public phenomenonLabel
Type : string
Public platformLabel
Type : string
Public procedureLabel
Type : string
Public uom
Type : string
Protected internalId
Type : InternalDatasetId
Inherited from ListEntryComponent
Private langChangeSubscription
Type : Subscription
Inherited from ListEntryComponent
Public loading
Type : boolean
Inherited from ListEntryComponent
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { FirstLastValue, HelgolandServicesConnector, InternalIdHandler, Time, TimeInterval } from '@helgoland/core';
import { TranslateService } from '@ngx-translate/core';

import {
  ConfigurableTimeseriesEntryComponent,
} from '../configurable-timeseries-entry/configurable-timeseries-entry.component';

/**
 * Extends the ConfigurableTimeseriesEntryComponent, with the following functions:
 *  - first and latest validation
 *  - jump to first and latest value events
 */
@Component({
  selector: 'n52-first-latest-timeseries-entry',
  templateUrl: './first-latest-timeseries-entry.component.html',
  styleUrls: ['./first-latest-timeseries-entry.component.css']
})
export class FirstLatestTimeseriesEntryComponent extends ConfigurableTimeseriesEntryComponent implements OnChanges {

  @Input()
  public timeInterval: TimeInterval;

  @Output()
  public onSelectDate: EventEmitter<Date> = new EventEmitter();

  public firstValue: FirstLastValue;
  public lastValue: FirstLastValue;
  public hasData = true;

  constructor(
    protected servicesConnector: HelgolandServicesConnector,
    protected internalIdHandler: InternalIdHandler,
    protected translateSrvc: TranslateService,
    protected timeSrvc: Time
  ) {
    super(servicesConnector, internalIdHandler, translateSrvc);
  }

  public ngOnChanges(changes: SimpleChanges): void {
    if (changes.timeInterval) {
      this.checkDataInTimespan();
    }
  }

  public jumpToFirstTimeStamp() {
    this.onSelectDate.emit(new Date(this.dataset.firstValue.timestamp));
  }

  public jumpToLastTimeStamp() {
    this.onSelectDate.emit(new Date(this.dataset.lastValue.timestamp));
  }

  protected setParameters() {
    super.setParameters();
    this.firstValue = this.dataset.firstValue;
    this.lastValue = this.dataset.lastValue;
    this.checkDataInTimespan();
  }

  private checkDataInTimespan() {
    if (this.timeInterval && this.dataset && this.dataset.firstValue && this.dataset.lastValue) {
      this.hasData = this.timeSrvc.overlaps(
        this.timeInterval,
        this.dataset.firstValue.timestamp,
        this.dataset.lastValue.timestamp
      );
    }
  }

}
<span>{{procedureLabel}} - {{platformLabel}}</span>
<span>Has Data: {{hasData}}</span>
<button *ngIf="firstValue" (click)="jumpToFirstTimeStamp()">{{firstValue.value}} - {{firstValue.timestamp | tzDate: 'L LT z'}}</button>
<button *ngIf="lastValue" (click)="jumpToLastTimeStamp()">{{lastValue.value}} - {{lastValue.timestamp | tzDate: 'L LT z'}}</button>

./first-latest-timeseries-entry.component.css

Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""