File

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

Description

Implements the abstract ListEntryComponent, which has the following functions:

  • can be selected and is selectable internally, with a corresponding output event
  • can be deleted, which also triggers an output event
  • translatable, so it triggers the methode onLanguageChanged when the language is switched

Extends

ListEntryComponent

Metadata

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

Index

Properties
Methods
Inputs
Outputs

Constructor

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

Inputs

datasetId
Type : string
Inherited from ListEntryComponent
selected
Type : boolean
Inherited from ListEntryComponent

Outputs

onDeleteDataset
Type : EventEmitter<boolean>
Inherited from ListEntryComponent
onSelectDataset
Type : EventEmitter<boolean>
Inherited from ListEntryComponent

Methods

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 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 } from '@angular/core';
import {
  DatasetFilter,
  DatasetType,
  HelgolandTimeseries,
  InternalIdHandler,
  HelgolandServicesConnector,
} from '@helgoland/core';
import { TranslateService } from '@ngx-translate/core';

import { ListEntryComponent } from '../../list-entry.component';

/**
 * Implements the abstract ListEntryComponent, which has the following functions:
 *  - can be selected and is selectable internally, with a corresponding output event
 *  - can be deleted, which also triggers an output event
 *  - translatable, so it triggers the methode onLanguageChanged when the language is switched
 */
@Component({
  selector: 'n52-simple-timeseries-entry',
  templateUrl: './simple-timeseries-entry.component.html',
  styleUrls: ['./simple-timeseries-entry.component.css']
})
export class SimpleTimeseriesEntryComponent extends ListEntryComponent {

  public dataset: HelgolandTimeseries;

  public platformLabel: string;
  public phenomenonLabel: string;
  public procedureLabel: string;
  public categoryLabel: string;
  public uom: string;

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

  protected loadDataset(lang?: string): void {
    const params: DatasetFilter = {};
    if (lang) { params.lang = lang; }
    this.loading = true;
    this.servicesConnector.getDataset(this.internalId, { ...params, type: DatasetType.Timeseries })
      .subscribe(dataset => this.setDataset(dataset));
  }

  protected setDataset(timeseries: HelgolandTimeseries) {
    this.dataset = timeseries;
    this.setParameters();
    this.loading = false;
  }

  protected setParameters() {
    this.platformLabel = this.dataset.platform.label;
    this.phenomenonLabel = this.dataset.parameters.phenomenon.label;
    this.procedureLabel = this.dataset.parameters.procedure.label;
    this.categoryLabel = this.dataset.parameters.category.label;
    this.uom = this.dataset.uom;
  }
}
<span>Platform: {{platformLabel}}</span>
<span>Phenomenon: {{phenomenonLabel}}</span>
<span>Procedure: {{procedureLabel}}</span>
<span>Category: {{categoryLabel}}</span>
<span>Uom: {{uom}}</span>
<button (click)="toggleSelection()">select</button>
<button (click)="removeDataset()">remove</button>

./simple-timeseries-entry.component.css

Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""