EG version upgrade to 1.3
[ealt-edge.git] / example-apps / PDD / frontend-src / src / app / ealtservice.service.ts
1 import { Injectable } from '@angular/core';
2 import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
3 import { Observable,throwError } from 'rxjs'
4 import { timer, Subscription, pipe } from 'rxjs';
5 import { switchMap } from 'rxjs/operators';
6
7 import { delay } from 'rxjs/operators';
8
9 import { nodeDetails } from './datainterface';
10
11
12 import { retry,catchError } from 'rxjs/operators';
13 import { v4 as uuid } from 'uuid';
14
15
16
17 @Injectable({
18   providedIn: 'root'
19 })
20 export class EaltserviceService {
21
22
23   private baseUrl = 'http://localhost:30281/';
24
25   private imageUploadUrl = this.baseUrl+'uploadimageinput';
26
27   private nodes_url = './../assets/data/nodes.json';
28   private packageUploadUrl = this.baseUrl+'uploadimageinput';
29   
30   private historyIdUrl = this.baseUrl+'history/files';
31
32   private outputImageUrl = this.baseUrl
33
34   private inputImageUrl = this.baseUrl
35
36   private pcbDetectUrl = this.baseUrl
37
38   constructor(private http:HttpClient) {
39   }
40
41   httpOptions = {
42     headers: new HttpHeaders({
43       'Content-Type':'application/json'
44     })
45   }
46
47   getNodesInfoo(): Observable<nodeDetails> {
48     return this.http.get<nodeDetails>(this.nodes_url);
49   }
50
51   postHistoryId(data): Observable<Blob> {
52     return this.http.get<Blob>(this.historyIdUrl, {params: data} );
53   }
54
55   postDeploymentPackage(data): Observable<any> {
56     return this.http.post<any>(this.packageUploadUrl, data);
57   }
58
59   postInputImages(data): Observable<any> {
60     return this.http.post<any>(this.imageUploadUrl, data)
61   }
62
63   getOutputImage(): Observable<any> {
64     debugger;
65     this.outputImageUrl = this.baseUrl + 'v1/pcb/resultimage';
66     return this.http.get<any>(this.outputImageUrl);
67   }
68
69   getInputImage(data): Observable<any> {
70     debugger;
71     this.inputImageUrl = this.baseUrl + 'v1/pcb/preview/' + data;
72     // return this.http.get<any>(this.monitorImageUrl);
73     return this.http.get<any>(this.inputImageUrl);
74   }
75
76   pcbDetect(data): Observable<any> {
77     debugger;
78     this.pcbDetectUrl = this.baseUrl + 'v1/pcb/detection/' + data;
79     return this.http.get<any>(this.pcbDetectUrl);
80   }
81
82 }