Newer
Older
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import * as documentationActions from '../store/documentation.action';
import * as fromDocumentation from '../store/documentation.reducer';
import * as documentationSelector from '../store/documentation.selector';
import { Dataset, Attribute } from 'src/app/metamodel/model';
import { environment } from '../../../environments/environment';
import { ScrollTopService } from "../../shared/service/sroll-top.service";
@Component({
selector: 'app-documentation',
templateUrl: 'documentation.component.html',
styleUrls: ['documentation.component.css']
})
export class DocumentationComponent implements OnInit {
public apiPath: string = environment.apiUrl;
public datasetListIsLoading: Observable<boolean>;
public datasetListIsLoaded: Observable<boolean>;
public datasetList: Observable<Dataset[]>;
public attributeListIsLoading: Observable<boolean>;
public attributeListIsLoaded: Observable<boolean>;
public attributeList: Observable<Attribute[]>;
constructor(private store: Store<{ documentation: fromDocumentation.State }>, private scrollTopService: ScrollTopService) {
this.datasetListIsLoading = store.select(documentationSelector.getDatasetListIsLoading);
this.datasetListIsLoaded = store.select(documentationSelector.getDatasetListIsLoaded);
this.datasetList = store.select(documentationSelector.getDatasetList);
this.attributeListIsLoading = store.select(documentationSelector.getAttributeListIsLoading);
this.attributeListIsLoaded = store.select(documentationSelector.getAttributeListIsLoaded);
this.attributeList = store.select(documentationSelector.getAttributeList);
ngOnInit() {
this.store.dispatch(new documentationActions.RetrieveDatasetList());
getDatasetAttributes(dataset: Dataset, attributeList: Attribute[]): Attribute[] {
return attributeList
.filter(attribute => attribute.table_name === dataset.table_ref)