Repository: ambari Updated Branches: refs/heads/trunk 50cb77bb0 -> 06a60dedf
AMBARI-19461 Log Search: default search ranges don't look right (mgergely) Change-Id: I318f10b171ee36afe180602c790954b9b60a4dd2 Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/06a60ded Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/06a60ded Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/06a60ded Branch: refs/heads/trunk Commit: 06a60dedf3a6dcce82d92200d9a84147ccf34b37 Parents: 50cb77b Author: Miklos Gergely <[email protected]> Authored: Thu Jan 12 17:57:20 2017 +0100 Committer: Miklos Gergely <[email protected]> Committed: Thu Jan 12 17:57:38 2017 +0100 ---------------------------------------------------------------------- .../src/main/webapp/scripts/utils/Utils.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/06a60ded/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js index 94a8a5b..924f92f 100644 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js @@ -839,26 +839,27 @@ define(['require', moment.tz.setDefault(zone) } this.getRelativeDateString =function(){} - this.getLast1HourRange = function(){ - return [moment().hour(moment().hours() - 1).minute(moment().minutes() - 1).seconds(moment().seconds() - 1), moment().hour(moment().hours()).minute(moment().minutes()).seconds(moment().seconds())]; + this.getLast1HourRange = function() { + var m = moment() + return [moment().hour(m.hours() - 1).minute(m.minutes()).seconds(m.seconds()).milliseconds(m.milliseconds() + 1), moment().hour(m.hours()).minute(m.minutes()).seconds(m.seconds()).milliseconds(m.milliseconds())]; } - this.getTodayRange = function() { - return [moment().hour('0').minute('0').seconds('01').milliseconds("000"), moment().hour('23').minute('59').seconds('59').milliseconds("999")]; + this.getTodayRange = function() { + return [moment().hour('0').minute('0').seconds('0').milliseconds("000"), moment().hour('23').minute('59').seconds('59').milliseconds("999")]; } this.getYesterdayRange = function() { - return [moment().subtract(1, 'days').hour('0').minute('0').seconds('01').milliseconds("000"), moment().subtract(1, 'days').hour('23').minute('59').seconds('59').milliseconds("999")]; + return [moment().subtract(1, 'days').hour('0').minute('0').seconds('0').milliseconds("000"), moment().subtract(1, 'days').hour('23').minute('59').seconds('59').milliseconds("999")]; } this.getLast7DaysRange = function() { - return [moment().subtract(6, 'days').hour('0').minute('0').seconds('01').milliseconds("000"), moment().hour('23').minute('59').seconds('59').milliseconds("999")]; + return [moment().subtract(6, 'days').hour('0').minute('0').seconds('0').milliseconds("000"), moment().hour('23').minute('59').seconds('59').milliseconds("999")]; } this.getLast30DaysRange = function() { - return [moment().subtract(29, 'days').hour('0').minute('0').seconds('01').milliseconds("000"), moment().hour('23').minute('59').seconds('59').milliseconds("999")]; + return [moment().subtract(29, 'days').hour('0').minute('0').seconds('0').milliseconds("000"), moment().hour('23').minute('59').seconds('59').milliseconds("999")]; } this.getThisMonthRange = function() { - return [moment().startOf('month').hour('0').minute('0').seconds('01').milliseconds("000"), moment().endOf('month').hour('23').minute('59').seconds('59').milliseconds("999")]; + return [moment().startOf('month').hour('0').minute('0').seconds('0').milliseconds("000"), moment().endOf('month').hour('23').minute('59').seconds('59').milliseconds("999")]; } this.getLastMonthRange = function() { - return [moment().subtract(1, 'month').startOf('month').hour('0').minute('0').seconds('01').milliseconds("000"), moment().subtract(1, 'month').endOf('month').hour('23').minute('59').seconds('59').milliseconds("999")]; + return [moment().subtract(1, 'month').startOf('month').hour('0').minute('0').seconds('0').milliseconds("000"), moment().subtract(1, 'month').endOf('month').hour('23').minute('59').seconds('59').milliseconds("999")]; } this.getOneDayTimeDiff = function(checkTime) { var hourDiff = checkTime.getHourDiff();
