* ========================LICENSE_END===================================
*/
import { Component, OnInit, ViewChild } from '@angular/core';
+import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
import { MatSort } from '@angular/material/sort';
import { ErrorDialogService } from '../services/ui/error-dialog.service';
import { AppMgrService } from '../services/app-mgr/app-mgr.service';
import { CatalogDataSource } from './catalog.datasource';
@Component({
- selector: 'app-catalog',
+ selector: 'rd-app-catalog',
templateUrl: './catalog.component.html',
styleUrls: ['./catalog.component.css'],
})
displayedColumns: string[] = ['name', 'version', 'action'];
dataSource: CatalogDataSource;
- @ViewChild(MatSort) sort: MatSort;
+ @ViewChild(MatSort, {static: true}) sort: MatSort;
constructor(
private appMgrSvc: AppMgrService,
this.dataSource.loadTable();
}
- onConfigurexApp(name: string): void {
+ onConfigureApp(name: string): void {
const aboutError = 'Configure not implemented (yet)';
this.errorService.displayError(aboutError);
}
- onDeployxApp(name: string): void {
+ onDeployApp(name: string): void {
this.confirmDialogService.openConfirmDialog('Deploy application ' + name + '?')
- .afterClosed().subscribe(res => {
+ .afterClosed().subscribe( (res: any) => {
if (res) {
this.appMgrSvc.deployXapp(name).subscribe(
- response => {
- switch (response.status) {
- case 200:
- this.notification.success('Deploy succeeded!');
- break;
- default:
- this.notification.warn('Deploy failed.');
- }
+ (response: HttpResponse<object>) => {
+ this.notification.success('Deploy succeeded!');
+ },
+ (error: HttpErrorResponse) => {
+ this.notification.warn('Deploy failed: ' + error.message);
}
);
}
- });
-
+ }
+ );
}
+
}