Skip to content

Commit

Permalink
Merged in bugfix/SHIBUI-785 (pull request #179)
Browse files Browse the repository at this point in the history
SHIBUI-785 Fixed issue with flicker of old filters loading

Approved-by: Shibui Jenkins <shibui.jenkins@gmail.com>
  • Loading branch information
rmathis committed Aug 24, 2018
1 parent ed90378 commit b71bddd
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
9 changes: 8 additions & 1 deletion ui/src/app/metadata/provider/action/collection.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export enum ProviderCollectionActionTypes {

CHANGE_PROVIDER_ORDER_UP = '[Metadata Provider Collection] Change Order Up',
CHANGE_PROVIDER_ORDER_DOWN = '[Metadata Provider Collection] Change Order Down',

CLEAR_SELECTION = '[Metadata Provider Collection] Clear Provider Selection'
}

export class LoadProviderRequest implements Action {
Expand Down Expand Up @@ -173,6 +175,10 @@ export class ChangeProviderOrderDown implements Action {
constructor(public payload: string) { }
}

export class ClearProviderSelection implements Action {
readonly type = ProviderCollectionActionTypes.CLEAR_SELECTION;
}

export type ProviderCollectionActionsUnion =
| LoadProviderRequest
| LoadProviderSuccess
Expand All @@ -196,4 +202,5 @@ export type ProviderCollectionActionsUnion =
| GetOrderProviderSuccess
| GetOrderProviderFail
| ChangeProviderOrderUp
| ChangeProviderOrderDown;
| ChangeProviderOrderDown
| ClearProviderSelection;
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import { Store } from '@ngrx/store';

import { ActivatedRoute } from '@angular/router';
import { map, distinctUntilChanged, skipWhile } from 'rxjs/operators';
import { SelectProviderRequest } from '../action/collection.action';
import { SelectProviderRequest, ClearProviderSelection } from '../action/collection.action';
import * as fromProviders from '../reducer';
import { MetadataProvider } from '../../domain/model';
import { SetDefinition } from '../../../wizard/action/wizard.action';
import { SetDefinition, ClearWizard } from '../../../wizard/action/wizard.action';
import { MetadataProviderEditorTypes } from '../model';
import { ClearProvider } from '../action/entity.action';
import { ClearEditor } from '../action/editor.action';

@Component({
selector: 'provider-select',
Expand All @@ -33,14 +35,20 @@ export class ProviderSelectComponent implements OnDestroy {

this.provider$
.subscribe(provider => {
this.store.dispatch(new SetDefinition({
...MetadataProviderEditorTypes.find(def => def.type === provider['@type'])
}));
if (provider) {
this.store.dispatch(new SetDefinition({
...MetadataProviderEditorTypes.find(def => def.type === provider['@type'])
}));
}
});
}

ngOnDestroy() {
this.actionsSubscription.unsubscribe();
this.store.dispatch(new ClearProvider());
this.store.dispatch(new ClearWizard());
this.store.dispatch(new ClearEditor());
this.store.dispatch(new ClearProviderSelection());
}
}

7 changes: 7 additions & 0 deletions ui/src/app/metadata/provider/reducer/collection.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ export function reducer(state = initialState, action: ProviderCollectionActionsU
};
}

case ProviderCollectionActionTypes.CLEAR_SELECTION: {
return {
...state,
selectedProviderId: null
};
}

default: {
return state;
}
Expand Down

0 comments on commit b71bddd

Please sign in to comment.