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

Add comments for documentation module => DONE

parent bdf3035b
No related branches found
No related tags found
2 merge requests!169Develop,!159Resolve "Add comments"
......@@ -26,6 +26,12 @@ import { ScrollTopService } from '../../shared/service/sroll-top.service';
templateUrl: 'documentation.component.html',
styleUrls: ['documentation.component.css']
})
/**
* @class
* @classdesc Documentation container.
*
* @implements OnInit
*/
export class DocumentationComponent implements OnInit {
public datasetListIsLoading: Observable<boolean>;
public datasetListIsLoaded: Observable<boolean>;
......@@ -48,10 +54,23 @@ export class DocumentationComponent implements OnInit {
this.scrollTopService.setScrollTop();
}
/**
* Returns host URL.
*
* @return string
*/
getHost(): string {
return host();
}
/**
* Returns attribute list sorted by ID, for the given dataset name.
*
* @param {string} dname - The dataset name.
* @param {Dictionary<AttributesByDataset>} attributesLists - Attribute list by dataset dictionary.
*
* @return Attribute[]
*/
getAttributeList(dname: string, attributesLists: Dictionary<AttributesByDataset>): Attribute[] {
return [...attributesLists[dname].attributeList].sort((a, b) => a.id - b.id);
}
......
......@@ -18,6 +18,10 @@ const routes: Routes = [{ path: '', component: DocumentationComponent }];
imports: [ RouterModule.forChild(routes) ],
exports: [ RouterModule ]
})
/**
* @class
* @classdesc Documentation routing module.
*/
export class DocumentationRoutingModule { }
export const routedComponents = [
......
......@@ -28,4 +28,8 @@ import { DocumentationEffects } from './store/documentation.effects';
routedComponents
]
})
/**
* @class
* @classdesc Documentation module.
*/
export class DocumentationModule { }
......@@ -9,23 +9,38 @@
import { Action } from '@ngrx/store';
export const RETRIEVE_ATTRIBUTE_LISTS = '[Documentation] Retrieve Attribute Lists';
export const ATTRIBUTE_LISTS_IS_LOADING = '[Documentation] Attribute Lists Is Loading';
export const ATTRIBUTE_LISTS_IS_LOADED = '[Documentation] Attribute Lists Is Loaded';
/**
* @class
* @classdesc RetrieveAttributeListsAction action.
* @readonly
*/
export class RetrieveAttributeListsAction implements Action {
readonly type = RETRIEVE_ATTRIBUTE_LISTS;
constructor(public payload: {} = null) { }
}
/**
* @class
* @classdesc AttributeListsIsLoadingAction action.
* @readonly
*/
export class AttributeListsIsLoadingAction implements Action {
readonly type = ATTRIBUTE_LISTS_IS_LOADING;
constructor(public payload: boolean) { }
}
/**
* @class
* @classdesc AttributeListsIsLoadedAction action.
* @readonly
*/
export class AttributeListsIsLoadedAction implements Action {
readonly type = ATTRIBUTE_LISTS_IS_LOADED;
......
......@@ -22,6 +22,10 @@ import * as attributeActions from '../../metamodel/action/attribute.action';
import * as utils from '../../shared/utils';
@Injectable()
/**
* @class
* @classdesc Documentation effects.
*/
export class DocumentationEffects {
constructor(
private actions$: Actions,
......@@ -31,6 +35,9 @@ export class DocumentationEffects {
}>
) { }
/**
* Retrieves attribute lists for datasets instance.
*/
@Effect()
retrieveAttributeListsAction$ = this.actions$.pipe(
ofType(documentationActions.RETRIEVE_ATTRIBUTE_LISTS),
......@@ -49,6 +56,9 @@ export class DocumentationEffects {
})
);
/**
* Retrieves attribute lists for datasets instance.
*/
@Effect()
loadDatasetSearchMetaSuccessAction$ = this.actions$.pipe(
ofType(datasetActions.LOAD_DATASET_SEARCH_META_SUCCESS),
......@@ -67,6 +77,9 @@ export class DocumentationEffects {
})
);
/**
* Calls actions to store that attribute lists loading is done.
*/
@Effect()
loadAttributeListsSuccessAction$ = this.actions$.pipe(
ofType(attributeActions.LOAD_MULTIPLE_ATTRIBUTE_LISTS_SUCCESS),
......@@ -79,6 +92,9 @@ export class DocumentationEffects {
})
);
/**
* Displays retrieve attribute lists error notification.
*/
@Effect()
loadAttributeListsFailAction$ = this.actions$.pipe(
ofType(attributeActions.LOAD_MULTIPLE_ATTRIBUTE_LISTS_FAIL),
......
......@@ -9,6 +9,11 @@
import * as actions from './documentation.action';
/**
* Interface for documentation state.
*
* @interface State
*/
export interface State {
attributeListsIsLoading: boolean;
attributeListsIsLoaded: boolean;
......@@ -19,6 +24,14 @@ export const initialState: State = {
attributeListsIsLoaded: false
};
/**
* Reduces state.
*
* @param {State} state - The state.
* @param {actions} action - The action.
*
* @return State
*/
export function reducer(state: State = initialState, action: actions.Actions): State {
switch (action.type) {
case actions.ATTRIBUTE_LISTS_IS_LOADING:
......
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