You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by db...@apache.org on 2016/03/21 17:10:22 UTC

ambari git commit: AMBARI_14717. Updated Patch. Fixed the visual issues in Hive History view. (Rajendra Patil via dipayanb)

Repository: ambari
Updated Branches:
  refs/heads/trunk 8d8b61f4e -> 34a8b13aa


AMBARI_14717. Updated Patch. Fixed the visual issues in Hive History view. (Rajendra Patil via dipayanb)


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

Branch: refs/heads/trunk
Commit: 34a8b13aa4b54663d33148cfb8a76f43efc3adf1
Parents: 8d8b61f
Author: Dipayan Bhowmick <di...@gmail.com>
Authored: Mon Mar 21 21:40:07 2016 +0530
Committer: Dipayan Bhowmick <di...@gmail.com>
Committed: Mon Mar 21 21:40:07 2016 +0530

----------------------------------------------------------------------
 .../app/components/number-range-widget.js       | 17 ++---
 .../ui/hive-web/app/controllers/history.js      |  2 +-
 .../ui/hive-web/app/initializers/i18n.js        |  5 +-
 .../resources/ui/hive-web/app/styles/app.scss   |  9 +++
 .../components/column-filter-widget.hbs         |  2 +-
 .../ui/hive-web/app/utils/functions.js          | 76 ++++++++++++++------
 6 files changed, 78 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/34a8b13a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/number-range-widget.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/number-range-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/number-range-widget.js
index 7c5f69c..5d62b59 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/number-range-widget.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/number-range-widget.js
@@ -27,9 +27,6 @@ export default Ember.Component.extend({
     if (!numberRange.get('from') && !numberRange.get('to')) {
       numberRange.set('from', numberRange.get('min'));
       numberRange.set('to', numberRange.get('max'));
-      numberRange.set('fromDuration',utils.secondsToHHMMSS(numberRange.get('min')));
-      numberRange.set('toDuration',utils.secondsToHHMMSS(numberRange.get('max')));
-
     }
 
     this.$('.slider').slider({
@@ -42,28 +39,32 @@ export default Ember.Component.extend({
       slide: function (event, ui) {
         numberRange.set('from', ui.values[0]);
         numberRange.set('to', ui.values[1]);
-        numberRange.set('fromDuration', utils.secondsToHHMMSS(ui.values[0]));
-        numberRange.set('toDuration', utils.secondsToHHMMSS(ui.values[1]));
-
+        self.updateRangeLables();
       },
 
       change: function () {
         self.sendAction('rangeChanged', numberRange);
       }
     });
-
+    this.updateRangeLables();
     this.set('rendered', true);
   },
-
+  updateRangeLables: function () {
+    var numberRange = this.get('numberRange');
+    numberRange.set('fromDuration', utils.secondsToHHMMSS(numberRange.get('from')));
+    numberRange.set('toDuration', utils.secondsToHHMMSS(numberRange.get('to')));
+  },
   updateMin: function () {
     if (this.get('rendered')) {
       this.$('.slider').slider('values', 0, this.get('numberRange.from'));
+      this.updateRangeLables();
     }
   }.observes('numberRange.from'),
 
   updateMax: function () {
     if (this.get('rendered')) {
       this.$('.slider').slider('values', 1, this.get('numberRange.to'));
+      this.updateRangeLables();
     }
   }.observes('numberRange.to')
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/34a8b13a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/history.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/history.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/history.js
index e63362a..8c4ed2f 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/history.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/history.js
@@ -82,7 +82,7 @@ export default Ember.ArrayController.extend(FilterableMixin, {
       });
 
       minDuration = items.length ? Math.min.apply(Math, items) : 0;
-      maxDuration = items.length ? Math.max.apply(Math, items) : 0;
+      maxDuration = items.length ? Math.max.apply(Math, items) : 60; //Default 1 min
 
       durationColumn.set('numberRange.min', minDuration);
       durationColumn.set('numberRange.max', maxDuration);

http://git-wip-us.apache.org/repos/asf/ambari/blob/34a8b13a/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js
index 46847ae..b3630c1 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js
@@ -212,7 +212,10 @@ TRANSLATIONS = {
 
   labels: {
     noTablesMatch: 'No tables match',
-    table: 'Table '
+    table: 'Table ',
+    hoursShort: "{{hours}} hrs",
+    minsShort: "{{minutes}} mins",
+    secsShort: "{{seconds}} secs"
   },
 
   popover: {

http://git-wip-us.apache.org/repos/asf/ambari/blob/34a8b13a/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss b/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
index 716dc02..8f60595 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
@@ -151,6 +151,14 @@ aside  {
   }
 }
 
+.history-date-range {
+  white-space: nowrap;
+}
+.history-date-range .fromDate,
+.history-date-range .toDate {
+  width: 48%;
+}
+
 .form-control::-moz-placeholder {
   color: $placeholder-color;
 }
@@ -193,6 +201,7 @@ aside  {
 
 .slider {
   min-width: 200px;
+  margin-right: 8px;
 }
 
 .slider-labels {

http://git-wip-us.apache.org/repos/asf/ambari/blob/34a8b13a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/column-filter-widget.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/column-filter-widget.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/column-filter-widget.hbs
index 72c72c1..3435093 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/column-filter-widget.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/column-filter-widget.hbs
@@ -17,7 +17,7 @@
 }}
 
 {{#if column.dateRange}}
-    {{date-range-widget class="pull-left"
+    {{date-range-widget class="pull-left history-date-range"
                         rangeChanged="sendFilter"
                         dateRange=column.dateRange}}
 {{else}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/34a8b13a/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js
index 91e1a1c..32d81d3 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js
@@ -40,13 +40,21 @@ export default Ember.Object.create({
 
   validationValues: {
     bool: [
-      Ember.Object.create({ value: 'true' }),
-      Ember.Object.create({ value: 'false' })
+      Ember.Object.create({
+        value: 'true'
+      }),
+      Ember.Object.create({
+        value: 'false'
+      })
     ],
 
     execEngine: [
-      Ember.Object.create({ value: 'tez' }),
-      Ember.Object.create({ value: 'mr' })
+      Ember.Object.create({
+        value: 'tez'
+      }),
+      Ember.Object.create({
+        value: 'mr'
+      })
     ]
   },
 
@@ -66,7 +74,7 @@ export default Ember.Object.create({
     return sourceString.toLowerCase().indexOf(destString.toLowerCase()) > -1;
   },
 
-  convertToArray : function (inputObj) {
+  convertToArray: function (inputObj) {
     var array = [];
 
     for (var key in inputObj) {
@@ -85,23 +93,47 @@ export default Ember.Object.create({
    *
    * @param integer secs Number of seconds to convert
    * @return object
-  */
-  secondsToHHMMSS: function (secs)
-   {
-    var hours = Math.floor(secs / (60 * 60));
-
-    var divisor_for_minutes = secs % (60 * 60);
-    var minutes = Math.floor(divisor_for_minutes / 60);
-
-    var divisor_for_seconds = divisor_for_minutes % 60;
-    var seconds = Math.ceil(divisor_for_seconds);
-
-    var obj = {
-      "h": hours,
-      "m": minutes,
-      "s": seconds
-    };
-    return  ((obj.h > 0) ? obj.h + ' hr ' : '') + ((obj.m > 0) ? obj.m + ' min ' : '') + ((obj.s >= 0) ? obj.m + ' sec ' : '');
+   */
+  secondsToHHMMSS: function (secs) {
+    var hours = 0,
+      minutes = 0,
+      seconds = secs,
+      divisor_for_minutes,
+      divisor_for_seconds,
+      formattedVal = [];
+
+    if (seconds < 60) {
+      formattedVal.push(Ember.I18n.t('labels.secsShort', {
+        seconds: seconds
+      }));
+    } else {
+      hours = Math.floor(seconds / (60 * 60));
+
+      divisor_for_minutes = seconds % (60 * 60);
+      minutes = Math.floor(divisor_for_minutes / 60);
+
+      divisor_for_seconds = divisor_for_minutes % 60;
+      seconds = Math.ceil(divisor_for_seconds);
+
+      if (hours > 0) {
+        formattedVal.push(Ember.I18n.t('labels.hrsShort', {
+          hours: hours
+        }));
+      }
+      if (minutes > 0) {
+        formattedVal.push(Ember.I18n.t('labels.minsShort', {
+          minutes: minutes
+        }));
+      }
+      if (seconds > 0) {
+        formattedVal.push(Ember.I18n.t('labels.secsShort', {
+          seconds: seconds
+        }));
+      }
+
+    }
+
+    return formattedVal.join(' ');
   }
 
 });