[SDC-29] rebase continue work to align source
[sdc.git] / catalog-ui / src / app / ng2 / services / component-services / service.service.ts
1 import { Injectable } from '@angular/core';
2 import { Observable } from 'rxjs/Observable';
3 import 'rxjs/add/operator/map';
4 import 'rxjs/add/operator/toPromise';
5 import { Response } from '@angular/http';
6 import {Service} from "app/models";
7 import { downgradeInjectable } from '@angular/upgrade/static';
8 import {sdc2Config} from "../../../../main";
9 import {HttpService} from "../http.service";
10
11
12 @Injectable()
13 export class ServiceServiceNg2 {
14
15     protected baseUrl = "";
16
17     constructor(private http: HttpService) {
18         this.baseUrl = sdc2Config.api.root + sdc2Config.api.component_api_root;
19     }
20
21     validateConformanceLevel(service: Service): Observable<boolean> {
22
23         return this.http.get(this.baseUrl + service.getTypeUrl() + service.uuid + '/conformanceLevelValidation')
24             .map((res: Response) => {
25                 return res.json();
26             });
27     }
28
29 }
30
31 angular.module('Sdc.Services').factory('ServiceServiceNg2', downgradeInjectable(ServiceServiceNg2)); // This is in order to use the service in angular1 till we finish remove all angular1 code