-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in bugfix/SHIBUI-986 (pull request #252)
SHIBUI-986 Fixing issue with modal Approved-by: Ryan Mathis <rmathis@unicon.net>
- Loading branch information
Showing
17 changed files
with
110 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
ui/src/app/metadata/resolver/service/create-draft.resolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; | ||
import { Observable, of } from 'rxjs'; | ||
import { Store } from '@ngrx/store'; | ||
import { MetadataResolver } from '../../domain/model'; | ||
import { AddDraftRequest } from '../action/draft.action'; | ||
import * as fromResolver from '../reducer'; | ||
import { EntityDraftService } from '../../domain/service/draft.service'; | ||
|
||
@Injectable() | ||
export class CreateDraftResolverService { | ||
constructor( | ||
private store: Store<fromResolver.State>, | ||
private draftService: EntityDraftService | ||
) { } | ||
|
||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<string> | Observable<never> { | ||
let id = route.queryParamMap.get('id'); | ||
if (id) { | ||
let exists = this.draftService.exists(id); | ||
if (!exists) { | ||
let resolver = <MetadataResolver>{id}; | ||
this.store.dispatch(new AddDraftRequest(resolver)); | ||
} | ||
} | ||
if (!id) { | ||
let resolver = <MetadataResolver>{ | ||
id: `r-${Date.now()}` | ||
}; | ||
id = resolver.id; | ||
this.store.dispatch(new AddDraftRequest(resolver)); | ||
} | ||
return of(id); | ||
} | ||
} |
Oops, something went wrong.