blob: 018e0d367d1b7838b89cc1b2a4b3a78eeec0f9f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
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";
import {createServiceInstanceFromTemplate} from "../../storeUtil/utils/useTemplate/useTemplate.action";
@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(createServiceInstanceFromTemplate(instantiationTemplate, serviceModelId));
});
};
}
|