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

hshpak pushed a commit to branch refactor/image-action-dialog
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git


The following commit(s) were added to refs/heads/refactor/image-action-dialog 
by this push:
     new 807540818 minor fix
807540818 is described below

commit 80754081836302c85bd8238ff23a43a3c1392e95
Author: Hennadii_Shpak <[email protected]>
AuthorDate: Tue Aug 30 18:25:19 2022 +0300

    minor fix
---
 .../image-action-dialog.component.html             |  2 +-
 .../src/app/resources/images/images.component.ts   | 23 +++++++++++++++-------
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git 
a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/image-action-dialog.component.html
 
b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/image-action-dialog.component.html
index 1ab9f2dc1..c09683c24 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/image-action-dialog.component.html
+++ 
b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/image-action-dialog.component.html
@@ -47,7 +47,7 @@
       <button
         type="button"
         class="butt butt-success mat-raised-button"
-        (click)="dialogRef.close()">Yes
+        (click)="dialogRef.close(true)">Yes
       </button>
     </div>
   </section>
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/resources/images/images.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/resources/images/images.component.ts
index 3e77746f2..0fcd3c225 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/resources/images/images.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/resources/images/images.component.ts
@@ -19,7 +19,7 @@
 
 import { Component, OnDestroy, OnInit } from '@angular/core';
 import { MatDialog } from '@angular/material/dialog';
-import { Observable } from 'rxjs';
+import { EMPTY, Observable } from 'rxjs';
 import { map, switchMap, tap } from 'rxjs/operators';
 
 import { ToastrService } from 'ngx-toastr';
@@ -170,8 +170,13 @@ export class ImagesComponent implements OnInit, OnDestroy {
       panelClass: 'modal-sm'
     }).afterClosed()
       .pipe(
-        switchMap(() => requestCallback(imageInfo, actionType)),
-        tap(() => this.callActionHelpers(actionType))
+        switchMap((confirm) => {
+          if (confirm) {
+            return requestCallback(imageInfo, actionType);
+          }
+          return EMPTY;
+        }),
+        tap(() => this.callActionHelpers(actionType, 
this.callToasterShareSuccess))
     )
       .subscribe();
   }
@@ -212,7 +217,6 @@ export class ImagesComponent implements OnInit, OnDestroy {
   }
 
   onResetColumn(dropdownFieldNames: FilterFormControlNames): void {
-    console.log(dropdownFieldNames);
     this.imagesService.resetFilterField(dropdownFieldNames, 
DropdownSelectAllValue);
   }
 
@@ -220,12 +224,17 @@ export class ImagesComponent implements OnInit, OnDestroy 
{
     this.imagesService.closeFilter();
   }
 
-  private callActionHelpers(actionType: ImageActionType): void {
+  private callActionHelpers(actionType: ImageActionType, callback?: 
(actionType: string) => void): void {
+    const toasterInvoke = callback.bind(this);
+    toasterInvoke(actionType);
+    this.checkAuthorize();
+    this.progressBarService.stopProgressBar();
+  }
+
+  private callToasterShareSuccess(actionType: ImageActionType): void {
     if (actionType === ImageActions.share) {
       this.toastr.success(Toaster_Message.successShare, 'Success!');
     }
-    this.checkAuthorize();
-    this.progressBarService.stopProgressBar();
   }
 
   private checkAuthorize(): void {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to