Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* 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/store/actions/dataset.actions';
import * as datasetSelector from 'src/app/metamodel/store/selectors/dataset.selector';
import { Dataset } from 'src/app/metamodel/store/models';
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-documentation',
templateUrl: 'documentation.component.html',
styleUrls: ['documentation.component.scss']
})
/**
* @class
* @classdesc Documentation container.
*
* @implements OnInit
*/
export class DocumentationComponent implements OnInit {
public datasetListIsLoading: Observable<boolean>;
public datasetListIsLoaded: Observable<boolean>;
public datasetList: Observable<Dataset[]>;
constructor(private store: Store<{ }>) {
this.datasetListIsLoading = store.select(datasetSelector.selectDatasetListIsLoading);
this.datasetListIsLoaded = store.select(datasetSelector.selectDatasetListIsLoaded);
this.datasetList = store.select(datasetSelector.selectAllDatasets);
}
ngOnInit() {
this.store.dispatch(datasetActions.loadDatasetList());
}
/**
* Returns strict url address.
*
* @return string
*/
getUrlServer(): string {
if (!environment.apiUrl.startsWith('http')) {
const url = window.location;
return url.protocol + '//' + url.host + environment.apiUrl;
}
return environment.apiUrl;
}
}