Skip to content

Commit

Permalink
Merge branch 'master' into SHIBUI-693
Browse files Browse the repository at this point in the history
  • Loading branch information
dima767 committed Aug 8, 2018
2 parents 6b80b62 + 1da1d75 commit 7102cc7
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ui/src/app/metadata/filter/effect/filter.effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class FilterEffects {
)
);

@Effect()
@Effect({ dispatch: false })
cancelChanges$ = this.actions$.pipe(
ofType<CancelCreateFilter>(FilterActionTypes.CANCEL_CREATE_FILTER),
combineLatest(this.store.select(fromProvider.getSelectedProviderId).pipe(skipWhile(id => !id))),
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/metadata/provider/action/collection.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class LoadProviderError implements Action {
export class SelectProviderRequest implements Action {
readonly type = ProviderCollectionActionTypes.SELECT_PROVIDER_REQUEST;

constructor(public payload: any) { }
constructor(public payload: string) { }
}

export class SelectProviderSuccess implements Action {
Expand Down
15 changes: 14 additions & 1 deletion ui/src/app/metadata/provider/effect/collection.effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import {
} from '../action/collection.action';
import { MetadataProviderService } from '../../domain/service/provider.service';
import * as fromProvider from '../reducer';
import * as fromRoot from '../../../app.reducer';
import { AddFilterSuccess, FilterCollectionActionTypes } from '../../filter/action/collection.action';


/* istanbul ignore next */
Expand Down Expand Up @@ -114,10 +116,21 @@ export class CollectionEffects {
map(provider => new LoadProviderRequest())
);

@Effect({ dispatch: false })
newFilterSuccessUpdate = this.actions$.pipe(
ofType<AddFilterSuccess>(FilterCollectionActionTypes.ADD_FILTER_SUCCESS),
map(action => action.payload),
withLatestFrom(this.store.select(fromProvider.getSelectedProviderId)),
map(([filter, id]) => id),
tap(id => {
this.store.dispatch(new SelectProviderRequest(id));
})
);

constructor(
private actions$: Actions,
private router: Router,
private store: Store<fromProvider.ProviderState>,
private store: Store<fromRoot.State>,
private providerService: MetadataProviderService
) { }
} /* istanbul ignore next */
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@
</div>
</div>
<div class="col-lg-6">
<p *ngIf="!targets.length">You must add at least one entity id target.</p>
<ul class="list-group list-group-sm list-group-scroll" *ngIf="entityAttributesFilterTargetType === 'ENTITY'">
<li class="list-group-item d-flex justify-content-between align-items-center" *ngFor="let id of targets">
{{ id }}
<button class="btn btn-link text-right">
<button class="btn btn-link text-right" (click)="removeId(id)">
<i class="fa fa-trash fa-lg text-danger"></i>
</button>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ export class FilterTargetComponent extends ObjectWidget implements OnDestroy, Af
this.search.setValue(null);
}

removeId(id: string): void {
let rest = this.targets.filter(target => target !== id);
this.setTargetValue(rest);
}

setTargetValue(value: string[]): void {
this.formProperty.getProperty('value').setValue(value);
}
Expand Down
1 change: 0 additions & 1 deletion ui/src/app/schema-form/widget/select/select.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<select *ngIf="schema.type !== 'array'"
[formControl]="control"
[attr.name]="name"
[attr.disabled]="schema.readOnly"
class="form-control">
<option disabled selected>{{ schema.placeholder || schema.title }}</option>
<option *ngFor="let option of schema.oneOf" [ngValue]="option.enum[0]">{{option.description}}</option>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/schema-form/widget/select/select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class CustomSelectComponent extends SelectWidget implements AfterViewInit

ngAfterViewInit(): void {
super.ngAfterViewInit();
if (this.schema.readOnly) {
if (this.schema.readOnly || this.schema.widget.disabled) {
this.control.disable();
} else {
this.control.enable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
"type": "string",
"readOnly": true,
"widget": {
"id": "select"
"id": "select",
"disabled": true
},
"oneOf": [
{
Expand Down

0 comments on commit 7102cc7

Please sign in to comment.