Newer
Older
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import {Injectable} from '@angular/core';
import {ConfigurationService} from "../env/configuration.service";
import {HttpClient, HttpHeaders} from "@angular/common/http";
import {Observable} from "rxjs";
import {map} from "rxjs/operators";
import {QueueSetting, Setting, WorkflowSetting} from "../model/setting";
@Injectable({
providedIn: 'root'
})
export class SettingsService {
constructor(private configService: ConfigurationService, private http: HttpClient) {
}
public getSettings(): Observable<Setting> {
return this.http.get<Setting>(this.configService.config.url + '/services/settings', {observe: 'response'}).pipe(
map(response => {
return response.body;
}));
}
public setSettings(settings): Observable<Setting> {
return this.http.post<Setting>(this.configService.config.url + '/services/settings', settings, {observe: "response"}).pipe(
map(response => {
return settings;
}));
}
public getQueueSettings(): Observable<Array<QueueSetting>> {
return this.http.get<Array<QueueSetting>>(this.configService.config.url + '/services/job/queueSettings', {observe: 'response'}).pipe(
map(response => {
return response.body;
}));
}
public setQueueSettings(queueSetting: QueueSetting): Observable<QueueSetting> {
return this.http.put<QueueSetting>(this.configService.config.url + '/services/job/queues/' + queueSetting.name + '/settings', queueSetting, {observe: "response"}).pipe(
map(respnse => {
return queueSetting;
}));
}
public getWorkflowSettings(): Observable<Array<WorkflowSetting>> {
return this.http.get<Array<WorkflowSetting>>(this.configService.config.url + '/services/job/queueWorkflows', {observe: 'response'}).pipe(
map(response => {
return response.body;
}));
}
public createFile(queue: string, name: string): Observable<any> {
let headers = new HttpHeaders();
let type, data;
if (name.endsWith('json')) {
headers = headers.append('Content-Type', 'application/json');
data = '{}';
} else if (name.endsWith('xml')) {
headers = headers.append('Content-Type', 'text/xml');
data = '<?xml version="1.0" encoding="utf-8"?>\n<?xml-stylesheet type="text/xsl" href="/VlassMngr/PPR/ppr2html.xsl"?>\n<SciPipeRequest/>\n';
} else {
headers = headers.append('Content-Type', 'text/plain');
data = "your new template";
}
return this.http.post(this.configService.config.url + "/services/job/queues/" + queue + "/workflow/files/" + name, data, {
observe: "response",
headers
}).pipe(map(response => {
return response;
}));
}
public deleteFile(queue: string, name: string): Observable<any> {
return this.http.delete(this.configService.config.url + "/services/job/queues/" + queue + "/workflow/files/" + name, {observe: "response"}).pipe(map(response => {
return response.status;
}))
}
}