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

dmvk pushed a commit to branch release-1.17
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.17 by this push:
     new c10393826c4 [FLINK-31792][WebUI] Fix resolution errors during 
NzNotificationService injection.
c10393826c4 is described below

commit c10393826c4d9c5335e5e46f2d7afba89187de41
Author: David Moravek <[email protected]>
AuthorDate: Thu Apr 13 08:06:11 2023 +0200

    [FLINK-31792][WebUI] Fix resolution errors during NzNotificationService 
injection.
    
    HTTP Client interceptor should not use injector directly to avoid 
resolutions errors from being silently ignored.
---
 flink-runtime-web/web-dashboard/src/app/app.interceptor.ts | 13 +++++++------
 flink-runtime-web/web-dashboard/src/main.ts                |  2 ++
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/flink-runtime-web/web-dashboard/src/app/app.interceptor.ts 
b/flink-runtime-web/web-dashboard/src/app/app.interceptor.ts
index 567d0cf1981..f7bbc12f9dd 100644
--- a/flink-runtime-web/web-dashboard/src/app/app.interceptor.ts
+++ b/flink-runtime-web/web-dashboard/src/app/app.interceptor.ts
@@ -24,7 +24,7 @@ import {
   HttpResponseBase,
   HttpStatusCode
 } from '@angular/common/http';
-import { Injectable, Injector } from '@angular/core';
+import { Injectable } from '@angular/core';
 import { Observable, throwError } from 'rxjs';
 import { catchError } from 'rxjs/operators';
 
@@ -33,7 +33,10 @@ import { NzNotificationService, NzNotificationDataOptions } 
from 'ng-zorro-antd/
 
 @Injectable()
 export class AppInterceptor implements HttpInterceptor {
-  constructor(private readonly injector: Injector) {}
+  constructor(
+    private readonly statusService: StatusService,
+    private readonly notificationService: NzNotificationService
+  ) {}
 
   intercept(req: HttpRequest<unknown>, next: HttpHandler): 
Observable<HttpEvent<unknown>> {
     // Error response from below url should be ignored
@@ -62,10 +65,8 @@ export class AppInterceptor implements HttpInterceptor {
           ignoreErrorUrlEndsList.every(url => !res.url.endsWith(url)) &&
           ignoreErrorMessage.every(message => errorMessage !== message)
         ) {
-          
this.injector.get<StatusService>(StatusService).listOfErrorMessage.push(errorMessage);
-          this.injector
-            .get<NzNotificationService>(NzNotificationService)
-            .info('Server Response Message:', errorMessage.replaceAll(' at ', 
'\n at '), option);
+          this.statusService.listOfErrorMessage.push(errorMessage);
+          this.notificationService.info('Server Response Message:', 
errorMessage.replaceAll(' at ', '\n at '), option);
         }
         return throwError(res);
       })
diff --git a/flink-runtime-web/web-dashboard/src/main.ts 
b/flink-runtime-web/web-dashboard/src/main.ts
index b6a101c3bdf..2de555f10f6 100644
--- a/flink-runtime-web/web-dashboard/src/main.ts
+++ b/flink-runtime-web/web-dashboard/src/main.ts
@@ -32,6 +32,7 @@ import { StatusService } from '@flink-runtime-web/services';
 import { NZ_CONFIG, NzConfig } from 'ng-zorro-antd/core/config';
 import { en_US, NZ_I18N } from 'ng-zorro-antd/i18n';
 import { NZ_ICONS } from 'ng-zorro-antd/icon';
+import { NzNotificationModule } from 'ng-zorro-antd/notification';
 
 import { environment } from './environments/environment';
 
@@ -81,6 +82,7 @@ bootstrapApplication(AppComponent, {
     },
     importProvidersFrom(HttpClientModule),
     importProvidersFrom(BrowserAnimationsModule),
+    importProvidersFrom(NzNotificationModule),
     importProvidersFrom(
       RouterModule.forRoot([...APP_ROUTES], {
         useHash: true

Reply via email to