Skip to content

Commit

Permalink
SHIBUI-947 Fixed issue with modal
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Nov 8, 2018
1 parent 0f425c5 commit e4498de
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions backend/src/main/resources/i18n/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ label.entity-id=Entity ID
label.service-provider-name=Service Provider Name
label.organization=Organization
label.contacts=Contacts
label.contact=Contact
label.mdui=MDUI Information
label.service-provider-sso-descriptor=Service Provider Sso Descriptor
label.service-enabled=Service Enabled
Expand Down
1 change: 1 addition & 0 deletions backend/src/main/resources/metadata-sources-ui-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@
},
"definitions": {
"Contact": {
"title": "label.contact",
"type": "object",
"required": [
"name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class DashboardResolversListComponent implements OnInit {

edit(entity: MetadataEntity): void {
if (entity.isDraft()) {
this.router.navigate(['metadata', 'resolver', 'new'], {
this.router.navigate(['metadata', 'resolver', 'new', 'blank', 'org-info'], {
queryParams: {
id: entity.getId()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnDestroy } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import { withLatestFrom, map, distinctUntilChanged, skipWhile } from 'rxjs/operators';
import { withLatestFrom, map, distinctUntilChanged, skipWhile, filter } from 'rxjs/operators';
import { Store } from '@ngrx/store';

import * as fromResolver from '../reducer';
Expand Down Expand Up @@ -60,7 +60,7 @@ export class ResolverWizardStepComponent implements OnDestroy {
},
definition
})),
skipWhile(({ model, definition }) => !definition || !model),
filter(({ model, definition }) => (definition && model)),
map(({ model, definition }) => definition.formatter(model))
);

Expand All @@ -76,7 +76,7 @@ export class ResolverWizardStepComponent implements OnDestroy {

this.valueChangeEmitted$.pipe(
withLatestFrom(this.definition$),
skipWhile(([ changes, definition ]) => !definition || !changes),
filter(([ changes, definition ]) => (!!definition && !!changes)),
map(([ changes, definition ]) => definition.parser(changes.value)),
withLatestFrom(this.store.select(fromResolver.getSelectedDraft)),
map(([changes, original]) => ({ ...original, ...changes }))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ import { SetDefinition, SetIndex, SetDisabled, ClearWizard } from '../../../wiza
import * as fromWizard from '../../../wizard/reducer';
import { LoadSchemaRequest } from '../../../wizard/action/wizard.action';
import { UnsavedEntityComponent } from '../../domain/component/unsaved-entity.dialog';
import { ModalService } from '../../../core/service/modal.service';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { UpdateChanges, Clear } from '../action/entity.action';
import { Clear } from '../action/entity.action';

@Component({
selector: 'resolver-wizard-page',
Expand Down Expand Up @@ -172,7 +171,7 @@ export class ResolverWizardComponent implements OnDestroy, CanComponentDeactivat
currentState: RouterStateSnapshot,
nextState: RouterStateSnapshot
): Observable<boolean> {
if (nextState.url.match('blank')) { return of(true); }
if (nextState.url.match('blank') && !!nextState.root.queryParams.id) { return of(true); }
if (Object.keys(this.changes).length > 0) {
let modal = this.modalService.open(UnsavedEntityComponent);
modal.componentInstance.message = 'resolver';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class DraftCollectionEffects {
)
),
tap(() => {
this.store.dispatch(new ClearWizard());
// this.store.dispatch(new ClearWizard());
this.store.dispatch(new Clear());
})
);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/wizard/component/wizard.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<nav *ngIf="index$ | async">
<nav *ngIf="(current$ | async) && (index$ | async)">
<ul class="nav nav-wizard">
<li class="nav-item" *ngIf="(previous$ | async)">
<button class="nav-link previous btn clearfix" (click)="onPrevious.emit(previousPage.index)" [disabled]="disabled$ | async"
Expand Down

0 comments on commit e4498de

Please sign in to comment.