You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by hi...@apache.org on 2014/12/19 20:18:23 UTC

[2/2] tez git commit: TEZ-1864. move initialization code dependent on config params to App.ready. (Sreenath Somarajapuram via hitesh)

TEZ-1864. move initialization code dependent on config params to App.ready. (Sreenath Somarajapuram via hitesh)


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

Branch: refs/heads/master
Commit: cdc5c7bf1fcb8796aa811fc1d6aeb802dc624d26
Parents: 7129646
Author: Hitesh Shah <hi...@apache.org>
Authored: Fri Dec 19 11:16:03 2014 -0800
Committer: Hitesh Shah <hi...@apache.org>
Committed: Fri Dec 19 11:16:03 2014 -0800

----------------------------------------------------------------------
 CHANGES.txt                               |   1 +
 tez-ui/src/main/webapp/app/scripts/app.js | 115 ++++++++++++-------------
 2 files changed, 56 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/cdc5c7bf/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 31d9c1e..37d0700 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,6 +6,7 @@ Release 0.6.0: Unreleased
 INCOMPATIBLE CHANGES
 
 ALL CHANGES:
+  TEZ-1864. move initialization code dependent on config params to App.ready.
   TEZ-1870. Time displayed in the UI is in GMT.
   TEZ-1858. Docs for deploying/using the Tez UI.
   TEZ-1642. TestAMRecovery sometimes fail.

http://git-wip-us.apache.org/repos/asf/tez/blob/cdc5c7bf/tez-ui/src/main/webapp/app/scripts/app.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/app.js b/tez-ui/src/main/webapp/app/scripts/app.js
index 43aad3c..d74ca34 100644
--- a/tez-ui/src/main/webapp/app/scripts/app.js
+++ b/tez-ui/src/main/webapp/app/scripts/app.js
@@ -36,72 +36,67 @@ App.Helpers = Em.Namespace.create(),
 App.Mappers = Em.Namespace.create(),
 App.Configs = Em.Namespace.create();
 
-Ember.Application.initializer({
-  name: "initApp",
+App.ready = function () {
+  $.extend(App.env, App.Configs.envDefaults);
 
-  initialize: function(container, application) {
-    $.extend(App.env, App.Configs.envDefaults);
+  App.ApplicationAdapter = App.TimelineRESTAdapter.extend({
+    host: App.env.timelineBaseUrl
+  });
+  App.ApplicationSerializer = App.TimelineSerializer.extend();
 
-    application.ApplicationAdapter = App.TimelineRESTAdapter.extend({
-      host: App.env.timelineBaseUrl
-    });
-    application.ApplicationSerializer = App.TimelineSerializer.extend();
+  App.AppDetailAdapter = DS.RESTAdapter.extend({
+    ajax: function(url, method, hash) {
+      hash = hash || {}; // hash may be undefined
+      hash.crossDomain = true;
+      hash.xhrFields = {withCredentials: true};
+      return this._super(url, method, hash);
+    },
+    namespace: App.Configs.restNamespace.applicationHistory,
+    host: App.env.timelineBaseUrl,
+    pathForType: function() {
+      return "apps";
+    },
+  });
 
-    application.AppDetailAdapter = DS.RESTAdapter.extend({
-      ajax: function(url, method, hash) {
-        hash = hash || {}; // hash may be undefined
-        hash.crossDomain = true;
-        hash.xhrFields = {withCredentials: true};
-        return this._super(url, method, hash);
-      },
-      namespace: App.Configs.restNamespace.applicationHistory,
-      host: App.env.timelineBaseUrl,
-      pathForType: function() {
-        return "apps";
-      },
-    });
-
-    application.VertexAdapter = App.ApplicationAdapter.extend({
-      _setInputs: function (store, data) {
-        var dagId = Ember.get(data, 'primaryfilters.TEZ_DAG_ID.0'),
-            vertexName = Ember.get(data, 'otherinfo.vertexName');
-        if(dagId) {
-          return store.find('dag', dagId).then(function (dag) {
-            if(dag.get('vertices') instanceof Array) {
-              var vertexData = dag.get('vertices').findBy('vertexName', vertexName);
-              if(vertexData && vertexData.additionalInputs) {
-                data.inputs = vertexData.additionalInputs;
-              }
+  App.VertexAdapter = App.ApplicationAdapter.extend({
+    _setInputs: function (store, data) {
+      var dagId = Ember.get(data, 'primaryfilters.TEZ_DAG_ID.0'),
+          vertexName = Ember.get(data, 'otherinfo.vertexName');
+      if(dagId) {
+        return store.find('dag', dagId).then(function (dag) {
+          if(dag.get('vertices') instanceof Array) {
+            var vertexData = dag.get('vertices').findBy('vertexName', vertexName);
+            if(vertexData && vertexData.additionalInputs) {
+              data.inputs = vertexData.additionalInputs;
             }
-            return data;
-          });
-        }
-        else {
-          return Em.RSVP.Promise(data);
-        }
-      },
-      find: function(store, type, id) {
-        var that = this;
-        return this._super(store, type, id).then(function (data) {
-          return that._setInputs(store, data);
-        });
-      },
-      findQuery: function(store, type, queryObj, records) {
-        var that = this;
-        return that._super(store, type, queryObj, records ).then(function (data) {
-          var fetchers = [];
-          data.entities.forEach(function (datum) {
-            fetchers.push(that._setInputs(store, datum));
-          });
-          return Em.RSVP.allSettled(fetchers).then(function () {
-            return data;
-          });
+          }
+          return data;
         });
       }
-    });
-
-  }
-});
+      else {
+        return Em.RSVP.Promise(data);
+      }
+    },
+    find: function(store, type, id) {
+      var that = this;
+      return this._super(store, type, id).then(function (data) {
+        return that._setInputs(store, data);
+      });
+    },
+    findQuery: function(store, type, queryObj, records) {
+      var that = this;
+      return that._super(store, type, queryObj, records ).then(function (data) {
+        var fetchers = [];
+        data.entities.forEach(function (datum) {
+          fetchers.push(that._setInputs(store, datum));
+        });
+        return Em.RSVP.allSettled(fetchers).then(function () {
+          return data;
+        });
+      });
+    }
+  });
+};
 
 /* Order and include */
 require('scripts/default-configs');