* limitations under the License.
* ========================LICENSE_END===================================
*/
-import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatSort } from '@angular/material/sort';
import { Subscription } from 'rxjs';
-import { finalize } from 'rxjs/operators';
-import { RicInstance } from '../interfaces/dashboard.types';
import { XMXapp } from '../interfaces/app-mgr.types';
+import { RicInstance } from '../interfaces/dashboard.types';
import { AppMgrService } from '../services/app-mgr/app-mgr.service';
import { InstanceSelectorService } from '../services/instance-selector/instance-selector.service';
-import { LoadingDialogService } from '../services/ui/loading-dialog.service';
-import { UiService } from '../services/ui/ui.service';
-import { AppConfigurationComponent } from './../app-configuration/app-configuration.component';
import { ConfirmDialogService } from '../services/ui/confirm-dialog.service';
+import { LoadingDialogService } from '../services/ui/loading-dialog.service';
import { NotificationService } from '../services/ui/notification.service';
+import { UiService } from '../services/ui/ui.service';
+import { DeployDialogComponent } from '../ui/deploy-dialog/deploy-dialog.component';
+import { OnboardComponent } from './../onboard/onboard.component';
import { CatalogDataSource } from './catalog.datasource';
@Component({
constructor(
private appMgrService: AppMgrService,
- private confirmDialogService: ConfirmDialogService,
private dialog: MatDialog,
- private loadingDialogService: LoadingDialogService,
private notificationService: NotificationService,
public instanceSelectorService: InstanceSelectorService,
public ui: UiService) { }
this.instanceChange.unsubscribe();
}
- onConfigureApp(xapp: XMXapp): void {
+ onDeployApp(app: XMXapp): void {
if (this.darkMode) {
this.panelClass = 'dark-theme';
} else {
this.panelClass = '';
}
- const dialogRef = this.dialog.open(AppConfigurationComponent, {
+ const dialogRef = this.dialog.open(DeployDialogComponent, {
panelClass: this.panelClass,
- width: '40%',
- maxHeight: '500px',
+ width: '400px',
+ maxHeight: '1000px',
position: {
top: '10%'
},
data: {
- xapp: xapp,
+ xappName: app.name,
instanceKey: this.instanceKey
}
});
}
- onDeployApp(app: XMXapp): void {
- this.confirmDialogService.openConfirmDialog('Deploy application ' + app.name + '?')
- .afterClosed().subscribe((res: boolean) => {
- if (res) {
- this.loadingDialogService.startLoading('Deploying ' + app.name);
- this.appMgrService.deployXapp(this.instanceKey, app.name)
- .pipe(
- finalize(() => this.loadingDialogService.stopLoading())
- )
- .subscribe(
- (response: HttpResponse<Object>) => {
- this.notificationService.success('App deploy succeeded!');
- },
- ((her: HttpErrorResponse) => {
- // the error field should have an ErrorTransport object
- let msg = her.message;
- if (her.error && her.error.message) {
- msg = her.error.message;
- }
- this.notificationService.warn('App deploy failed: ' + msg);
- })
- );
- }
+ onboard(): void {
+ if (this.darkMode) {
+ this.panelClass = 'dark-theme';
+ } else {
+ this.panelClass = '';
+ }
+ const dialogRef = this.dialog.open(OnboardComponent, {
+ panelClass: this.panelClass,
+ width: '400px',
+ maxHeight: '1000px',
+ position: {
+ top: '10%'
+ },
+ data: {
+ instanceKey: this.instanceKey
}
- );
+
+ });
}
}