Skip to content

Commit

Permalink
SHIBUI-1385 Fixed filter list for older versions
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Aug 15, 2019
1 parent 2eb54a0 commit bbd3452
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="d-flex justify-content-start align-items-center">
<span class="mr-2">{{ index + 1 }}</span>
<div class="d-flex justify-content-between">
<div class="d-flex justify-content-between" *ngIf="editable">
<button class="btn btn-link btn-sm" (click)="onUpdateOrderUp.emit(filter)" [disabled]="isFirst">
<i class="fa fa-arrow-circle-up fa-2x sr-hidden"></i>
<span class="sr-only" translate="action.move-up">Move Up</span>
Expand All @@ -19,7 +19,7 @@
</div>
<div *ngIf="open">
<hr class="my-2" />
<div class="d-flex justify-content-end mb-2">
<div class="d-flex justify-content-end mb-2" *ngIf="editable">
<div class="d-flex justify-content-between">
<a class="btn btn-link"
[routerLink]="['../../', 'filter', filter.resourceId, 'edit']">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class FilterConfigurationListItemComponent implements OnChanges {
@Input() index: number;
@Input() isFirst: boolean;
@Input() isLast: boolean;
@Input() editable: boolean;

@Output() onUpdateOrderUp: EventEmitter<MetadataFilter> = new EventEmitter();
@Output() onUpdateOrderDown: EventEmitter<MetadataFilter> = new EventEmitter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[index]="i"
[isFirst]="isFirst"
[isLast]="isLast"
[editable]="editable"
(onUpdateOrderDown)="onUpdateOrderDown.emit($event)"
(onUpdateOrderUp)="onUpdateOrderUp.emit($event)"
(onRemove)="onRemove.emit($event)"></filter-configuration-list-item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h2 class="title h4 m-0 ml-2 flex-grow-1">
</div>
<filter-configuration-list
[editable]="false"
[filters]="filters"></filter-configuration-list>
[filters]="filters$ | async"></filter-configuration-list>
</div>
<button class="btn btn-link" (click)="onScrollTo('header')">
<i class="fa fa-chevron-up sr-hidden"></i>&nbsp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
getConfigurationSections,
getSelectedVersion,
getConfigurationModelEnabled,
getConfigurationModelType
getConfigurationModelType,
getVersionModelFilters
} from '../reducer';
import { MetadataConfiguration } from '../model/metadata-configuration';
import { MetadataVersion } from '../model/version';
Expand All @@ -35,9 +36,9 @@ export class VersionOptionsComponent implements OnDestroy {
isEnabled$: Observable<boolean> = this.store.select(getConfigurationModelEnabled);
model$: Observable<Metadata> = this.store.select(getVersionModel);
type$: Observable<string> = this.store.select(getConfigurationModelType);
filters$: Observable<any[]> = this.store.select(getVersionModelFilters);
id: string;
kind: string;
filters = [];

constructor(
protected store: Store<ConfigurationState>,
Expand Down
13 changes: 13 additions & 0 deletions ui/src/app/metadata/configuration/reducer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ export const getComparisonConfigurations = createSelector(
export const getComparisonConfigurationCount = createSelector(getComparisonConfigurations, (config) => config ? config.dates.length : 0);

// Version Restoration
export const filterPluginTypes = ['RequiredValidUntil', 'SignatureValidation', 'EntityRoleWhiteList'];
export const isAdditionalFilter = (type) => filterPluginTypes.indexOf(type) === -1;

export const getVersionModelFiltersFn =
(model, kind) => kind === 'provider' ?
model.metadataFilters.filter(filter => isAdditionalFilter(filter['@type'])) :
null;

export const getVersionState = createSelector(getState, getVersionStateFn);
export const getVersionModel = createSelector(getVersionState, fromVersion.getVersionModel);
Expand All @@ -162,6 +169,12 @@ export const getVersionConfigurationSections = createSelector(
getConfigurationSectionsFn
);

export const getVersionModelFilters = createSelector(
getVersionModel,
getConfigurationModelKind,
getVersionModelFiltersFn
);

// Mixed states

export const getConfigurationModelFn = (kind, version, provider, resolver) => {
Expand Down

0 comments on commit bbd3452

Please sign in to comment.