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

tez git commit: TEZ-1823. default ATS url should be the same host as ui (Prakash Ramachandran via Rajesh Balamohan)

Repository: tez
Updated Branches:
  refs/heads/TEZ-8 7f443597c -> 58a911935


TEZ-1823. default ATS url should be the same host as ui (Prakash Ramachandran via Rajesh Balamohan)


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

Branch: refs/heads/TEZ-8
Commit: 58a911935a990798f239bd67d6158f0a9f9adae4
Parents: 7f44359
Author: Rajesh Balamohan <rb...@hortonworks.com>
Authored: Tue Dec 9 03:49:05 2014 +0530
Committer: Rajesh Balamohan <rb...@hortonworks.com>
Committed: Tue Dec 9 03:49:05 2014 +0530

----------------------------------------------------------------------
 .../webapp/app/scripts/controllers/dag_tasks.js   |  3 ++-
 .../app/scripts/controllers/dags_controller.js    |  3 ++-
 .../controllers/vertex_tasks_controller.js        |  3 ++-
 .../main/webapp/app/scripts/default-configs.js    | 18 ++++++++++++++++--
 .../src/main/webapp/app/scripts/helpers/misc.js   | 16 ++++++++++++----
 .../app/scripts/mixins/paginated_content.js       |  5 ++++-
 tez-ui/src/main/webapp/app/scripts/router.js      |  3 ++-
 tez-ui/src/main/webapp/app/styles/main.less       |  2 ++
 8 files changed, 42 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/58a91193/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js b/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js
index f6d2c2c..92968a2 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js
@@ -49,6 +49,7 @@ App.DagTasksController = Em.ObjectController.extend(App.PaginatedContentMixin, A
     store = this.get('store'),
     fetcher;
     childEntityType = this.get('childEntityType');
+    var defaultErrMsg = 'Error while loading tasks. could not connect to %@'.fmt(App.env.timelineBaseUrl);
 
     store.unloadAll(childEntityType);
     store.findQuery(childEntityType, this.getFilterProperties()).then(function(entities){
@@ -70,7 +71,7 @@ App.DagTasksController = Em.ObjectController.extend(App.PaginatedContentMixin, A
       });
     }).catch(function(error){
       Em.Logger.error(error);
-      var err = App.Helpers.misc.formatError(error);
+      var err = App.Helpers.misc.formatError(error, defaultErrMsg);
       var msg = 'error code: %@, message: %@'.fmt(err.errCode, err.msg);
       App.Helpers.ErrorBar.getInstance().show(msg, error.details);
     });

http://git-wip-us.apache.org/repos/asf/tez/blob/58a91193/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js b/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js
index 2948eeb..4dab2a9 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js
@@ -74,6 +74,7 @@ App.DagsController = Em.ObjectController.extend(App.PaginatedContentMixin, App.C
     store = this.get('store'),
     childEntityType = this.get('childEntityType'),
     fetcher;
+    var defaultErrMsg = 'Error while loading dag info. could not connect to %@'.fmt(App.env.timelineBaseUrl);
 
     store.unloadAll(childEntityType);
     store.findQuery(childEntityType, this.getFilterProperties()).then(function(entities){
@@ -101,7 +102,7 @@ App.DagsController = Em.ObjectController.extend(App.PaginatedContentMixin, App.C
       });
     }).catch(function(error){
       Em.Logger.error(error);
-      var err = App.Helpers.misc.formatError(error);
+      var err = App.Helpers.misc.formatError(error, defaultErrMsg);
       var msg = 'error code: %@, message: %@'.fmt(err.errCode, err.msg);
       App.Helpers.ErrorBar.getInstance().show(msg, err.details);
     });

http://git-wip-us.apache.org/repos/asf/tez/blob/58a91193/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js b/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js
index 42f79a9..5b440f7 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js
@@ -46,6 +46,7 @@ App.VertexTasksController = Em.ObjectController.extend(App.PaginatedContentMixin
     store = this.get('store'),
     fetcher;
     childEntityType = this.get('childEntityType');
+    var defaultErrMsg = 'Error while loading tasks. could not connect to %@'.fmt(App.env.timelineBaseUrl);
 
     store.unloadAll(childEntityType);
     store.findQuery(childEntityType, this.getFilterProperties()).then(function(entities){
@@ -67,7 +68,7 @@ App.VertexTasksController = Em.ObjectController.extend(App.PaginatedContentMixin
       });
     }).catch(function(jqXHR){
       Em.Logger.error(error);
-      var err = App.Helpers.misc.formatError(error);
+      var err = App.Helpers.misc.formatError(error, defaultErrMsg);
       var msg = 'error code: %@, message: %@'.fmt(err.errCode, err.msg);
       App.Helpers.ErrorBar.getInstance().show(msg, err.details);
     });

http://git-wip-us.apache.org/repos/asf/tez/blob/58a91193/tez-ui/src/main/webapp/app/scripts/default-configs.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/default-configs.js b/tez-ui/src/main/webapp/app/scripts/default-configs.js
index 2f03585..fc7f28a 100644
--- a/tez-ui/src/main/webapp/app/scripts/default-configs.js
+++ b/tez-ui/src/main/webapp/app/scripts/default-configs.js
@@ -16,12 +16,26 @@
  * limitations under the License.
  */
 
+var getDefaultTimelineUrl = function() {
+  var location = window.location;
+  var protocol = App.env.isStandalone ? location.protocol : 'http';
+  var hostname = App.env.isStandalone ? location.hostname : 'localhost';
+  return '%@//%@:8188'.fmt(protocol, hostname);
+};
+
+var getDefaultRMWebUrl = function() {
+  var location = window.location;
+  var protocol = App.env.isStandalone ? location.protocol : 'http';
+  var hostname = App.env.isStandalone ? location.hostname : 'localhost';
+  return '%@//%@:8088'.fmt(protocol, hostname);
+};
+
 $.extend(true, App.Configs, {
   envDefaults: {
     version: "0.6.0",
 
-    timelineBaseUrl: 'http://localhost:8188',
-    RMWebUrl: 'http://localhost:8088',
+    timelineBaseUrl: getDefaultTimelineUrl(),
+    RMWebUrl: getDefaultRMWebUrl(),
   },
 
   restNamespace: {

http://git-wip-us.apache.org/repos/asf/tez/blob/58a91193/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/helpers/misc.js b/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
index d9c9fdd..d2ac9ef 100644
--- a/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
+++ b/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
@@ -133,9 +133,17 @@ App.Helpers.misc = {
    * returns a formatted message, the real cause is unknown and the error object details
    * depends on the error cause. the function tries to handle ajax error or a native errors
    */
-  formatError: function(error) {
-    var msg = error.statusText || error.message || '';
-    if (error.responseText) {
+  formatError: function(error, defaultErrorMessage) {
+    var msg;
+    // for cross domain requests, the error is not set if no access control headers were found.
+    // this could be either because there was a n/w error or the cors headers being not set.
+    if (error.status === 0 && error.statusText === 'error') {
+      msg = defaultErrorMessage ;
+    } else {
+      msg = error.statusText || error.message;
+    }
+    msg = msg || 'Unknown error';
+    if (!!error.responseText) {
       msg += error.responseText;
     }
     return {
@@ -177,4 +185,4 @@ App.Helpers.misc = {
     replace: true
   }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/tez/blob/58a91193/tez-ui/src/main/webapp/app/scripts/mixins/paginated_content.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/mixins/paginated_content.js b/tez-ui/src/main/webapp/app/scripts/mixins/paginated_content.js
index 66eb558..c1dcdc8 100644
--- a/tez-ui/src/main/webapp/app/scripts/mixins/paginated_content.js
+++ b/tez-ui/src/main/webapp/app/scripts/mixins/paginated_content.js
@@ -48,6 +48,9 @@ App.PaginatedContentMixin = Em.Mixin.create({
   loadEntities: function() {
     var that = this;
     var childEntityType = this.get('childEntityType');
+    var defaultErrMsg = 'Error while loading %@. could not connect to %@'
+      .fmt(childEntityType, App.env.timelineBaseUrl);
+
 
     that.set('loading', true);
 
@@ -57,7 +60,7 @@ App.PaginatedContentMixin = Em.Mixin.create({
       that.set('loading', false);
     }).catch(function(jqXHR){
       Em.Logger.error(error);
-      var err = App.Helpers.misc.formatError(error);
+      var err = App.Helpers.misc.formatError(error, defaultErrMsg);
       var msg = 'error code: %@, message: %@'.fmt(err.errCode, err.msg);
       App.Helpers.ErrorBar.getInstance().show(msg, err.details);
     });

http://git-wip-us.apache.org/repos/asf/tez/blob/58a91193/tez-ui/src/main/webapp/app/scripts/router.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/router.js b/tez-ui/src/main/webapp/app/scripts/router.js
index 7521e4a..0dbdb84 100644
--- a/tez-ui/src/main/webapp/app/scripts/router.js
+++ b/tez-ui/src/main/webapp/app/scripts/router.js
@@ -110,7 +110,8 @@ App.ApplicationRoute = Em.Route.extend({
     error: function(error, transition, originRoute) {
       this.replaceWith('error');
       Em.Logger.error(error);
-      var err = App.Helpers.misc.formatError(error);
+      var defaultError = 'Error while loading %@. could not connect to %@'.fmt(transition.targetName, App.env.timelineBaseUrl);
+      var err = App.Helpers.misc.formatError(error, defaultError);
       var msg = 'error code: %@, message: %@'.fmt(err.errCode, err.msg);
       App.Helpers.ErrorBar.getInstance().show(msg, error.details);
     }

http://git-wip-us.apache.org/repos/asf/tez/blob/58a91193/tez-ui/src/main/webapp/app/styles/main.less
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/styles/main.less b/tez-ui/src/main/webapp/app/styles/main.less
index 1bbf28c..930d2fd 100644
--- a/tez-ui/src/main/webapp/app/styles/main.less
+++ b/tez-ui/src/main/webapp/app/styles/main.less
@@ -188,6 +188,8 @@ body, html, body > .ember-view {
 
   .details {
     display: none;
+    overflow: auto;
+    max-height: 300px;
 
     &.visible {
       display: inline;