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 // import {Http, ResponseContentType} from '@angular/http';
8 import { delay } from 'rxjs/operators';
9 import { Serverroom } from './serverroom';
11 import { nodeDetails, podDetails, nodesDropDownDetails,
12 serviceDetails, deploymentData, currentDeployInfo,
13 currentDeployDetails, dashboardInfo } from './datainterface';
16 import { retry,catchError } from 'rxjs/operators';
17 import { Edgeserver } from './edgeserver';
18 import { v4 as uuid } from 'uuid';
25 export class EliotserviceService {
28 private baseUrl = 'http://159.138.5.177:8080/';
30 private _url = './../assets/data/post.json';
31 private nodes_url = './../assets/data/nodes.json';
32 private pods_url = './../assets/data/pods.json';
34 private nodes_array_url = './../assets/data/nodesdrop.json';
36 private services_url = './../assets/data/services.json';
37 private history_url = './../assets/data/history-test.json';
38 private dashboard_url = './../assets/data/dashboard-test.json';
40 private rooomDataUrl= this.baseUrl+'tempstatus';
41 private uuidUrl= this.baseUrl+'uuid';
42 private nodesUrl = this.baseUrl+'getnodes';
43 private podsUrl = this.baseUrl+'getpods';
44 private servicesUrl = this.baseUrl+'getservices';
45 private postRoom= this.baseUrl+'settemplimit';
46 private packageUploadUrl = this.baseUrl+'upload'
47 private deployUrl = this.baseUrl+'deploy';
48 private historyIdUrl = this.baseUrl+'history/files';
49 private nodesArrayUrl = this.baseUrl+'nodesonly';
51 private historyUrl = this.baseUrl+'history';
52 private dashboardUrl = this.baseUrl+'dashboard';
54 private roles_url = './../assets/data/roles.json';
55 private current_deploy_url = './../assets/data/current-deploy.json';
58 constructor(private http:HttpClient) {
62 headers: new HttpHeaders({
63 'Content-Type':'application/json'
71 return this.http.get<any>(this.uuidUrl);
74 getRoomData(): Observable<any> {
75 return this.http.get<any>(this.rooomDataUrl);
78 getRoomDa(): Observable<any> {
81 switchMap(_ => this.http.get(this.rooomDataUrl)),
85 getNodesInfoo(): Observable<nodeDetails> {
86 return this.http.get<nodeDetails>(this.nodes_url);
89 getPodsInfo(selectedVal: any): Observable<podDetails> {
90 return this.http.get<podDetails>(this.pods_url, {params: selectedVal} );
93 getNodesArray(): Observable<nodesDropDownDetails> {
94 return this.http.get<nodesDropDownDetails>(this.nodes_array_url);
97 getServicesInfo(): Observable<serviceDetails> {
98 return this.http.get<serviceDetails>(this.servicesUrl );
101 getHistoryInfo(): Observable<any> {
102 // return this.http.get<any>(this.historyUrl);
103 return this.http.get<any>(this.history_url);
107 getRoleName(): Observable<any> {
108 return this.http.get<any>(this.roles_url);
111 getCurrentDeployInfo(): Observable<currentDeployDetails>{
112 return this.http.get<currentDeployDetails>(this.current_deploy_url)
115 // postDeploymentYaml(data): Observable<a> {
116 // return this.http.get<serviceDetails>(this.servicesUrl );
121 postHistoryId(data): Observable<Blob> {
122 // return this.http.post<any>(this.deployUrl, data);
123 return this.http.get<Blob>(this.historyIdUrl, {params: data} );
126 postDeploymentPackage(data): Observable<any> {
127 return this.http.post<any>(this.packageUploadUrl, data);
129 // .post(this.deployUrl,
132 // 'Content-Type': 'multipart/form-data'
139 postDeployRequest(data,nodeData): Observable<any> {
141 return this.http.post<any>(this.deployUrl, data, nodeData);
144 getDashboardData(): Observable<dashboardInfo> {
145 return this.http.get<dashboardInfo>(this.dashboard_url);