This is an automated email from the ASF dual-hosted git repository.

ankovalyshyn pushed a commit to branch feature/projects
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit a01943b7ea175d481b225df3761e60a7a442186f
Author: Andriana Kovalyshyn <andriana_kovalys...@epam.com>
AuthorDate: Tue May 28 17:14:52 2019 +0300

    [DLAB-642]: added endpoint creation service support
---
 .../backup-dilog/backup-dilog.component.ts         |  5 +++--
 .../management/endpoints/endpoints.component.ts    | 25 +++++++++++++++++++---
 .../management/management.component.ts             |  4 ++--
 3 files changed, 27 insertions(+), 7 deletions(-)

diff --git 
a/services/self-service/src/main/resources/webapp/src/app/administration/management/backup-dilog/backup-dilog.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/administration/management/backup-dilog/backup-dilog.component.ts
index 1e75877..2257d3e 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/administration/management/backup-dilog/backup-dilog.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/administration/management/backup-dilog/backup-dilog.component.ts
@@ -20,6 +20,7 @@
 import { Component, OnInit, ViewChild, Output, Inject } from '@angular/core';
 import { DICTIONARY } from '../../../../dictionary/global.dictionary';
 import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
+
 import { BackupOptionsModel } from '../management.model';
 
 @Component({
@@ -34,7 +35,7 @@ export class BackupDilogComponent implements OnInit {
 
   constructor(
     @Inject(MAT_DIALOG_DATA) public data: any,
-    public dialogRef: MatDialogRef<BackupDilogComponent>,
+    public dialogRef: MatDialogRef<BackupDilogComponent>
   ) { }
 
   ngOnInit() {
@@ -51,8 +52,8 @@ export class BackupDilogComponent implements OnInit {
   }
 
   public applyOptions(): void {
+    this.dialogRef.close(this.backupOptions);
     this.backupOptions.setDegault();
-    this.dialogRef.close();
   }
 
   private checkValidity(): void {
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.ts
index 23dbc36..caad7c8 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.ts
@@ -20,6 +20,15 @@
 import { Component, OnInit, Inject } from '@angular/core';
 import { FormGroup, FormBuilder, Validators } from '@angular/forms';
 import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
+import { ToastrService } from 'ngx-toastr';
+
+import { EndpointService } from '../../../core/services';
+
+export interface Endpoint {
+  name: string;
+  url: string;
+  account: string;
+}
 
 @Component({
   selector: 'endpoints',
@@ -29,19 +38,25 @@ import { MatDialogRef, MAT_DIALOG_DATA } from 
'@angular/material';
 export class EndpointsComponent implements OnInit {
   public createEndpointForm: FormGroup;
   namePattern = '[-_a-zA-Z0-9]+';
-
+  endpoints: Endpoint[] = [];
   constructor(
     @Inject(MAT_DIALOG_DATA) public data: any,
+    public toastr: ToastrService,
     public dialogRef: MatDialogRef<EndpointsComponent>,
-    private _fb: FormBuilder,
+    private endpointService: EndpointService,
+    private _fb: FormBuilder
   ) { }
 
   ngOnInit() {
     this.initFormModel();
+    this.getEndpointList();
   }
 
   public assignChanges(data) {
-   console.log('Create', data);
+    this.endpointService.createEndpoint(data).subscribe(() => {
+      this.toastr.success('Endpoint created successfully!', 'Success!');
+      this.dialogRef.close(true);
+    }, error => this.toastr.error(error.message || 'Endpoint creation 
failed!', 'Oops!'));
   }
 
   private initFormModel(): void {
@@ -51,4 +66,8 @@ export class EndpointsComponent implements OnInit {
       account: ['', Validators.required]
     });
   }
+
+  private getEndpointList() {
+    this.endpointService.getEndpointsData().subscribe((endpoints: any) => 
this.endpoints = endpoints);
+  }
 }
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
index 09f4975..bca3920 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
@@ -107,12 +107,12 @@ export class ManagementComponent implements OnInit, 
OnDestroy {
 
   showBackupDialog() {
     this.dialog.open(BackupDilogComponent, { panelClass: 'modal-sm' })
-      .afterClosed().subscribe(() => this.buildGrid());
+      .afterClosed().subscribe(result => result && this.createBackup(result));
   }
 
   showEndpointsDialog() {
     this.dialog.open(EndpointsComponent, { panelClass: 'modal-sm' })
-      .afterClosed().subscribe(() => this.buildGrid());
+      .afterClosed().subscribe(result => result && this.buildGrid());
   }
 
   getActiveUsersList() {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org
For additional commands, e-mail: commits-h...@dlab.apache.org

Reply via email to