You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by dw...@apache.org on 2019/09/27 15:37:08 UTC

[flink] 03/06: [FLINK-13386][web]: Fix operators/tasks metrics sort

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

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

commit f18448ab1919a906f37b7ca273de67cd7d47c043
Author: vthinkxie <ya...@alibaba-inc.com>
AuthorDate: Sat Jul 27 15:58:48 2019 +0800

    [FLINK-13386][web]: Fix operators/tasks metrics sort
---
 .../src/app/services/metrics.service.ts              | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/flink-runtime-web/web-dashboard/src/app/services/metrics.service.ts b/flink-runtime-web/web-dashboard/src/app/services/metrics.service.ts
index 081aa4e..d13b3a6 100644
--- a/flink-runtime-web/web-dashboard/src/app/services/metrics.service.ts
+++ b/flink-runtime-web/web-dashboard/src/app/services/metrics.service.ts
@@ -33,9 +33,23 @@ export class MetricsService {
    * @param vertexId
    */
   getAllAvailableMetrics(jobId: string, vertexId: string) {
-    return this.httpClient.get<Array<{ id: string; value: string }>>(
-      `${BASE_URL}/jobs/${jobId}/vertices/${vertexId}/metrics`
-    );
+    return this.httpClient
+      .get<Array<{ id: string; value: string }>>(`${BASE_URL}/jobs/${jobId}/vertices/${vertexId}/metrics`)
+      .pipe(
+        map(item =>
+          item.sort((pre, next) => {
+            const preId = pre.id.toLowerCase();
+            const nextId = next.id.toLowerCase();
+            if (preId < nextId) {
+              return -1;
+            } else if (preId > nextId) {
+              return 1;
+            } else {
+              return 0;
+            }
+          })
+        )
+      );
   }
 
   /**