Commit b6cdb0f8 by Torkel Ödegaard

Moved some expensive bindings from timepicker to controller

parent 472969ae
......@@ -64,7 +64,6 @@ function (angular, app, _, require) {
.replace(/</g, '&lt;');
if (converter) {
console.log("markdown render cached");
$scope.updateContent(converter.makeHtml(text));
}
else {
......
......@@ -16,13 +16,7 @@
<li class="dropdown">
<a class="dropdown-toggle timepicker-dropdown" data-toggle="dropdown" href="" bs-tooltip="time.tooltip" data-placement="bottom" ng-click="dismiss();">
<span ng-show="filter.time">
<span class="pointer" ng-hide="panel.now">{{time.from.date | date:'MMM d, y HH:mm:ss'}}</span>
<span class="pointer" ng-show="panel.now">{{time.from.date | moment:'ago'}}</span>
to
<span class="pointer" ng-hide="panel.now" >{{time.to.date | date:'MMM d, y HH:mm:ss'}}</span>
<span class="pointer" ng-show="panel.now">{{time.to.date | moment:'ago'}}</span>
</span>
<span ng-show="filter.time" ng-bind="time.rangeString"></span>
<span ng-hide="filter.time">Time filter</span>
<span ng-show="dashboard.refresh" class="text-warning">refreshed every {{dashboard.refresh}} </span>
<i class="icon-caret-down"></i>
......
......@@ -172,10 +172,7 @@ function (angular, app, _, moment, kbn) {
};
var getScopeTimeObj = function(from,to) {
var model = {
from: getTimeObj(from),
to: getTimeObj(to),
};
var model = { from: getTimeObj(from), to: getTimeObj(to), };
if (model.from.date) {
model.tooltip = moment(model.from.date).format('YYYY-MM-DD HH:mm:ss') + ' <br>to<br>';
......@@ -185,6 +182,17 @@ function (angular, app, _, moment, kbn) {
model.tooltip = 'Click to set time filter';
}
if ($scope.filter.time) {
if ($scope.panel.now) {
model.rangeString = moment(model.from.date).fromNow() + ' to ' +
moment(model.to.date).fromNow();
}
else {
model.rangeString = moment(model.from.date).format('MMM D, YYYY hh:mm:ss') + ' to ' +
moment(model.to.date).format('MMM D, YYYY hh:mm:ss');
}
}
return model;
};
......
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