Commit 6efd85b4 by Rashid Khan

Merge pull request #102 from rashidkpc/master

Moment.js + new color scheme. NOTE: INDEX STRING FORMAT HAS CHANGED
parents 3c361f98 443d6085
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
} }
.odd { .odd {
background-color: #f9f9f9; background-color: #3a3f44;
} }
.nomargin { .nomargin {
......

1.97 KB | W: | H:

723 Bytes | W: | H:

common/img/load.gif
common/img/load.gif
common/img/load.gif
common/img/load.gif
  • 2-up
  • Swipe
  • Onion skin

40.1 KB | W: | H:

2.82 KB | W: | H:

common/img/load_big.gif
common/img/load_big.gif
common/img/load_big.gif
common/img/load_big.gif
  • 2-up
  • Swipe
  • Onion skin
// moment.js
// version : 2.0.0
// author : Tim Wood
// license : MIT
// momentjs.com
(function(e){function O(e,t){return function(n){return j(e.call(this,n),t)}}function M(e){return function(t){return this.lang().ordinal(e.call(this,t))}}function _(){}function D(e){H(this,e)}function P(e){var t=this._data={},n=e.years||e.year||e.y||0,r=e.months||e.month||e.M||0,i=e.weeks||e.week||e.w||0,s=e.days||e.day||e.d||0,o=e.hours||e.hour||e.h||0,u=e.minutes||e.minute||e.m||0,a=e.seconds||e.second||e.s||0,f=e.milliseconds||e.millisecond||e.ms||0;this._milliseconds=f+a*1e3+u*6e4+o*36e5,this._days=s+i*7,this._months=r+n*12,t.milliseconds=f%1e3,a+=B(f/1e3),t.seconds=a%60,u+=B(a/60),t.minutes=u%60,o+=B(u/60),t.hours=o%24,s+=B(o/24),s+=i*7,t.days=s%30,r+=B(s/30),t.months=r%12,n+=B(r/12),t.years=n}function H(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function B(e){return e<0?Math.ceil(e):Math.floor(e)}function j(e,t){var n=e+"";while(n.length<t)n="0"+n;return n}function F(e,t,n){var r=t._milliseconds,i=t._days,s=t._months,o;r&&e._d.setTime(+e+r*n),i&&e.date(e.date()+i*n),s&&(o=e.date(),e.date(1).month(e.month()+s*n).date(Math.min(o,e.daysInMonth())))}function I(e){return Object.prototype.toString.call(e)==="[object Array]"}function q(e,t){var n=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),i=0,s;for(s=0;s<n;s++)~~e[s]!==~~t[s]&&i++;return i+r}function R(e,t){return t.abbr=e,s[e]||(s[e]=new _),s[e].set(t),s[e]}function U(e){return e?(!s[e]&&o&&require("./lang/"+e),s[e]):t.fn._lang}function z(e){return e.match(/\[.*\]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function W(e){var t=e.match(a),n,r;for(n=0,r=t.length;n<r;n++)A[t[n]]?t[n]=A[t[n]]:t[n]=z(t[n]);return function(i){var s="";for(n=0;n<r;n++)s+=typeof t[n].call=="function"?t[n].call(i,e):t[n];return s}}function X(e,t){function r(t){return e.lang().longDateFormat(t)||t}var n=5;while(n--&&f.test(t))t=t.replace(f,r);return C[t]||(C[t]=W(t)),C[t](e)}function V(e){switch(e){case"DDDD":return p;case"YYYY":return d;case"YYYYY":return v;case"S":case"SS":case"SSS":case"DDD":return h;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":case"a":case"A":return m;case"X":return b;case"Z":case"ZZ":return g;case"T":return y;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return c;default:return new RegExp(e.replace("\\",""))}}function $(e,t,n){var r,i,s=n._a;switch(e){case"M":case"MM":s[1]=t==null?0:~~t-1;break;case"MMM":case"MMMM":r=U(n._l).monthsParse(t),r!=null?s[1]=r:n._isValid=!1;break;case"D":case"DD":case"DDD":case"DDDD":t!=null&&(s[2]=~~t);break;case"YY":s[0]=~~t+(~~t>68?1900:2e3);break;case"YYYY":case"YYYYY":s[0]=~~t;break;case"a":case"A":n._isPm=(t+"").toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":s[3]=~~t;break;case"m":case"mm":s[4]=~~t;break;case"s":case"ss":s[5]=~~t;break;case"S":case"SS":case"SSS":s[6]=~~(("0."+t)*1e3);break;case"X":n._d=new Date(parseFloat(t)*1e3);break;case"Z":case"ZZ":n._useUTC=!0,r=(t+"").match(x),r&&r[1]&&(n._tzh=~~r[1]),r&&r[2]&&(n._tzm=~~r[2]),r&&r[0]==="+"&&(n._tzh=-n._tzh,n._tzm=-n._tzm)}t==null&&(n._isValid=!1)}function J(e){var t,n,r=[];if(e._d)return;for(t=0;t<7;t++)e._a[t]=r[t]=e._a[t]==null?t===2?1:0:e._a[t];r[3]+=e._tzh||0,r[4]+=e._tzm||0,n=new Date(0),e._useUTC?(n.setUTCFullYear(r[0],r[1],r[2]),n.setUTCHours(r[3],r[4],r[5],r[6])):(n.setFullYear(r[0],r[1],r[2]),n.setHours(r[3],r[4],r[5],r[6])),e._d=n}function K(e){var t=e._f.match(a),n=e._i,r,i;e._a=[];for(r=0;r<t.length;r++)i=(V(t[r]).exec(n)||[])[0],i&&(n=n.slice(n.indexOf(i)+i.length)),A[t[r]]&&$(t[r],i,e);e._isPm&&e._a[3]<12&&(e._a[3]+=12),e._isPm===!1&&e._a[3]===12&&(e._a[3]=0),J(e)}function Q(e){var t,n,r,i=99,s,o,u;while(e._f.length){t=H({},e),t._f=e._f.pop(),K(t),n=new D(t);if(n.isValid()){r=n;break}u=q(t._a,n.toArray()),u<i&&(i=u,r=n)}H(e,r)}function G(e){var t,n=e._i;if(w.exec(n)){e._f="YYYY-MM-DDT";for(t=0;t<4;t++)if(S[t][1].exec(n)){e._f+=S[t][0];break}g.exec(n)&&(e._f+=" Z"),K(e)}else e._d=new Date(n)}function Y(t){var n=t._i,r=u.exec(n);n===e?t._d=new Date:r?t._d=new Date(+r[1]):typeof n=="string"?G(t):I(n)?(t._a=n.slice(0),J(t)):t._d=n instanceof Date?new Date(+n):new Date(n)}function Z(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}function et(e,t,n){var i=r(Math.abs(e)/1e3),s=r(i/60),o=r(s/60),u=r(o/24),a=r(u/365),f=i<45&&["s",i]||s===1&&["m"]||s<45&&["mm",s]||o===1&&["h"]||o<22&&["hh",o]||u===1&&["d"]||u<=25&&["dd",u]||u<=45&&["M"]||u<345&&["MM",r(u/30)]||a===1&&["y"]||["yy",a];return f[2]=t,f[3]=e>0,f[4]=n,Z.apply({},f)}function tt(e,n,r){var i=r-n,s=r-e.day();return s>i&&(s-=7),s<i-7&&(s+=7),Math.ceil(t(e).add("d",s).dayOfYear()/7)}function nt(e){var n=e._i,r=e._f;return n===null||n===""?null:(typeof n=="string"&&(e._i=n=U().preparse(n)),t.isMoment(n)?(e=H({},n),e._d=new Date(+n._d)):r?I(r)?Q(e):K(e):Y(e),new D(e))}function rt(e,n){t.fn[e]=t.fn[e+"s"]=function(e){var t=this._isUTC?"UTC":"";return e!=null?(this._d["set"+t+n](e),this):this._d["get"+t+n]()}}function it(e){t.duration.fn[e]=function(){return this._data[e]}}function st(e,n){t.duration.fn["as"+e]=function(){return+this/n}}var t,n="2.0.0",r=Math.round,i,s={},o=typeof module!="undefined"&&module.exports,u=/^\/?Date\((\-?\d+)/i,a=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,f=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,l=/([0-9a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)/gi,c=/\d\d?/,h=/\d{1,3}/,p=/\d{3}/,d=/\d{1,4}/,v=/[+\-]?\d{1,6}/,m=/[0-9]*[a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF]+\s*?[\u0600-\u06FF]+/i,g=/Z|[\+\-]\d\d:?\d\d/i,y=/T/i,b=/[\+\-]?\d+(\.\d{1,3})?/,w=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,E="YYYY-MM-DDTHH:mm:ssZ",S=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],x=/([\+\-]|\d\d)/gi,T="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"),N={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},C={},k="DDD w W M D d".split(" "),L="M D H h m s w W".split(" "),A={M:function(){return this.month()+1},MMM:function(e){return this.lang().monthsShort(this,e)},MMMM:function(e){return this.lang().months(this,e)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(e){return this.lang().weekdaysMin(this,e)},ddd:function(e){return this.lang().weekdaysShort(this,e)},dddd:function(e){return this.lang().weekdays(this,e)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return j(this.year()%100,2)},YYYY:function(){return j(this.year(),4)},YYYYY:function(){return j(this.year(),5)},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return j(~~(this.milliseconds()/10),2)},SSS:function(){return j(this.milliseconds(),3)},Z:function(){var e=-this.zone(),t="+";return e<0&&(e=-e,t="-"),t+j(~~(e/60),2)+":"+j(~~e%60,2)},ZZ:function(){var e=-this.zone(),t="+";return e<0&&(e=-e,t="-"),t+j(~~(10*e/6),4)},X:function(){return this.unix()}};while(k.length)i=k.pop(),A[i+"o"]=M(A[i]);while(L.length)i=L.pop(),A[i+i]=O(A[i],2);A.DDDD=O(A.DDD,3),_.prototype={set:function(e){var t,n;for(n in e)t=e[n],typeof t=="function"?this[n]=t:this["_"+n]=t},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(e){return this._months[e.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(e){return this._monthsShort[e.month()]},monthsParse:function(e){var n,r,i,s;this._monthsParse||(this._monthsParse=[]);for(n=0;n<12;n++){this._monthsParse[n]||(r=t([2e3,n]),i="^"+this.months(r,"")+"|^"+this.monthsShort(r,""),this._monthsParse[n]=new RegExp(i.replace(".",""),"i"));if(this._monthsParse[n].test(e))return n}},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(e){return this._weekdays[e.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(e){return this._weekdaysShort[e.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(e){return this._weekdaysMin[e.day()]},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(e){var t=this._longDateFormat[e];return!t&&this._longDateFormat[e.toUpperCase()]&&(t=this._longDateFormat[e.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e]=t),t},meridiem:function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},calendar:function(e,t){var n=this._calendar[e];return typeof n=="function"?n.apply(t):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(e,t,n,r){var i=this._relativeTime[n];return typeof i=="function"?i(e,t,n,r):i.replace(/%d/i,e)},pastFuture:function(e,t){var n=this._relativeTime[e>0?"future":"past"];return typeof n=="function"?n(t):n.replace(/%s/i,t)},ordinal:function(e){return this._ordinal.replace("%d",e)},_ordinal:"%d",preparse:function(e){return e},postformat:function(e){return e},week:function(e){return tt(e,this._week.dow,this._week.doy)},_week:{dow:0,doy:6}},t=function(e,t,n){return nt({_i:e,_f:t,_l:n,_isUTC:!1})},t.utc=function(e,t,n){return nt({_useUTC:!0,_isUTC:!0,_l:n,_i:e,_f:t})},t.unix=function(e){return t(e*1e3)},t.duration=function(e,n){var r=t.isDuration(e),i=typeof e=="number",s=r?e._data:i?{}:e,o;return i&&(n?s[n]=e:s.milliseconds=e),o=new P(s),r&&e.hasOwnProperty("_lang")&&(o._lang=e._lang),o},t.version=n,t.defaultFormat=E,t.lang=function(e,n){var r;if(!e)return t.fn._lang._abbr;n?R(e,n):s[e]||U(e),t.duration.fn._lang=t.fn._lang=U(e)},t.langData=function(e){return e&&e._lang&&e._lang._abbr&&(e=e._lang._abbr),U(e)},t.isMoment=function(e){return e instanceof D},t.isDuration=function(e){return e instanceof P},t.fn=D.prototype={clone:function(){return t(this)},valueOf:function(){return+this._d},unix:function(){return Math.floor(+this._d/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._d},toJSON:function(){return t.utc(this).format("YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var e=this;return[e.year(),e.month(),e.date(),e.hours(),e.minutes(),e.seconds(),e.milliseconds()]},isValid:function(){return this._isValid==null&&(this._a?this._isValid=!q(this._a,(this._isUTC?t.utc(this._a):t(this._a)).toArray()):this._isValid=!isNaN(this._d.getTime())),!!this._isValid},utc:function(){return this._isUTC=!0,this},local:function(){return this._isUTC=!1,this},format:function(e){var n=X(this,e||t.defaultFormat);return this.lang().postformat(n)},add:function(e,n){var r;return typeof e=="string"?r=t.duration(+n,e):r=t.duration(e,n),F(this,r,1),this},subtract:function(e,n){var r;return typeof e=="string"?r=t.duration(+n,e):r=t.duration(e,n),F(this,r,-1),this},diff:function(e,n,r){var i=this._isUTC?t(e).utc():t(e).local(),s=(this.zone()-i.zone())*6e4,o,u;return n&&(n=n.replace(/s$/,"")),n==="year"||n==="month"?(o=(this.daysInMonth()+i.daysInMonth())*432e5,u=(this.year()-i.year())*12+(this.month()-i.month()),u+=(this-t(this).startOf("month")-(i-t(i).startOf("month")))/o,n==="year"&&(u/=12)):(o=this-i-s,u=n==="second"?o/1e3:n==="minute"?o/6e4:n==="hour"?o/36e5:n==="day"?o/864e5:n==="week"?o/6048e5:o),r?u:B(u)},from:function(e,n){return t.duration(this.diff(e)).lang(this.lang()._abbr).humanize(!n)},fromNow:function(e){return this.from(t(),e)},calendar:function(){var e=this.diff(t().startOf("day"),"days",!0),n=e<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse";return this.format(this.lang().calendar(n,this))},isLeapYear:function(){var e=this.year();return e%4===0&&e%100!==0||e%400===0},isDST:function(){return this.zone()<t([this.year()]).zone()||this.zone()<t([this.year(),5]).zone()},day:function(e){var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return e==null?t:this.add({d:e-t})},startOf:function(e){e=e.replace(/s$/,"");switch(e){case"year":this.month(0);case"month":this.date(1);case"week":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return e==="week"&&this.day(0),this},endOf:function(e){return this.startOf(e).add(e.replace(/s?$/,"s"),1).subtract("ms",1)},isAfter:function(e,n){return n=typeof n!="undefined"?n:"millisecond",+this.clone().startOf(n)>+t(e).startOf(n)},isBefore:function(e,n){return n=typeof n!="undefined"?n:"millisecond",+this.clone().startOf(n)<+t(e).startOf(n)},isSame:function(e,n){return n=typeof n!="undefined"?n:"millisecond",+this.clone().startOf(n)===+t(e).startOf(n)},zone:function(){return this._isUTC?0:this._d.getTimezoneOffset()},daysInMonth:function(){return t.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(e){var n=r((t(this).startOf("day")-t(this).startOf("year"))/864e5)+1;return e==null?n:this.add("d",e-n)},isoWeek:function(e){var t=tt(this,1,4);return e==null?t:this.add("d",(e-t)*7)},week:function(e){var t=this.lang().week(this);return e==null?t:this.add("d",(e-t)*7)},lang:function(t){return t===e?this._lang:(this._lang=U(t),this)}};for(i=0;i<T.length;i++)rt(T[i].toLowerCase().replace(/s$/,""),T[i]);rt("year","FullYear"),t.fn.days=t.fn.day,t.fn.weeks=t.fn.week,t.fn.isoWeeks=t.fn.isoWeek,t.duration.fn=P.prototype={weeks:function(){return B(this.days()/7)},valueOf:function(){return this._milliseconds+this._days*864e5+this._months*2592e6},humanize:function(e){var t=+this,n=et(t,!e,this.lang());return e&&(n=this.lang().pastFuture(t,n)),this.lang().postformat(n)},lang:t.fn.lang};for(i in N)N.hasOwnProperty(i)&&(st(i,N[i]),it(i.toLowerCase()));st("Weeks",6048e5),t.lang("en",{ordinal:function(e){var t=e%10,n=~~(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+n}}),o&&(module.exports=t),typeof ender=="undefined"&&(this.moment=t),typeof define=="function"&&define.amd&&define("moment",[],function(){return t})}).call(this);
\ No newline at end of file
...@@ -110,9 +110,9 @@ function add_to_query(original,field,value,negate) { ...@@ -110,9 +110,9 @@ function add_to_query(original,field,value,negate) {
*/ */
function calculate_interval(from,to,size,user_interval) { function calculate_interval(from,to,size,user_interval) {
if(_.isObject(from)) if(_.isObject(from))
from = from.getTime(); from = from.valueOf();
if(_.isObject(to)) if(_.isObject(to))
to = to.getTime(); to = to.valueOf();
return user_interval == 0 ? round_interval((to - from)/size) : user_interval; return user_interval == 0 ? round_interval((to - from)/size) : user_interval;
} }
......
/* /*
elasticsearch: URL to your elasticsearch server elasticsearch: URL to your elasticsearch server. You almost certainly don't
want 'http://localhost:9200' here. Even if Kibana and ES are on
the same host
kibana_index: The default ES index to use for storing Kibana specific object kibana_index: The default ES index to use for storing Kibana specific object
such as stored dashboards such as stored dashboards
modules: Panel modules to load. In the future these will be inferred modules: Panel modules to load. In the future these will be inferred
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
], ],
"timespan": "6h", "timespan": "6h",
"timefield": "@timestamp", "timefield": "@timestamp",
"index": "\"logstash-\"yyyy.mm.dd", "index": "[logstash-]YYYY.MM.DD",
"defaultindex": "NOINDEX", "defaultindex": "NOINDEX",
"index_interval": "day", "index_interval": "day",
"refresh": { "refresh": {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<title>Kibana 3</title> <title>Kibana 3</title>
<link rel="stylesheet" href="common/css/normalize.min.css"> <link rel="stylesheet" href="common/css/normalize.min.css">
<link rel="stylesheet" href="common/css/bootstrap.min.css"> <link rel="stylesheet" href="common/css/bootstrap.dark.min.css">
<link rel="stylesheet" href="common/css/animate.min.css"> <link rel="stylesheet" href="common/css/animate.min.css">
<link rel="stylesheet" href="common/css/bootstrap-responsive.min.css"> <link rel="stylesheet" href="common/css/bootstrap-responsive.min.css">
<link rel="stylesheet" href="common/css/font-awesome.min.css"> <link rel="stylesheet" href="common/css/font-awesome.min.css">
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<div class="navbar navbar-static-top"> <div class="navbar navbar-static-top">
<div class="navbar-inner"> <div class="navbar-inner">
<div class="container-fluid"> <div class="container-fluid">
<p class="navbar-text pull-right"><small><strong>Kibana 3</strong> <small>milestone pre-2</small></small></p> <p class="navbar-text pull-right"><small><strong>Kibana 3</strong> <small>milestone 2</small></small></p>
<span class="brand">{{dashboards.title}}</span> <span class="brand">{{dashboards.title}}</span>
<div class="brand"><i class='icon-edit pointer' ng-show='dashboards.editable' bs-modal="'partials/dasheditor.html'"></i></div> <div class="brand"><i class='icon-edit pointer' ng-show='dashboards.editable' bs-modal="'partials/dasheditor.html'"></i></div>
</div> </div>
......
...@@ -28,9 +28,7 @@ var labjs = $LAB ...@@ -28,9 +28,7 @@ var labjs = $LAB
.script("common/lib/angular-sanitize.min.js") .script("common/lib/angular-sanitize.min.js")
.script("common/lib/elastic.min.js") .script("common/lib/elastic.min.js")
.script("common/lib/elastic-angular-client.js") .script("common/lib/elastic-angular-client.js")
.script("common/lib/dateformat.js") .script("common/lib/moment.js")
.script("common/lib/date.js")
.script("common/lib/datepicker.js")
.script("common/lib/shared.js") .script("common/lib/shared.js")
.script("common/lib/filesaver.js") .script("common/lib/filesaver.js")
.script("js/services.js") .script("js/services.js")
......
...@@ -249,11 +249,7 @@ angular.module('kibana.histogram', []) ...@@ -249,11 +249,7 @@ angular.module('kibana.histogram', [])
$scope.set_time = function(time) { $scope.set_time = function(time) {
$scope.time = time; $scope.time = time;
// Should I be storing the index on the panel? It causes errors if the index $scope.index = time.index || $scope.index
// goes away. Hmmm.
$scope.index = time.index || $scope.index
// Only calculate interval if auto_int is set, otherwise don't touch it
$scope.get_data(); $scope.get_data();
} }
...@@ -305,21 +301,21 @@ angular.module('kibana.histogram', []) ...@@ -305,21 +301,21 @@ angular.module('kibana.histogram', [])
points: { show: scope.panel.points, fill: 1, fillColor: false, radius: 5}, points: { show: scope.panel.points, fill: 1, fillColor: false, radius: 5},
shadowSize: 1 shadowSize: 1
}, },
yaxis: { show: scope.panel['y-axis'], min: 0, color: "#000" }, yaxis: { show: scope.panel['y-axis'], min: 0, color: "#c8c8c8" },
xaxis: { xaxis: {
timezone: scope.panel.timezone, timezone: scope.panel.timezone,
show: scope.panel['x-axis'], show: scope.panel['x-axis'],
mode: "time", mode: "time",
timeformat: time_format(scope.panel.interval), timeformat: time_format(scope.panel.interval),
label: "Datetime", label: "Datetime",
color: "#000", color: "#c8c8c8",
}, },
selection: { selection: {
mode: "x", mode: "x",
color: '#ccc' color: '#ccc'
}, },
grid: { grid: {
backgroundColor: '#fff', backgroundColor: '#272b30',
borderWidth: 0, borderWidth: 0,
borderColor: '#eee', borderColor: '#eee',
color: "#eee", color: "#eee",
...@@ -359,13 +355,12 @@ angular.module('kibana.histogram', []) ...@@ -359,13 +355,12 @@ angular.module('kibana.histogram', [])
position: 'absolute', position: 'absolute',
top : y + 5, top : y + 5,
left : x + 5, left : x + 5,
color : "#000", color : "#c8c8c8",
border : '1px solid #000',
padding : '10px', padding : '10px',
'font-size': '11pt', 'font-size': '11pt',
'font-weight' : 200, 'font-weight' : 200,
'background-color': '#FFF', 'background-color': '#1f1f1f',
'border-radius': '10px', 'border-radius': '5px',
}).appendTo("body"); }).appendTo("body");
} }
...@@ -374,15 +369,15 @@ angular.module('kibana.histogram', []) ...@@ -374,15 +369,15 @@ angular.module('kibana.histogram', [])
tt(pos.pageX, pos.pageY, tt(pos.pageX, pos.pageY,
"<div style='vertical-align:middle;display:inline-block;background:"+item.series.color+";height:15px;width:15px;border-radius:10px;'></div> "+ "<div style='vertical-align:middle;display:inline-block;background:"+item.series.color+";height:15px;width:15px;border-radius:10px;'></div> "+
item.datapoint[1].toFixed(0) + " @ " + item.datapoint[1].toFixed(0) + " @ " +
new Date(item.datapoint[0]).format('mm/dd HH:MM:ss')); moment(item.datapoint[0]).format('MM/DD HH:mm:ss'));
} else { } else {
$("#pie-tooltip").remove(); $("#pie-tooltip").remove();
} }
}); });
elem.bind("plotselected", function (event, ranges) { elem.bind("plotselected", function (event, ranges) {
scope.time.from = new Date(ranges.xaxis.from); scope.time.from = moment(ranges.xaxis.from);
scope.time.to = new Date(ranges.xaxis.to) scope.time.to = moment(ranges.xaxis.to)
eventBus.broadcast(scope.$id,scope.panel.group,'set_time',scope.time) eventBus.broadcast(scope.$id,scope.panel.group,'set_time',scope.time)
}); });
} }
......
...@@ -181,10 +181,10 @@ angular.module('kibana.hits', []) ...@@ -181,10 +181,10 @@ angular.module('kibana.hits', [])
bars: { show: true, fill: 1, barWidth: 0.8, horizontal: false }, bars: { show: true, fill: 1, barWidth: 0.8, horizontal: false },
shadowSize: 1 shadowSize: 1
}, },
yaxis: { show: true, min: 0, color: "#000" }, yaxis: { show: true, min: 0, color: "#c8c8c8" },
xaxis: { show: false }, xaxis: { show: false },
grid: { grid: {
backgroundColor: '#fff', backgroundColor: '#272b30',
borderWidth: 0, borderWidth: 0,
borderColor: '#eee', borderColor: '#eee',
color: "#eee", color: "#eee",
...@@ -205,6 +205,10 @@ angular.module('kibana.hits', []) ...@@ -205,6 +205,10 @@ angular.module('kibana.hits', [])
color: '#999', color: '#999',
label: 'The Rest' label: 'The Rest'
}, },
stroke: {
color: '#272b30',
width: 0
},
label: { label: {
show: scope.panel.labels, show: scope.panel.labels,
radius: 2/3, radius: 2/3,
...@@ -243,13 +247,12 @@ angular.module('kibana.hits', []) ...@@ -243,13 +247,12 @@ angular.module('kibana.hits', [])
position: 'absolute', position: 'absolute',
top : y + 5, top : y + 5,
left : x + 5, left : x + 5,
color : "#000", color : "#c8c8c8",
border : '2px solid #000',
padding : '10px', padding : '10px',
'font-size': '11pt', 'font-size': '11pt',
'font-weight' : 200, 'font-weight' : 200,
'background-color': '#FFF', 'background-color': '#1f1f1f',
'border-radius': '10px', 'border-radius': '5px',
}).appendTo("body"); }).appendTo("body");
} }
......
...@@ -34,7 +34,7 @@ angular.module('kibana.map', []) ...@@ -34,7 +34,7 @@ angular.module('kibana.map', [])
var _d = { var _d = {
query : "*", query : "*",
map : "world", map : "world",
colors : ['#C8EEFF', '#0071A4'], colors : ['#A0E2E2', '#265656'],
size : 100, size : 100,
exclude : [], exclude : [],
spyable : true, spyable : true,
...@@ -143,9 +143,9 @@ angular.module('kibana.map', []) ...@@ -143,9 +143,9 @@ angular.module('kibana.map', [])
$('.jvectormap-zoomin,.jvectormap-zoomout,.jvectormap-label').remove(); $('.jvectormap-zoomin,.jvectormap-zoomout,.jvectormap-label').remove();
var map = elem.vectorMap({ var map = elem.vectorMap({
map: scope.panel.map, map: scope.panel.map,
regionStyle: {initial: {fill: '#ddd'}}, regionStyle: {initial: {fill: '#8c8c8c'}},
zoomOnScroll: false, zoomOnScroll: false,
backgroundColor: '#fff', backgroundColor: '#272b30',
series: { series: {
regions: [{ regions: [{
values: scope.data, values: scope.data,
...@@ -157,12 +157,12 @@ angular.module('kibana.map', []) ...@@ -157,12 +157,12 @@ angular.module('kibana.map', [])
$('.jvectormap-label').css({ $('.jvectormap-label').css({
"position" : "absolute", "position" : "absolute",
"display" : "none", "display" : "none",
"border" : "solid 2px #000", 'color' : "#c8c8c8",
"background" : "#FFF", 'padding' : '10px',
"font-weight" : 200, 'font-size': '11pt',
"border-radius": "5px", 'font-weight' : 200,
"color" : "#000", 'background-color': '#1f1f1f',
"padding" : "5px" 'border-radius': '5px'
}) })
var count = _.isUndefined(scope.data[code]) ? 0 : scope.data[code]; var count = _.isUndefined(scope.data[code]) ? 0 : scope.data[code];
$('.jvectormap-label').text(label.text() + ": " + count); $('.jvectormap-label').text(label.text() + ": " + count);
......
...@@ -156,8 +156,8 @@ angular.module('kibana.pie', []) ...@@ -156,8 +156,8 @@ angular.module('kibana.pie', [])
var complete = results.hits.total; var complete = results.hits.total;
var remaining = $scope.panel.query.goal - complete; var remaining = $scope.panel.query.goal - complete;
$scope.data = [ $scope.data = [
{ label : 'Complete', data : complete, color: '#86B22D' }, { label : 'Complete', data : complete, color: '#BF6730' },
{ data : remaining, color: '#EEE'}] { data : remaining, color: '#e2d0c4'}]
$scope.$emit('render'); $scope.$emit('render');
}); });
} }
...@@ -214,9 +214,9 @@ angular.module('kibana.pie', []) ...@@ -214,9 +214,9 @@ angular.module('kibana.pie', [])
show: scope.panel.labels, show: scope.panel.labels,
radius: 0, radius: 0,
formatter: function(label, series){ formatter: function(label, series){
var font = parseInt(scope.row.height.replace('px',''))/10 + String('px') var font = parseInt(scope.row.height.replace('px',''))/8 + String('px')
if(!(_.isUndefined(label))) if(!(_.isUndefined(label)))
return '<div style="font-size:'+font+';font-weight:bold;text-align:center;padding:2px;color:black;">'+ return '<div style="font-size:'+font+';font-weight:bold;text-align:center;padding:2px;color:#fff;">'+
Math.round(series.percent)+'%</div>'; Math.round(series.percent)+'%</div>';
else else
return '' return ''
...@@ -236,7 +236,7 @@ angular.module('kibana.pie', []) ...@@ -236,7 +236,7 @@ angular.module('kibana.pie', [])
var pie = { var pie = {
series: { series: {
pie: { pie: {
innerRadius: scope.panel.donut ? 0.4 : 0, innerRadius: scope.panel.donut ? 0.45 : 0,
tilt: scope.panel.tilt ? 0.45 : 1, tilt: scope.panel.tilt ? 0.45 : 1,
radius: 1, radius: 1,
show: true, show: true,
...@@ -244,11 +244,19 @@ angular.module('kibana.pie', []) ...@@ -244,11 +244,19 @@ angular.module('kibana.pie', [])
color: '#999', color: '#999',
label: 'The Rest' label: 'The Rest'
}, },
label: label label: label,
stroke: {
color: '#272b30',
width: 0
}
} }
}, },
//grid: { hoverable: true, clickable: true }, //grid: { hoverable: true, clickable: true },
grid: { hoverable: true, clickable: true }, grid: {
backgroundColor: '#272b30',
hoverable: true,
clickable: true
},
legend: { show: false }, legend: { show: false },
colors: ['#86B22D','#BF6730','#1D7373','#BFB930','#BF3030','#77207D'] colors: ['#86B22D','#BF6730','#1D7373','#BFB930','#BF3030','#77207D']
}; };
...@@ -264,16 +272,17 @@ angular.module('kibana.pie', []) ...@@ -264,16 +272,17 @@ angular.module('kibana.pie', [])
function piett(x, y, contents) { function piett(x, y, contents) {
var tooltip = $('#pie-tooltip').length ? var tooltip = $('#pie-tooltip').length ?
$('#pie-tooltip') : $('<div id="pie-tooltip"></div>'); $('#pie-tooltip') : $('<div id="pie-tooltip"></div>');
tooltip.html(contents).css({ tooltip.html(contents).css({
position: 'absolute', position: 'absolute',
top : y + 10, top : y + 10,
left : x + 10, left : x + 10,
color : "#000", color : "#c8c8c8",
'font-weight': 200,
'border-radius': '5px',
border : '2px solid #000',
padding : '10px', padding : '10px',
'background-color': '#FFF', 'font-size': '11pt',
'font-weight' : 200,
'background-color': '#1f1f1f',
'border-radius': '5px',
}).appendTo("body"); }).appendTo("body");
} }
......
...@@ -5,42 +5,42 @@ ...@@ -5,42 +5,42 @@
<tr><td><label><small>{{panel.label}}</small></label></td></tr> <tr><td><label><small>{{panel.label}}</small></label></td></tr>
<tr> <tr>
<td width="97%" style="padding-right:20px"> <td width="97%" style="padding-right:20px">
<input type="text" style="width:100%" ng-model="panel.query"> <span style="position:relative">
<i class="icon-remove-sign pointer" style="position:absolute;left:10px;top:3px" ng-show="panel.query.length > 0" ng-click="panel.query='';send_query(panel.query)"></i>
<input type="text" style="text-indent:20px;width:100%" ng-model="panel.query">
</span>
</td> </td>
<td style="margin-left:20px" width="1%"> <td style="margin-left:20px" width="1%">
<button style="margin-top:0px" type="submit" class="btn btn-info" ng-click="send_query(panel.query)"><i class="icon-search"></i></button> <button style="margin-top:0px" type="submit" class="btn btn-success btn-small" ng-click="send_query(panel.query)"><i class="icon-search"></i></button>
</td>
<td width="1%">
<button style="margin-top:0px" type="submit" class="btn btn-danger" ng-click="panel.query='';send_query(panel.query)"><i class="icon-ban-circle"></i></button>
</td>
<td width="1%">
<button style="margin-top:0px" ng-show="panel.multi" type="submit" class="btn" ng-click="add_query()"><i class="icon-plus"></i></button>
</td> </td>
<tr> <tr>
</table> </table>
</form> </form>
</div> </div>
<div class='row-fluid' ng-show="panel.multi && panel.multi_arrange == 'horizontal'"> <div class='row-fluid' ng-show="panel.multi && panel.multi_arrange == 'horizontal'">
<form class="form-inline" style="width:100%;margin:0px" >
<span ng-repeat="q in panel.query"> <span ng-repeat="q in panel.query">
<span class="input-append" style="margin-bottom:0px;margin-right:5px"> <span style="margin-bottom:0px;margin-right:5px;display:inline-block;position:relative">
<button class="btn btn-danger" type="submit" style="width:50px;margin-left:-50px;visibility:hidden"></button> <i class="icon-remove-sign pointer" style="position:absolute;left:10px;top:8px" ng-show="panel.query.length > 1" ng-click="remove_query($index);send_query(panel.query)"></i>
<input style="margin-bottom:5px;" type="text" ng-model="panel.query[$index]" ng-model-onblur style="width:90%"> <input style="margin-bottom:5px; text-indent: 20px;" type="text" ng-model="panel.query[$index]" ng-model-onblur style="width:90%">
<button class="btn btn-danger" ng-show="panel.query.length > 1" ng-click="remove_query($index);send_query(panel.query)"><i class="icon-minus"></i></button><br> <br>
</span> </span>
</span> </span>
</form> <br>
<button type="submit" class="btn btn-info" ng-click="send_query(panel.query)"><i class="icon-search"></i> Search</button> <button type="submit" class="btn btn-info" ng-click="send_query(panel.query)"><i class="icon-search"></i> Search</button>
<button type="submit" class="btn" ng-click="add_query();"><i class="icon-plus"></i> Add Query</button> <button type="submit" class="btn" ng-click="add_query();"><i class="icon-plus"></i></button>
</div> </div>
<div ng-show="panel.multi && panel.multi_arrange == 'vertical'"> <div ng-show="panel.multi && panel.multi_arrange == 'vertical'">
<form> <form>
<table class="form-horizontal"> <table class="form-horizontal" style="margin-bottom:5px;">
<tr><td class="small">Queries</td></tr> <tr><td class="small">Queries</td></tr>
<tr ng-repeat="q in panel.query" style="margin-bottom:10px"> <tr ng-repeat="q in panel.query" style="margin-bottom:10px">
<td width="99%"><input type="text" ng-model="panel.query[$index]" ng-model-onblur style="width:100%"></td> <td width="99%">
<span style="position:relative">
<i class="icon-remove-sign pointer" style="position:absolute;left:10px;top:3px" ng-show="panel.query.length > 1" ng-click="remove_query($index);send_query(panel.query)"></i>
<input type="text" ng-model="panel.query[$index]" ng-model-onblur style="text-indent: 20px;width:100%">
</span>
</td>
<td width="1%" style="visibility:hidden"><button class="btn btn-info" type="submit"></button></td> <td width="1%" style="visibility:hidden"><button class="btn btn-info" type="submit"></button></td>
<td width="1%"><button class="btn btn-danger" ng-show="panel.query.length > 1" ng-click="remove_query($index);send_query(panel.query)"><i class="icon-minus"></i></button></td>
</tr> </tr>
</table> </table>
<button type="submit" class="btn btn-info" ng-click="send_query(panel.query)"><i class="icon-search"></i> Search</button> <button type="submit" class="btn btn-info" ng-click="send_query(panel.query)"><i class="icon-search"></i> Search</button>
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
indices that match a specified timestamp pattern. This can be very indices that match a specified timestamp pattern. This can be very
efficient for some data sets (eg, logs) For example, to match the efficient for some data sets (eg, logs) For example, to match the
default logstash index pattern you might use default logstash index pattern you might use
<code>"logstash-"yyyy.mm.dd</code>. The quotes around "logstash-" are <code>[logstash-]YYYY.MM.DD</code>. The [] in "[logstash-]" are
important as they instruct Kibana not to treat those letters as a important as they instruct Kibana not to treat those letters as a
pattern. pattern.
</p> </p>
<p class="small"> <p class="small">
See <a href="http://blog.stevenlevithan.com/archives/date-time-format">http://blog.stevenlevithan.com/archives/date-time-format</a> See <a href="http://momentjs.com/docs/#/displaying/format/">http://momentjs.com/docs/#/displaying/format/</a>
for documentation on date formatting. for documentation on date formatting.
</p> </p>
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<h6>Timestamp</h6><select class="input-mini" ng-model="panel.index_interval" ng-options='f for f in ["none","hour","day","week","month","year"]'></select> <h6>Timestamp</h6><select class="input-mini" ng-model="panel.index_interval" ng-options='f for f in ["none","hour","day","week","month","year"]'></select>
</div> </div>
<div class="span5"> <div class="span5">
<h6>Index <span ng-show="panel.index_interval != 'none'">pattern <small>Absolutes in double quotes</small></span></h6> <h6>Index <span ng-show="panel.index_interval != 'none'">pattern <small>Absolutes in []</small></span></h6>
<input type="text" class="input-medium" ng-model="panel.index"> <input type="text" class="input-medium" ng-model="panel.index">
</div> </div>
<div class="span4"> <div class="span4">
......
...@@ -39,6 +39,7 @@ angular.module('kibana.timepicker', []) ...@@ -39,6 +39,7 @@ angular.module('kibana.timepicker', [])
index : '_all', index : '_all',
defaultindex : "_all", defaultindex : "_all",
index_interval: "none", index_interval: "none",
timeformat : "",
group : "default", group : "default",
refresh : { refresh : {
enable : false, enable : false,
...@@ -60,20 +61,20 @@ angular.module('kibana.timepicker', []) ...@@ -60,20 +61,20 @@ angular.module('kibana.timepicker', [])
switch($scope.panel.mode) { switch($scope.panel.mode) {
case 'absolute': case 'absolute':
$scope.time = { $scope.time = {
from : new Date(Date.parse($scope.panel.time.from)) || time_ago($scope.panel.timespan), from : moment($scope.panel.time.from,'YYYY-MM-DD HH:mm:ss') || moment(time_ago($scope.panel.timespan)),
to : new Date(Date.parse($scope.panel.time.to)) || new Date() to : moment($scope.panel.time.to,'YYYY-MM-DD HH:mm:ss') || moment()
} }
break; break;
case 'since': case 'since':
$scope.time = { $scope.time = {
from : new Date(Date.parse($scope.panel.time.from)) || time_ago($scope.panel.timespan), from : moment($scope.panel.time.from,'YYYY-MM-DD HH:mm:ss') || moment(time_ago($scope.panel.timespan)),
to : new Date() || new Date() to : moment()
} }
break; break;
case 'relative': case 'relative':
$scope.time = { $scope.time = {
from : time_ago($scope.panel.timespan), from : moment(time_ago($scope.panel.timespan)),
to : new Date() to : moment()
} }
break; break;
} }
...@@ -88,26 +89,26 @@ angular.module('kibana.timepicker', []) ...@@ -88,26 +89,26 @@ angular.module('kibana.timepicker', [])
// request one be sent by broadcasting a 'get_time' with its _id to its group // request one be sent by broadcasting a 'get_time' with its _id to its group
// This panel can handle multiple groups // This panel can handle multiple groups
eventBus.register($scope,"get_time", function(event,id) { eventBus.register($scope,"get_time", function(event,id) {
eventBus.broadcast($scope.$id,id,'time',$scope.time) eventBus.broadcast($scope.$id,id,'time',unmoment($scope.time))
}); });
// In case some other panel broadcasts a time, set us to an absolute range // In case some other panel broadcasts a time, set us to an absolute range
eventBus.register($scope,"set_time", function(event,time) { eventBus.register($scope,"set_time", function(event,time) {
$scope.panel.mode = 'absolute'; $scope.panel.mode = 'absolute';
set_timepicker(time.from,time.to) set_timepicker(moment(time.from),moment(time.to))
$scope.time_apply() $scope.time_apply()
}); });
eventBus.register($scope,"zoom", function(event,factor) { eventBus.register($scope,"zoom", function(event,factor) {
var _timespan = ($scope.time.to.getTime() - $scope.time.from.getTime()); var _timespan = ($scope.time.to.valueOf() - $scope.time.from.valueOf());
try { try {
if($scope.panel.mode != 'absolute') { if($scope.panel.mode != 'absolute') {
$scope.panel.mode = 'since' $scope.panel.mode = 'since'
set_timepicker(new Date($scope.time.to.getTime() - _timespan*factor),$scope.time.to) set_timepicker(moment($scope.time.to.valueOf() - _timespan*factor),$scope.time.to)
} else { } else {
var _center = $scope.time.to - _timespan/2 var _center = $scope.time.to.valueOf() - _timespan/2
set_timepicker(new Date(_center - (_timespan*factor)/2), set_timepicker(moment(_center - (_timespan*factor)/2),
new Date(_center + (_timespan*factor)/2)) moment(_center + (_timespan*factor)/2))
} }
} catch (e) { } catch (e) {
console.log(e) console.log(e)
...@@ -152,16 +153,16 @@ angular.module('kibana.timepicker', []) ...@@ -152,16 +153,16 @@ angular.module('kibana.timepicker', [])
$scope.to_now = function() { $scope.to_now = function() {
$scope.timepicker.to = { $scope.timepicker.to = {
time : new Date().format("HH:MM:ss"), time : moment().format("HH:mm:ss"),
date : new Date().format("mm/dd/yyyy") date : moment().format("MM/DD/YYYY")
} }
} }
$scope.set_timespan = function(timespan) { $scope.set_timespan = function(timespan) {
$scope.panel.timespan = timespan; $scope.panel.timespan = timespan;
$scope.timepicker.from = { $scope.timepicker.from = {
time : time_ago(timespan).format("HH:MM:ss"), time : moment(time_ago(timespan)).format("HH:mm:ss"),
date : time_ago(timespan).format("mm/dd/yyyy") date : moment(time_ago(timespan)).format("MM/DD/YYYY")
} }
$scope.time_apply(); $scope.time_apply();
} }
...@@ -172,22 +173,22 @@ angular.module('kibana.timepicker', []) ...@@ -172,22 +173,22 @@ angular.module('kibana.timepicker', [])
// //
$scope.time_calc = function(){ $scope.time_calc = function(){
// If time picker is defined (on initialization) // If time picker is defined (usually is)
if(!(_.isUndefined($scope.timepicker))) { if(!(_.isUndefined($scope.timepicker))) {
var from = $scope.panel.mode === 'relative' ? time_ago($scope.panel.timespan) : var from = $scope.panel.mode === 'relative' ? moment(time_ago($scope.panel.timespan)) :
new Date(Date.parse($scope.timepicker.from.date + " " + $scope.timepicker.from.time)) moment($scope.timepicker.from.date + " " + $scope.timepicker.from.time,'MM/DD/YYYY HH:mm:ss')
var to = $scope.panel.mode !== 'absolute' ? new Date() : var to = $scope.panel.mode !== 'absolute' ? moment() :
new Date(Date.parse($scope.timepicker.to.date + " " + $scope.timepicker.to.time)) moment($scope.timepicker.to.date + " " + $scope.timepicker.to.time,'MM/DD/YYYY HH:mm:ss')
// Otherwise // Otherwise (probably initialization)
} else { } else {
var from = $scope.panel.mode === 'relative' ? time_ago($scope.panel.timespan) : var from = $scope.panel.mode === 'relative' ? moment(time_ago($scope.panel.timespan)) :
$scope.time.from; $scope.time.from;
var to = $scope.panel.mode !== 'absolute' ? new Date() : var to = $scope.panel.mode !== 'absolute' ? moment() :
$scope.time.to; $scope.time.to;
} }
if (from.getTime() >= to.getTime()) if (from.valueOf() >= to.valueOf())
from = new Date(to.getTime() - 1000) from = moment(to.valueOf() - 1000)
$timeout(function(){ $timeout(function(){
set_timepicker(from,to) set_timepicker(from,to)
...@@ -209,11 +210,11 @@ angular.module('kibana.timepicker', []) ...@@ -209,11 +210,11 @@ angular.module('kibana.timepicker', [])
if($scope.panel.index_interval !== 'none') { if($scope.panel.index_interval !== 'none') {
indices($scope.time.from,$scope.time.to).then(function (p) { indices($scope.time.from,$scope.time.to).then(function (p) {
$scope.time.index = p; $scope.time.index = p;
eventBus.broadcast($scope.$id,$scope.panel.group,'time',$scope.time) eventBus.broadcast($scope.$id,$scope.panel.group,'time',unmoment($scope.time))
}); });
} else { } else {
$scope.time.index = [$scope.panel.index]; $scope.time.index = [$scope.panel.index];
eventBus.broadcast($scope.$id,$scope.panel.group,'time',$scope.time) eventBus.broadcast($scope.$id,$scope.panel.group,'time',unmoment($scope.time))
} }
// Update panel's string representation of the time object.Don't update if // Update panel's string representation of the time object.Don't update if
...@@ -221,8 +222,8 @@ angular.module('kibana.timepicker', []) ...@@ -221,8 +222,8 @@ angular.module('kibana.timepicker', [])
// json for relative periods // json for relative periods
if($scope.panel.mode !== 'relative') { if($scope.panel.mode !== 'relative') {
$scope.panel.time = { $scope.panel.time = {
from : $scope.time.from.format("mm/dd/yyyy HH:MM:ss"), from : $scope.time.from.format("MM/DD/YYYY HH:mm:ss"),
to : $scope.time.to.format("mm/dd/yyyy HH:MM:ss"), to : $scope.time.to.format("MM/DD/YYYY HH:mm:ss"),
index : $scope.time.index, index : $scope.time.index,
}; };
} else { } else {
...@@ -230,16 +231,25 @@ angular.module('kibana.timepicker', []) ...@@ -230,16 +231,25 @@ angular.module('kibana.timepicker', [])
} }
}; };
// Prefer to pass around Date() objects in the EventBus since interacting with
// moment objects in libraries that are expecting Date()s can be tricky
function unmoment(time) {
time = _.clone(time)
time.from = time.from.toDate()
time.to = time.to.toDate()
return time;
}
function set_timepicker(from,to) { function set_timepicker(from,to) {
// Janky 0s timeout to get around $scope queue processing view issue // Janky 0s timeout to get around $scope queue processing view issue
$scope.timepicker = { $scope.timepicker = {
from : { from : {
time : from.format("HH:MM:ss"), time : from.format("HH:mm:ss"),
date : from.format("mm/dd/yyyy") date : from.format("MM/DD/YYYY")
}, },
to : { to : {
time : to.format("HH:MM:ss"), time : to.format("HH:mm:ss"),
date : to.format("mm/dd/yyyy") date : to.format("MM/DD/YYYY")
} }
} }
} }
...@@ -282,8 +292,10 @@ angular.module('kibana.timepicker', []) ...@@ -282,8 +292,10 @@ angular.module('kibana.timepicker', [])
// I extract the date from an object that I'm get the UTC date. Stupid js. // I extract the date from an object that I'm get the UTC date. Stupid js.
// I die a little inside every time I call this function. // I die a little inside every time I call this function.
// Update: I just read this again. I died a little more inside. // Update: I just read this again. I died a little more inside.
// Update2: More death.
function fake_utc(date) { function fake_utc(date) {
return new Date(date.getTime() + date.getTimezoneOffset() * 60000); date = date.clone().toDate()
return moment(new Date(date.getTime() + date.getTimezoneOffset() * 60000));
} }
// Create an array of date objects by a given interval // Create an array of date objects by a given interval
...@@ -296,19 +308,19 @@ angular.module('kibana.timepicker', []) ...@@ -296,19 +308,19 @@ angular.module('kibana.timepicker', [])
range.push(start.clone()); range.push(start.clone());
switch (interval) { switch (interval) {
case 'hour': case 'hour':
start.addHours(1) start.add('hours',1)
break break
case 'day': case 'day':
start.addDays(1) start.add('days',1)
break break
case 'week': case 'week':
start.addWeeks(1) start.add('weeks',1)
break break
case 'month': case 'month':
start.addMonths(1) start.add('months',1)
break break
case 'year': case 'year':
start.addYears(1) start.add('years',1)
break break
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment