Skip to content

Commit

Permalink
Merge branch 'master' of bitbucket.org:unicon/shib-idp-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Jj! committed Jun 10, 2019
2 parents 2ed123f + c5b4386 commit b63f43f
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 44 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name=shibui
group=edu.internet2.tier.shibboleth.admin.ui
version=1.5.2
version=1.6.0-SNAPSHOT

shibboleth.version=3.4.0
opensaml.version=3.4.0
Expand Down
2 changes: 2 additions & 0 deletions ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ node {
download = true
}

npmInstall.setNpmCommand('ci')

npm_run_build {
inputs.dir 'src'
outputs.dir 'dist'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,6 @@ describe('Provider Edit Component', () => {
expect(app).toBeTruthy();
}));

describe('go method', () => {
it('should route to the given child form', () => {
spyOn(router, 'navigate');
app.go('common');
expect(router.navigate).toHaveBeenCalled();
});
});

describe('save method', () => {
it('should route to the given child form', () => {
app.save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ export class ProviderEditComponent implements OnDestroy, CanComponentDeactivate
let startIndex$ = this.route.firstChild.params.pipe(map(p => p.form || 'filters'));
startIndex$.subscribe(index => this.store.dispatch(new SetIndex(index)));

this.index$.pipe(takeUntil(this.ngUnsubscribe)).subscribe(id => id && this.go(id));

this.store
.select(fromWizard.getCurrentWizardSchema)
.pipe(filter(s => !!s))
Expand All @@ -77,10 +75,6 @@ export class ProviderEditComponent implements OnDestroy, CanComponentDeactivate
this.canFilter$ = this.definition$.pipe(map(def => FilterableProviders.indexOf(def.type) > -1));
}

go(id: string): void {
this.router.navigate(['./', id], { relativeTo: this.route });
}

ngOnDestroy() {
this.clear();
this.ngUnsubscribe.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Subscription, Observable } from 'rxjs';
import { Store } from '@ngrx/store';

import { ActivatedRoute } from '@angular/router';
import { map, distinctUntilChanged, skipWhile } from 'rxjs/operators';
import { map, distinctUntilChanged, skipWhile, filter } from 'rxjs/operators';
import { SelectProviderRequest, ClearProviderSelection } from '../action/collection.action';
import * as fromProviders from '../reducer';
import { MetadataProvider } from '../../domain/model';
Expand Down Expand Up @@ -31,9 +31,13 @@ export class ProviderSelectComponent implements OnDestroy {
map(params => new SelectProviderRequest(params.providerId))
).subscribe(store);

this.provider$ = this.store.select(fromProviders.getSelectedProvider).pipe(skipWhile(p => !p));
this.provider$ = this.store.select(fromProviders.getSelectedProvider).pipe(filter(p => {
return p;
}));

this.provider$.subscribe(provider => this.setDefinition(provider));
this.provider$.subscribe(provider => {
this.setDefinition(provider);
});
}

setDefinition(provider: MetadataProvider): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { Component, ViewChild } from '@angular/core';
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { StoreModule, Store, combineReducers } from '@ngrx/store';

import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';

import { ProviderComponent } from './provider.component';
import * as fromRoot from '../reducer';
import * as fromWizard from '../../../wizard/reducer';

@Component({
template: `
Expand All @@ -24,27 +21,19 @@ describe('Provider Component', () => {
let fixture: ComponentFixture<TestHostComponent>;
let instance: TestHostComponent;
let app: ProviderComponent;
let store: Store<fromRoot.State>;

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
NgbDropdownModule,
RouterTestingModule,
StoreModule.forRoot({
provider: combineReducers(fromRoot.reducers),
wizard: combineReducers(fromWizard.reducers)
})
RouterTestingModule
],
declarations: [
ProviderComponent,
TestHostComponent
],
}).compileComponents();

store = TestBed.get(Store);
spyOn(store, 'dispatch');

fixture = TestBed.createComponent(TestHostComponent);
instance = fixture.componentInstance;
app = instance.componentUnderTest;
Expand Down
4 changes: 1 addition & 3 deletions ui/src/app/metadata/provider/container/provider.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ import * as fromProvider from '../reducer';
styleUrls: []
})
export class ProviderComponent {
constructor(
private store: Store<fromProvider.ProviderState>
) {}
constructor() {}
}
8 changes: 4 additions & 4 deletions ui/src/app/metadata/provider/effect/collection.effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ export class CollectionEffects {
ofType<SelectProviderRequest>(ProviderCollectionActionTypes.SELECT_PROVIDER_REQUEST),
map(action => action.payload),
debounceTime(500),
switchMap(id =>
this.providerService
switchMap(id => {
return this.providerService
.find(id)
.pipe(
map(provider => new SelectProviderSuccess(provider)),
catchError(error => of(new SelectProviderError(error)))
)
)
);
})
);

@Effect()
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/metadata/provider/reducer/collection.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function reducer(state = initialState, action: ProviderCollectionActionsU
case ProviderCollectionActionTypes.SELECT_PROVIDER_SUCCESS: {
return {
...state,
selectedProviderId: action.payload.id as string
selectedProviderId: action.payload.resourceId
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ export class ResolverEditComponent implements OnDestroy, CanComponentDeactivate
let startIndex$ = this.route.firstChild.params.pipe(map(p => p.form));
startIndex$.pipe(takeUntil(this.ngUnsubscribe)).subscribe(index => this.store.dispatch(new SetIndex(index)));

this.index$.pipe(takeUntil(this.ngUnsubscribe)).subscribe(index => index && this.go(index));

this.store
.select(fromWizard.getCurrentWizardSchema)
.pipe(filter(s => !!s))
Expand All @@ -67,10 +65,6 @@ export class ResolverEditComponent implements OnDestroy, CanComponentDeactivate
this.store.select(fromResolver.getEntityChanges).subscribe(changes => this.latest = changes);
}

go(index: string): void {
this.router.navigate(['./', index], { relativeTo: this.route });
}

ngOnDestroy() {
this.clear();
this.ngUnsubscribe.next();
Expand Down

0 comments on commit b63f43f

Please sign in to comment.