vthinkxie commented on a change in pull request #8542: 
[FLINK-10707][web-dashboard] flink cluster overview dashboard improvements
URL: https://github.com/apache/flink/pull/8542#discussion_r301415192
 
 

 ##########
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/overview/statistic/overview-statistic.component.ts
 ##########
 @@ -46,12 +54,64 @@ export class OverviewStatisticComponent implements OnInit, 
OnDestroy {
       )
       .subscribe(data => {
         this.statistic = data;
+        this.taskSlotPercentage = Math.round(
+          ((data['slots-total'] - data['slots-available']) / 
data['slots-total']) * 100
+        );
         this.cdr.markForCheck();
       });
+    this.statusService.refresh$
+      .pipe(
+        takeUntil(this.destroy$),
+        flatMap(() => this.taskManagerService.loadManagers())
+      )
+      .subscribe(
+        data => {
+          this.listOfTaskManager = data;
+          this.totalCount = data.length;
+          this.taskManagerCPUs = 0;
+          this.listOfTaskManager.map(tm => {
+            this.taskManagerCPUs += tm.hardware.cpuCores;
+            tm.milliSecondsSinceLastHeartBeat = new Date().getTime() - 
tm.timeSinceLastHeartbeat;
+          });
+
+          this.cdr.markForCheck();
+        },
+        () => {}
+      );
+    this.jobManagerService.loadConfig().subscribe(data => {
 
 Review comment:
   these codes could be simpler I think
   ```typescript
       this.jobManagerService.loadConfig().subscribe(listOfConfig => {
         const timeoutThresholdConfig = listOfConfig.find(item => item.key === 
'akka.lookup.timeout');
         const timeoutThreshold = timeoutThresholdConfig ? 
timeoutThresholdConfig.value : '';
         if (!timeoutThreshold) {
           this.timeoutThresholdSeconds = 20;
         } else {
           const intValue = parseInt(timeoutThreshold.substr(0, 
timeoutThreshold.length - 1), 10);
           if (timeoutThreshold.substr(-1, 1) === 's') {
             this.timeoutThresholdSeconds = intValue;
           } else if (timeoutThreshold.substr(-1, 1) === 'm') {
             this.timeoutThresholdSeconds = intValue * 60;
           } else if (timeoutThreshold.substr(-1, 1) === 'h') {
             this.timeoutThresholdSeconds = intValue * 60 * 60;
           } else {
             this.timeoutThresholdSeconds = 20;
           }
         }
         this.cdr.markForCheck();
       });
   ```

----------------------------------------------------------------
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