diff options
Diffstat (limited to 'vid-webpack-master/src/app/shared/resolvers/retry/retry.resolver.ts')
-rw-r--r-- | vid-webpack-master/src/app/shared/resolvers/retry/retry.resolver.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/shared/resolvers/retry/retry.resolver.ts b/vid-webpack-master/src/app/shared/resolvers/retry/retry.resolver.ts new file mode 100644 index 000000000..5e2250ad7 --- /dev/null +++ b/vid-webpack-master/src/app/shared/resolvers/retry/retry.resolver.ts @@ -0,0 +1,27 @@ +import {ActivatedRouteSnapshot, Resolve} from "@angular/router"; +import {Injectable} from "@angular/core"; +import {Observable} from "rxjs"; +import {AaiService} from "../../services/aaiService/aai.service"; +import {forkJoin} from "rxjs/observable/forkJoin"; +import {AppState} from "../../store/reducers"; +import {NgRedux} from "@angular-redux/store"; +import {createServiceInstance} from "../../storeUtil/utils/service/service.actions"; + +@Injectable() +export class RetryResolver implements Resolve<Observable<boolean>> { + + constructor(private _aaiService: AaiService, private _store: NgRedux<AppState>) {} + + resolve(route: ActivatedRouteSnapshot): Observable<boolean> { + const serviceModelId: string = route.queryParamMap.get("serviceModelId"); + const jobId: string = route.queryParamMap.get("jobId"); + + let serviceModelApi = this._aaiService.getServiceModelById(serviceModelId); + + let serviceInstanceApi = this._aaiService.retrieveAndStoreServiceInstanceRetryTopology(jobId, serviceModelId); + return forkJoin([serviceModelApi, serviceInstanceApi]).map(([serviceModel, serviceInstance ]) => { + this._store.dispatch(createServiceInstance( serviceInstance, serviceModelId)); + return true; + }); + } +} |