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

Fix bug rechargement detail page

parent 884cb213
No related branches found
No related tags found
2 merge requests!68Develop,!47Fix bug rechargement detail page
<div class="row text-center mb-5">
<div class="col">
<h1>Object detail</h1>
</div>
</div>
<div class="row">
<table class="table table-striped table-bordered">
<tr *ngFor="let attribute of getAttributesVisible()">
......
<div class="row text-center mb-5">
<div class="col">
<h1>Object detail</h1>
</div>
</div>
<div *ngIf="objectIsLoading | async" class="row justify-content-center mt-5">
<i class="fas fa-circle-notch fa-spin fa-3x"></i>
<span class="sr-only">Loading...</span>
......
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Location } from '@angular/common';
import { Observable } from 'rxjs';
......@@ -19,7 +19,7 @@ interface StoreState {
templateUrl: 'detail.component.html',
styleUrls: ['detail.component.css']
})
export class DetailComponent implements OnInit {
export class DetailComponent implements OnInit, OnDestroy {
public pristine: Observable<boolean>;
public attributeList: Observable<Attribute[]>;
public objectIsLoading: Observable<boolean>;
......@@ -43,4 +43,8 @@ export class DetailComponent implements OnInit {
goBackToResult() {
this.location.back();
}
ngOnDestroy() {
this.store.dispatch(new detailActions.DestroyDetailAction());
}
}
......@@ -9,10 +9,11 @@ export const COPY_ATTRIBUTE_LIST = '[Detail] Copy Attribute List';
export const RETRIEVE_OBJECT = '[Detail] Retrieve Object';
export const RETRIEVE_OBJECT_SUCCESS = '[Detail] Retrieve Object Success';
export const RETRIEVE_OBJECT_FAIL = '[Detail] Retrieve Object Fail';
export const DESTROY_DETAIL = '[Detail] Destroy detail';
export class InitDetailAction implements Action {
type = INIT_DETAIL;
constructor(public payload: {} = null) { }
}
......@@ -43,7 +44,7 @@ export class CopyAttributeListAction implements Action {
export class RetrieveObjectAction implements Action {
type = RETRIEVE_OBJECT;
constructor(public payload: {datasetName: string, idAttribute: number, id: string} = null) { }
constructor(public payload: { datasetName: string, idAttribute: number, id: string } = null) { }
}
export class RetrieveObjectSuccessAction implements Action {
......@@ -58,6 +59,12 @@ export class RetrieveObjectFailAction implements Action {
constructor(public payload: {} = null) { }
}
export class DestroyDetailAction implements Action {
type = DESTROY_DETAIL;
constructor(public payload: {} = null) { }
}
export type Actions
= InitDetailAction
| LoadAttributeListAction
......@@ -66,4 +73,5 @@ export type Actions
| CopyAttributeListAction
| RetrieveObjectAction
| RetrieveObjectSuccessAction
| RetrieveObjectFailAction;
\ No newline at end of file
| RetrieveObjectFailAction
| DestroyDetailAction;
......@@ -56,7 +56,7 @@ export class DetailEffects {
map((attributeList: Attribute[]) => new detailActions.LoadAttributeListSuccessAction(attributeList)),
catchError(() => of(new detailActions.LoadAttributeListFailAction()))
);
})
})
);
@Effect()
......@@ -78,7 +78,7 @@ export class DetailEffects {
switchMap(([action, state]) => {
const attributeList = state.metamodel.attribute.datasetAttributeList;
return of(new detailActions.LoadAttributeListSuccessAction(attributeList));
})
})
);
@Effect()
......@@ -103,4 +103,4 @@ export class DetailEffects {
ofType(detailActions.RETRIEVE_OBJECT_FAIL),
tap(_ => this.toastr.error('Loading Failed!', 'The object loading failed'))
);
}
\ No newline at end of file
}
import * as actions from './detail.action';
import { Attribute } from '../../metamodel/model';
import { Attribute } from '../../metamodel/model';
export interface State {
attributeList: Attribute[];
......@@ -27,7 +27,7 @@ export function reducer(state: State = initialState, action: actions.Actions): S
case actions.LOAD_ATTRIBUTE_LIST_SUCCESS:
const attributeList = action.payload as Attribute[];
return {
return {
...state,
attributeList
}
......@@ -50,6 +50,8 @@ export function reducer(state: State = initialState, action: actions.Actions): S
objectIsLoaded: false
};
case actions.DESTROY_DETAIL:
return initialState;
default:
return state;
......
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