sorahn commented on a change in pull request #11436: [FLINK-11404][web] add 
load more feature in exception page
URL: https://github.com/apache/flink/pull/11436#discussion_r397957146
 
 

 ##########
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/job/exceptions/job-exceptions.component.ts
 ##########
 @@ -31,28 +31,45 @@ import { JobService } from 'services';
 export class JobExceptionsComponent implements OnInit {
   rootException = '';
   listOfException: JobExceptionItemInterface[] = [];
+  truncated = false;
+  isLoading = false;
+  maxExceptions = 0;
 
   trackExceptionBy(_: number, node: JobExceptionItemInterface) {
     return node.timestamp;
   }
-
-  constructor(private jobService: JobService, private cdr: ChangeDetectorRef) 
{}
-
-  ngOnInit() {
+  loadMore() {
+    this.isLoading = true;
+    this.maxExceptions += 10;
     this.jobService.jobDetail$
       .pipe(
         distinctUntilChanged((pre, next) => pre.jid === next.jid),
-        flatMap(job => this.jobService.loadExceptions(job.jid))
+        flatMap(job => this.jobService.loadExceptions(job.jid, 
this.maxExceptions))
       )
-      .subscribe(data => {
-        // @ts-ignore
-        if (data['root-exception']) {
-          this.rootException = formatDate(data.timestamp, 'yyyy-MM-dd 
HH:mm:ss', 'en') + '\n' + data['root-exception'];
-        } else {
-          this.rootException = 'No Root Exception';
+      .subscribe(
+        data => {
+          // @ts-ignore
+          if (data['root-exception']) {
+            this.rootException =
+              formatDate(data.timestamp, 'yyyy-MM-dd HH:mm:ss', 'en') + '\n' + 
data['root-exception'];
+          } else {
+            this.rootException = 'No Root Exception';
+          }
+          this.truncated = data.truncated;
+          this.listOfException = data['all-exceptions'];
+          this.isLoading = false;
 
 Review comment:
   is it worth moving the isLoading  = false, and the cdr.markForCheck() into 
`finalize` from rxjs to avoid the repetition?
   
   Looks good otherwise.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to