-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented data retrieval for comparison
- Loading branch information
Showing
13 changed files
with
357 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import { Action } from '@ngrx/store'; | ||
| import { Metadata } from '../../domain/domain.type'; | ||
| import { FormDefinition } from '../../../wizard/model/form-definition'; | ||
| import { FilterComparison } from '../model/compare'; | ||
| import { Schema } from '../model/schema'; | ||
|
|
||
| export enum FilterCompareActionTypes { | ||
| LOAD_SCHEMA_REQUEST = '[Filter Compare Version] Compare Version Request', | ||
| LOAD_SCHEMA_SUCCESS = '[Filter Compare Version] Compare Version Success', | ||
| LOAD_SCHEMA_ERROR = '[Filter Compare Version] Compare Version Error', | ||
| SET_SCHEMA = '[Filter Compare Version] Set Schema', | ||
| SET_DEFINITION = '[Filter Compare Version] Set Definition', | ||
| COMPARE_FILTERS = '[Filter Compare Version] Compare Filters', | ||
| CLEAR = '[Filter Compare Version] Clear Filter Comparison' | ||
| } | ||
|
|
||
| export class LoadFilterSchemaRequest implements Action { | ||
| readonly type = FilterCompareActionTypes.LOAD_SCHEMA_REQUEST; | ||
|
|
||
| constructor(public payload: string) { } | ||
| } | ||
|
|
||
| export class LoadFilterSchemaSuccess implements Action { | ||
| readonly type = FilterCompareActionTypes.LOAD_SCHEMA_SUCCESS; | ||
|
|
||
| constructor(public payload: Schema) { } | ||
| } | ||
|
|
||
| export class LoadFilterSchemaError implements Action { | ||
| readonly type = FilterCompareActionTypes.LOAD_SCHEMA_ERROR; | ||
|
|
||
| constructor(public payload: any) { } | ||
| } | ||
|
|
||
| export class SetFilterComparisonSchema implements Action { | ||
| readonly type = FilterCompareActionTypes.SET_SCHEMA; | ||
| constructor(public payload: any) { } | ||
| } | ||
|
|
||
| export class SetFilterComparisonDefinition implements Action { | ||
| readonly type = FilterCompareActionTypes.SET_DEFINITION; | ||
| constructor(public payload: FormDefinition<Metadata>) { } | ||
| } | ||
|
|
||
| export class ClearFilterComparison implements Action { | ||
| readonly type = FilterCompareActionTypes.CLEAR; | ||
| } | ||
|
|
||
| export class CompareFilterVersions implements Action { | ||
| readonly type = FilterCompareActionTypes.COMPARE_FILTERS; | ||
|
|
||
| constructor(public payload: FilterComparison) { } | ||
| } | ||
|
|
||
| export type FilterCompareActionsUnion = | ||
| | LoadFilterSchemaRequest | ||
| | LoadFilterSchemaSuccess | ||
| | LoadFilterSchemaError | ||
| | SetFilterComparisonSchema | ||
| | SetFilterComparisonDefinition | ||
| | CompareFilterVersions | ||
| | ClearFilterComparison; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 22 additions & 8 deletions
30
ui/src/app/metadata/configuration/component/filter-version-list.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| import { Injectable } from '@angular/core'; | ||
| import { Effect, Actions, ofType } from '@ngrx/effects'; | ||
| import { | ||
| LoadFilterSchemaRequest, | ||
| CompareFilterVersions, | ||
| SetFilterComparisonDefinition, | ||
| LoadFilterSchemaSuccess, | ||
| LoadFilterSchemaError, | ||
| SetFilterComparisonSchema | ||
| } from '../action/filter.action'; | ||
| import { Store } from '@ngrx/store'; | ||
| import { State } from '../reducer'; | ||
| import { FilterCompareActionTypes } from '../action/filter.action'; | ||
| import { MetadataConfigurationService } from '../service/configuration.service'; | ||
| import { switchMap, map, catchError } from 'rxjs/operators'; | ||
| import { of } from 'rxjs'; | ||
|
|
||
| @Injectable() | ||
| export class FilterCompareVersionEffects { | ||
|
|
||
| @Effect() | ||
| setDefinition$ = this.actions$.pipe( | ||
| ofType<CompareFilterVersions>(FilterCompareActionTypes.COMPARE_FILTERS), | ||
| map(action => action.payload), | ||
| map(comparison => { | ||
| const def = this.configService.getDefinition(comparison.modelType); | ||
| return new SetFilterComparisonDefinition(def); | ||
| }) | ||
| ); | ||
|
|
||
| @Effect() | ||
| loadSchemaOnDefinitionSet$ = this.actions$.pipe( | ||
| ofType<SetFilterComparisonDefinition>(FilterCompareActionTypes.SET_DEFINITION), | ||
| map(action => action.payload), | ||
| map(def => new LoadFilterSchemaRequest(def.schema)) | ||
| ); | ||
|
|
||
| @Effect() | ||
| loadSchemaData$ = this.actions$.pipe( | ||
| ofType<LoadFilterSchemaRequest>(FilterCompareActionTypes.LOAD_SCHEMA_REQUEST), | ||
| switchMap(action => | ||
| this.configService | ||
| .loadSchema(action.payload) | ||
| .pipe( | ||
| map(schema => new LoadFilterSchemaSuccess(schema)), | ||
| catchError(error => of(new LoadFilterSchemaError(error))) | ||
| ) | ||
| ) | ||
| ); | ||
|
|
||
| @Effect() | ||
| loadSchemaSuccess$ = this.actions$.pipe( | ||
| ofType<LoadFilterSchemaSuccess>(FilterCompareActionTypes.LOAD_SCHEMA_SUCCESS), | ||
| map(action => action.payload), | ||
| map(schema => new SetFilterComparisonSchema(schema)) | ||
| ); | ||
|
|
||
| constructor( | ||
| private configService: MetadataConfigurationService, | ||
| private store: Store<State>, | ||
| private actions$: Actions | ||
| ) {} | ||
| } |
Oops, something went wrong.