From 5387b3f066e73cd9eedfdca6639cee59b514b448 Mon Sep 17 00:00:00 2001 From: Sunil G Date: Tue, 10 Apr 2018 16:09:09 +0530 Subject: [PATCH] =?UTF-8?q?YARN-7804.=20[UI2]=20Refresh=20action=20on=20Gr?= =?UTF-8?q?id=20view=20page=20should=20not=20be=20redirected=20to=20graph?= =?UTF-8?q?=20view.=20Contributed=20by=20Gergely=20Nov=C3=A1k.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 7c1e77dda4cb3ba8952328d142aafcf0366b5903) --- .../webapp/app/components/timeline-view.js | 35 +++++++++++++------ .../app/controllers/yarn-app-attempt.js | 9 ++++- .../app/controllers/yarn-app/attempts.js | 11 ++++-- .../templates/components/timeline-view.hbs | 12 +++---- .../webapp/app/templates/yarn-app-attempt.hbs | 2 ++ .../app/templates/yarn-app/attempts.hbs | 2 ++ 6 files changed, 52 insertions(+), 19 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js index 65a8cb1469c..3588009e7eb 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js @@ -25,6 +25,13 @@ export default Ember.Component.extend({ tableDefinition: TableDefinition.create({ searchType: 'manual', }), + graphDrawn: false, + + actions: { + changeViewType(param) { + this.sendAction("changeViewType", param); + } + }, canvas: { svg: undefined, @@ -235,12 +242,10 @@ export default Ember.Component.extend({ }, didInsertElement: function() { - // init tooltip - this.initTooltip(); + // init model this.modelArr = []; this.containerIdArr = []; - // init model if (this.get("rmModel")) { this.get("rmModel").forEach(function(o) { if(!this.modelArr.contains(o)) { @@ -258,16 +263,30 @@ export default Ember.Component.extend({ }.bind(this)); } - if(this.modelArr.length === 0) { + if (this.modelArr.length === 0) { return; } this.modelArr.sort(function(a, b) { var tsA = a.get("startTs"); var tsB = b.get("startTs"); - return tsA - tsB; }); + + if (this.get('attemptModel')) { + this.setAttemptsGridColumnsAndRows(); + } else { + this.setContainersGridColumnsAndRows(); + } + }, + + didUpdate: function() { + if (this.get("viewType") === "grid" || this.graphDrawn) { + return; + } + + this.initTooltip(); + var begin = 0; if (this.modelArr.length > 0) { begin = this.modelArr[0].get("startTs"); @@ -289,11 +308,7 @@ export default Ember.Component.extend({ this.setSelected(this.modelArr[0]); } - if (this.get('attemptModel')) { - this.setAttemptsGridColumnsAndRows(); - } else { - this.setContainersGridColumnsAndRows(); - } + this.graphDrawn = true; }, setAttemptsGridColumnsAndRows: function() { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app-attempt.js index 4c8b8a1cd25..116920db7c1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app-attempt.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app-attempt.js @@ -19,8 +19,15 @@ import Ember from 'ember'; export default Ember.Controller.extend({ - queryParams: ["service"], + queryParams: ["service", "viewType"], service: undefined, + viewType: "graph", + + actions: { + changeViewType(param) { + this.set("viewType", param); + } + }, breadcrumbs: Ember.computed("model.attempt.appId", "model.attempt.id", function () { var appId = this.get("model.attempt.appId"); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app/attempts.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app/attempts.js index a6cba9eea62..32638e5da2e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app/attempts.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app/attempts.js @@ -19,6 +19,13 @@ import Ember from 'ember'; export default Ember.Controller.extend({ - queryParams: ["service"], - service: undefined + queryParams: ["service", "viewType"], + service: undefined, + viewType: "graph", + + actions: { + changeViewType(param) { + this.set("viewType", param); + } + }, }); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs index b7cdb599086..0a1209dfe74 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs @@ -26,16 +26,16 @@ {{/if}}
-
+


@@ -56,7 +56,7 @@
-
+
{{em-table columns=gridColumns rows=gridRows definition=tableDefinition}}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs index 2e2f6d0ac25..7d9aec1f0fc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs @@ -56,6 +56,8 @@ tsModel=model.tsContainers label="shortAppAttemptId" attemptModel=false + changeViewType="changeViewType" + viewType=viewType }} {{else}}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app/attempts.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app/attempts.hbs index 5857d899c37..62105d32341 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app/attempts.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app/attempts.hbs @@ -26,6 +26,8 @@ label="shortAppAttemptId" attemptModel=true serviceName=model.serviceName + changeViewType="changeViewType" + viewType=viewType }} {{else}}