Skip to content
Snippets Groups Projects
Commit 4c59bcb0 authored by Tifenn Guillas's avatar Tifenn Guillas
Browse files

Fix bug due to refactoring

parent 2c0ee254
No related branches found
No related tags found
2 merge requests!147Develop,!137Resolve "[Module Multiple] : ajouter le nouveau module"
<div *ngIf="(datasetSearchMetaIsLoading | async) || (attributeSearchMetaIsLoading | async) || !(dataLengthIsLoaded | async)"
<div *ngIf="(datasetSearchMetaIsLoading | async) || (attributeListIsLoading | async) || !(dataLengthIsLoaded | async)"
class="row justify-content-center mt-5">
<span class="fas fa-circle-notch fa-spin fa-3x"></span>
<span class="sr-only">Loading...</span>
</div>
<div *ngIf="(datasetSearchMetaIsLoaded | async) && (attributeSearchMetaIsLoaded | async)" class="row mt-4">
<div *ngIf="(datasetSearchMetaIsLoaded | async) && (attributeListIsLoaded | async)" class="row mt-4">
<div class="col-12">
<app-result-download
[datasetName]="datasetName | async"
......@@ -17,7 +17,7 @@
(getDataLength)="getDataLength()">
</app-result-download>
<app-reminder
[datasetAttributeList]="datasetAttributeList | async"
[datasetAttributeList]="attributeList | async"
[dataLengthIsLoaded]="dataLengthIsLoaded | async"
[isConeSearchAdded]="isConeSearchAdded | async"
[coneSearch]="coneSearch | async"
......@@ -39,7 +39,7 @@
<app-datatable-tab
[datasetName]="datasetName | async"
[datasetList]="datasetList | async"
[datasetAttributeList]="datasetAttributeList | async"
[datasetAttributeList]="attributeList | async"
[outputList]="outputList | async"
[searchData]="searchData | async"
[dataLengthIsLoaded]="dataLengthIsLoaded | async"
......
......@@ -2,6 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Component, Input } from '@angular/core';
import { MockStore, provideMockStore } from '@ngrx/store/testing';
import { of } from 'rxjs';
import { ResultComponent } from './result.component';
import * as fromSearch from '../store/search.reducer';
......@@ -103,6 +104,7 @@ describe('[Search] Container: ResultComponent', () => {
});
it('should execute ngOnInit lifecycle', (done) => {
component.datasetName = of('toto');
const loadDatasetSearchMetaAction = new datasetActions.LoadDatasetSearchMetaAction();
const changeStepAction = new searchActions.ChangeStepAction('result');
const resultChecked = new searchActions.ResultChecked();
......
......@@ -28,12 +28,12 @@ interface StoreState {
export class ResultComponent implements OnInit, OnDestroy {
public datasetSearchMetaIsLoading: Observable<boolean>;
public datasetSearchMetaIsLoaded: Observable<boolean>;
public attributeSearchMetaIsLoading: Observable<boolean>;
public attributeSearchMetaIsLoaded: Observable<boolean>;
public datasetName: Observable<string>;
public currentStep: Observable<string>;
public datasetList: Observable<Dataset[]>;
public datasetAttributeList: Observable<Attribute[]>;
public attributeListIsLoading: Observable<boolean>;
public attributeListIsLoaded: Observable<boolean>;
public attributeList: Observable<Attribute[]>;
public criteriaFamilyList: Observable<Family[]>;
public criteriaList: Observable<Criterion[]>;
public isConeSearchAdded: Observable<boolean>;
......@@ -53,12 +53,9 @@ export class ResultComponent implements OnInit, OnDestroy {
constructor(private store: Store<StoreState>, private scrollTopService: ScrollTopService) {
this.datasetSearchMetaIsLoading = store.select(metamodelSelector.getDatasetSearchMetaIsLoading);
this.datasetSearchMetaIsLoaded = store.select(metamodelSelector.getDatasetSearchMetaIsLoaded);
this.attributeSearchMetaIsLoading = store.select(metamodelSelector.getAttributeSearchMetaIsLoading);
this.attributeSearchMetaIsLoaded = store.select(metamodelSelector.getAttributeSearchMetaIsLoaded);
this.datasetName = store.select(searchSelector.getDatasetName);
this.currentStep = store.select(searchSelector.getCurrentStep);
this.datasetList = store.select(metamodelSelector.getDatasetList);
this.datasetAttributeList = this.store.select(metamodelSelector.getDatasetAttributeList);
this.criteriaFamilyList = this.store.select(metamodelSelector.getCriteriaFamilyList);
this.criteriaList = this.store.select(searchSelector.getCriteriaList);
this.isConeSearchAdded = this.store.select(searchSelector.getIsConeSearchAdded);
......@@ -84,6 +81,13 @@ export class ResultComponent implements OnInit, OnDestroy {
Promise.resolve(null).then(() => this.store.dispatch(new searchActions.InitSearchByUrl()));
this.store.dispatch(new datasetActions.LoadDatasetSearchMetaAction());
this.scrollTopService.setScrollTop();
this.datasetName.subscribe(datasetName => {
if (datasetName) {
this.attributeListIsLoading = this.store.select(metamodelSelector.getAttributeListIsLoading, { dname: datasetName });
this.attributeListIsLoaded = this.store.select(metamodelSelector.getAttributeListIsLoaded, { dname: datasetName });
this.attributeList = this.store.select(metamodelSelector.getAttributeList, { dname: datasetName });
}
});
}
getDataLength(): void {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment