ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pallav...@apache.org
Subject ambari git commit: AMBARI-17731. Capacity Scheduler View - Fix for nodelabel api compatibility issue in HDP-2.5 (Akhil PB via pallavkul)
Date Fri, 15 Jul 2016 11:38:44 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 706e3aa27 -> 6be4f5aac


AMBARI-17731. Capacity Scheduler View - Fix for nodelabel api compatibility issue in HDP-2.5
(Akhil PB via pallavkul)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6be4f5aa
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6be4f5aa
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6be4f5aa

Branch: refs/heads/trunk
Commit: 6be4f5aac1713c4837f91c197ba76986791fc833
Parents: 706e3aa
Author: Pallav Kulshreshtha <pallav.kul@gmail.com>
Authored: Fri Jul 15 17:07:41 2016 +0530
Committer: Pallav Kulshreshtha <pallav.kul@gmail.com>
Committed: Fri Jul 15 17:07:41 2016 +0530

----------------------------------------------------------------------
 .../src/main/resources/ui/app/adapters.js       | 35 ++++++++++++++------
 .../src/main/resources/ui/app/store.js          |  6 ++--
 2 files changed, 29 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6be4f5aa/contrib/views/capacity-scheduler/src/main/resources/ui/app/adapters.js
----------------------------------------------------------------------
diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/adapters.js b/contrib/views/capacity-scheduler/src/main/resources/ui/app/adapters.js
index 068c241..5c92ac7 100644
--- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/adapters.js
+++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/adapters.js
@@ -243,8 +243,11 @@ App.QueueAdapter = DS.Adapter.extend({
     },'App: QueueAdapter#findAllTagged ' + tag);
   },
 
-  getNodeLabels:function () {
+  getNodeLabels:function (store) {
     var uri = [_getCapacitySchedulerViewUri(this),'nodeLabels'].join('/');
+    var stackId = store.get('stackId'),
+    stackVersion = stackId.substr(stackId.indexOf('-') + 1);
+
     if (App.testMode)
       uri = uri + ".json";
 
@@ -252,15 +255,25 @@ App.QueueAdapter = DS.Adapter.extend({
       _ajax(uri,'GET').then(function(data) {
         var parsedData = JSON.parse(data), labels;
 
-        if (parsedData && Em.isArray(parsedData.nodeLabels)) {
-          labels = parsedData.nodeLabels;
+        if (stackVersion >= 2.5) {
+          if (parsedData && Em.isArray(parsedData.nodeLabelInfo)) {
+            labels = parsedData.nodeLabelInfo;
+          } else {
+            labels = (parsedData && parsedData.nodeLabelInfo)?[parsedData.nodeLabelInfo]:[];
+          }
+          Ember.run(null, resolve, labels.map(function (label) {
+            return {name:label.name,exclusivity:label.exclusivity};
+          }));
         } else {
-          labels = (parsedData && parsedData.nodeLabels)?[parsedData.nodeLabels]:[];
+          if (parsedData && Em.isArray(parsedData.nodeLabels)) {
+            labels = parsedData.nodeLabels;
+          } else {
+            labels = (parsedData && parsedData.nodeLabels)?[parsedData.nodeLabels]:[];
+          }
+          Ember.run(null, resolve, labels.map(function (label) {
+            return {name:label};
+          }));
         }
-
-        Ember.run(null, resolve, labels.map(function (label) {
-          return {name:label};
-        }));
       }, function(jqXHR) {
         jqXHR.then = null;
         Ember.run(null, reject, jqXHR);
@@ -282,12 +295,15 @@ App.QueueAdapter = DS.Adapter.extend({
     }.bind(this),'App: QueueAdapter#getPrivilege');
   },
 
-  checkCluster:function () {
+  checkCluster:function (store) {
     var uri = [_getCapacitySchedulerViewUri(this),'cluster'].join('/');
     if (App.testMode)
       uri = uri + ".json";
     return new Ember.RSVP.Promise(function(resolve, reject) {
       _ajax(uri,'GET').then(function(data) {
+        if (data && data.Clusters && data.Clusters.version) {
+          store.set("stackId", data.Clusters.version);
+        }
         Ember.run(null, resolve, data);
       }, function(jqXHR) {
         if (jqXHR.status === 404) {
@@ -331,4 +347,3 @@ App.TagAdapter = App.QueueAdapter.extend({
     }, "App: TagAdapter#findAll " + type);
   }
 });
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/6be4f5aa/contrib/views/capacity-scheduler/src/main/resources/ui/app/store.js
----------------------------------------------------------------------
diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/store.js b/contrib/views/capacity-scheduler/src/main/resources/ui/app/store.js
index 4a9c6b0..36228a1 100644
--- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/store.js
+++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/store.js
@@ -117,6 +117,8 @@ App.ApplicationStore = DS.Store.extend({
 
   current_tag: '',
 
+  stackId: '',
+
   hasDeletedQueues:Em.computed.notEmpty('deletedQueues.[]'),
 
   deletedQueues:[],
@@ -287,7 +289,7 @@ App.ApplicationStore = DS.Store.extend({
     var adapter = this.get('defaultAdapter'),
         store = this,
         promise = new Ember.RSVP.Promise(function(resolve, reject) {
-          adapter.getNodeLabels().then(function(data) {
+          adapter.getNodeLabels(store).then(function(data) {
             store.set('isRmOffline',false);
             resolve(data);
           }, function() {
@@ -376,6 +378,6 @@ App.ApplicationStore = DS.Store.extend({
     return this.get('defaultAdapter').getPrivilege();
   },
   checkCluster:function () {
-    return this.get('defaultAdapter').checkCluster();
+    return this.get('defaultAdapter').checkCluster(this);
   }
 });


Mime
View raw message