Update to match new remote changes

This commit is contained in:
Simon Hanna 2018-09-03 22:33:36 +02:00
parent 02716de708
commit af621fe9ee
3 changed files with 26 additions and 22 deletions

View File

@ -16,7 +16,7 @@ export class MainViewComponent implements OnInit {
}
updateImage(): void {
this.openlpService.getMainImage().subscribe(view => this.img = view.slide_image);
this.openlpService.getMainImage().subscribe(view => this.img = view.binary_image);
}
}

View File

@ -1,5 +1,5 @@
import { Injectable, EventEmitter } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { URLSearchParams, Http } from '@angular/http';
import { Observable } from 'rxjs';
@ -20,6 +20,10 @@ let deserialize = (json, cls) => {
return inst;
}
const httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
}
@Injectable()
export class OpenLPService {
private apiURL: string;
@ -33,7 +37,7 @@ export class OpenLPService {
} else {
port = '4316';
}
this.apiURL = `http://localhost:${port}`;
this.apiURL = `http://localhost:${port}/api/v1`;
this.stateChanged$ = new EventEmitter<State>();
@ -52,7 +56,7 @@ export class OpenLPService {
}
private retrieveSystemInformation(): Observable<SystemInformation> {
return this.http.get<SystemInformation>(`${this.apiURL}/system`);
return this.http.get<SystemInformation>(`${this.apiURL}/core/system`);
}
getSystemInformation(): SystemInformation {
@ -67,11 +71,11 @@ export class OpenLPService {
}
getMainImage(): Observable<MainView> {
return this.http.get<MainView>(`${this.apiURL}/main/image`);
return this.http.get<MainView>(`${this.apiURL}/core/live-image`);
}
getItemSlides(): Observable<Slide[]> {
return this.http.get<Slide[]>(`${this.apiURL}/controller/live/text`);
return this.http.get<Slide[]>(`${this.apiURL}/controller/live-item`);
}
getServiceItems(): Observable<ServiceItem[]> {
@ -79,63 +83,63 @@ export class OpenLPService {
}
getSearchablePlugins(): Observable<PluginDescription[]> {
return this.http.get<PluginDescription[]>(`${this.apiURL}/plugin/search`);
return this.http.get<PluginDescription[]>(`${this.apiURL}/core/plugins`);
}
setServiceItem(id:number): Observable<any> {
return this.http.get(`${this.apiURL}/service/set?id=${id}`);
return this.http.post(`${this.apiURL}/service/show`, {'id': id}, httpOptions);
}
search(plugin, text): Observable<any> {
return this.http.get(`${this.apiURL}/${plugin}/search?q=${text}`);
return this.http.get(`${this.apiURL}/plugins/${plugin}/search?text=${text}`);
}
setSlide(id): Observable<any> {
return this.http.get(`${this.apiURL}/controller/live/set?id=${id}`);
return this.http.post(`${this.apiURL}/controller/show`, {'id': id}, httpOptions);
}
nextItem(): Observable<any> {
return this.http.get(`${this.apiURL}/service/next`);
return this.http.post(`${this.apiURL}/service/progress`, {'action': 'next'}, httpOptions);
}
previousItem(): Observable<any> {
return this.http.get(`${this.apiURL}/service/previous`);
return this.http.post(`${this.apiURL}/service/progress`, {'action': 'previous'}, httpOptions);
}
nextSlide(): Observable<any> {
return this.http.get(`${this.apiURL}/controller/live/next`);
return this.http.post(`${this.apiURL}/controller/progress`, {'action': 'next'}, httpOptions);
}
previousSlide(): Observable<any> {
return this.http.get(`${this.apiURL}/controller/live/previous`);
return this.http.post(`${this.apiURL}/controller/progress`, {'action': 'previous'}, httpOptions);
}
blankDisplay(): Observable<any> {
return this.http.get(`${this.apiURL}/display/blank`);
return this.http.post(`${this.apiURL}/core/display`, {'display': 'blank'}, httpOptions);
}
themeDisplay(): Observable<any> {
return this.http.get(`${this.apiURL}/display/theme`);
return this.http.post(`${this.apiURL}/core/display`, {'display': 'theme'}, httpOptions);
}
desktopDisplay(): Observable<any> {
return this.http.get(`${this.apiURL}/display/desktop`);
return this.http.post(`${this.apiURL}/core/display`, {'display': 'desktop'}, httpOptions);
}
showDisplay(): Observable<any> {
return this.http.get(`${this.apiURL}/display/show`);
return this.http.post(`${this.apiURL}/core/display`, {'display': 'show'}, httpOptions);
}
showAlert(text): Observable<any> {
return this.http.get(`${this.apiURL}/alert?text=${text}`);
return this.http.post(`${this.apiURL}/plugins/alerts`, {'text': text}, httpOptions);
}
sendItemLive(plugin, id): Observable<any> {
return this.http.get(`${this.apiURL}/${plugin}/live?id=${id}`);
return this.http.post(`${this.apiURL}/plugins/${plugin}/live`, {'id': id}, httpOptions);
}
addItemToService(plugin, id): Observable<any> {
return this.http.get(`${this.apiURL}/${plugin}/add?id=${id}`);
return this.http.post(`${this.apiURL}/plugins/${plugin}/add`, {'id': id}, httpOptions);
}
}

View File

@ -36,7 +36,7 @@ export interface ServiceItem {
}
export interface MainView {
slide_image: string;
binary_image: string;
}
export interface SystemInformation {