diff options
Diffstat (limited to 'vid-webpack-master/src/app/shared/services/templateService/instantiationTemplates.service.ts')
-rw-r--r-- | vid-webpack-master/src/app/shared/services/templateService/instantiationTemplates.service.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/shared/services/templateService/instantiationTemplates.service.ts b/vid-webpack-master/src/app/shared/services/templateService/instantiationTemplates.service.ts new file mode 100644 index 000000000..21cdc9296 --- /dev/null +++ b/vid-webpack-master/src/app/shared/services/templateService/instantiationTemplates.service.ts @@ -0,0 +1,26 @@ +import {Injectable} from "@angular/core"; +import {HttpClient} from "@angular/common/http"; +import {NgRedux} from "@angular-redux/store"; +import {AppState} from "../../store/reducers"; +import {Observable} from "rxjs"; +import {ServiceInstance} from "../../models/serviceInstance"; +import {Constants} from "../../utils/constants"; +import {createServiceInstance} from "../../storeUtil/utils/service/service.actions"; + +@Injectable() +export class InstantiationTemplatesService { + constructor(private http: HttpClient, private store: NgRedux<AppState>) { + } + + retrieveInstantiationTemplateTopology(jobId: string): Observable<ServiceInstance> { + let pathQuery: string = `${Constants.Path.INSTANTIATION_TEMPLATE_TOPOLOGY}/${jobId}`; + return this.http.get<ServiceInstance>(pathQuery) + } + + public retrieveAndStoreInstantiationTemplateTopology(jobId: string, serviceModelId: string): Observable<ServiceInstance> { + return this.retrieveInstantiationTemplateTopology(jobId).do((instantiationTemplate: ServiceInstance) => { + this.store.dispatch(createServiceInstance(instantiationTemplate, serviceModelId)); + }); + }; + +} |