import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
-import { XMXappInfo } from '../../interfaces/xapp-mgr.types';
+import { XMXappInfo, XMXapp} from '../../interfaces/xapp-mgr.types';
+
@Injectable()
-export class CatalogService {
+export class XappMgrService {
constructor(private httpClient: HttpClient) {
// injects to variable httpClient
}
- getAll() {
- return this.httpClient.get('api/xappmgr/xapps');
+ private basePath = 'api/xappmgr/xapps';
+
+ getAll(){
+ return this.httpClient.get<XMXapp[]>(this.basePath);
}
deployXapp(name: string) {
const xappInfo: XMXappInfo = { xAppName: name };
- return this.httpClient.post('api/xappmgr/xapps', xappInfo, { observe: 'response' });
+ return this.httpClient.post(this.basePath, xappInfo, { observe: 'response' });
+ }
+
+ undeployXapp(name: string) {
+ return this.httpClient.delete((this.basePath + '/' + name), { observe: 'response' });
}
-}
+}
\ No newline at end of file