Newer
Older
/**
* This file is part of Anis Client.
*
* @copyright Laboratoire d'Astrophysique de Marseille / CNRS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { Observable } from 'rxjs';
import * as datasetActions from 'src/app/metamodel/actions/dataset.actions';
import * as datasetFamilySelector from 'src/app/metamodel/selectors/dataset-family.selector';
import * as datasetSelector from 'src/app/metamodel/selectors/dataset.selector';
import { Dataset, DatasetFamily, Survey } from 'src/app/metamodel/models';
import * as authSelector from '../../../auth/auth.selector';
import * as instanceSelector from '../../../metamodel/selectors/instance.selector';
import * as surveySelector from '../../../metamodel/selectors/survey.selector';
@Component({
selector: 'app-dataset-list',
templateUrl: 'dataset-list.component.html',
styleUrls: ['../documentation.component.scss']
})
export class DatasetListComponent implements OnInit {
public instanceSelected: Observable<string>;
public isAuthenticated: Observable<boolean>;
public datasetFamilyListIsLoading: Observable<boolean>;
public datasetFamilyListIsLoaded: Observable<boolean>;
public datasetFamilyList: Observable<DatasetFamily[]>;
public surveyListIsLoading: Observable<boolean>;
public surveyListIsLoaded: Observable<boolean>;
public surveyList: Observable<Survey[]>;
public datasetListIsLoading: Observable<boolean>;
public datasetListIsLoaded: Observable<boolean>;
public datasetList: Observable<Dataset[]>;
constructor(private store: Store<{ }>) {
this.instanceSelected = store.select(instanceSelector.selectInstanceNameByRoute);
this.isAuthenticated = store.select(authSelector.selectIsAuthenticated);
this.datasetFamilyListIsLoading = store.select(datasetFamilySelector.selectDatasetFamilyListIsLoading);
this.datasetFamilyListIsLoaded = store.select(datasetFamilySelector.selectDatasetFamilyListIsLoaded);
this.datasetFamilyList = store.select(datasetFamilySelector.selectAllDatasetFamilies);
this.surveyListIsLoading = store.select(surveySelector.selectSurveyListIsLoading);
this.surveyListIsLoaded = store.select(surveySelector.selectSurveyListIsLoaded);
this.surveyList = store.select(surveySelector.selectAllSurveys);
this.datasetListIsLoading = store.select(datasetSelector.selectDatasetListIsLoading);
this.datasetListIsLoaded = store.select(datasetSelector.selectDatasetListIsLoaded);
this.datasetList = store.select(datasetSelector.selectAllDatasets);
}
this.store.dispatch(datasetActions.loadDatasetList());
}
}