Commit eb965c4c by Rashid Khan

Fixed null on missing trend data, added refresh on ago change, moved script…

Fixed null on missing trend data, added refresh on ago change, moved script loading to bottom of index.html
parent bf456c86
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en" id="ng-app"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en" id="ng-app"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en" id="ng-app"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en" id="ng-app"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="Search based application built using ElasticSearch, elastic.js, and Angular.js">
......@@ -20,16 +20,9 @@
<link rel="stylesheet" href="common/css/elasticjs.css">
<link rel="stylesheet" href="common/css/timepicker.css">
<!-- project dependency libs -->
<script src="common/lib/LAB.min.js"></script>
<script src="common/lib/underscore.min.js"></script>
<script src="common/lib/settings.js"></script>
<script src="config.js"></script>
<script src="js/app.js"></script>
</head>
</head>
<body ng-controller="DashCtrl" ng-cloak>
<body ng-controller="DashCtrl" ng-cloak>
<div ng-repeat='alert in global_alert' class="alert alert-{{alert.severity}} span12" style="position: fixed;top:2px;opacity:0.9;z-index:8000">
<button type="button" class="close" ng-click="clear_alert(alert)">&times;</button>
<strong>{{alert.title}}</strong> <span ng-bind-html-unsafe='alert.text'></span> <div class='pull-right small'> {{$index + 1}} alert(s) </div>
......@@ -48,5 +41,13 @@
<div ng-view></div>
</div>
</div>
</body>
</body>
<!-- project dependency libs -->
<script src="common/lib/LAB.min.js"></script>
<script src="common/lib/underscore.min.js"></script>
<script src="common/lib/settings.js"></script>
<script src="config.js"></script>
<script src="js/app.js"></script>
</html>
......@@ -15,7 +15,7 @@
</div>
<div class="span3">
<label class="small">Time Ago</label>
<input type="text" class="input-small" ng-model="panel.ago">
<input type="text" class="input-small" ng-model="panel.ago" ng-change="set_refresh(true)">
</div>
<div class="span2">
<label class="small">Font Size</label>
......@@ -52,10 +52,7 @@
</form>
</div>
<div class="span8">
<form class="input-append" style="margin-bottom: 0px">
<input type="text" style="width:80%" ng-model="q.query" ng-change="set_refresh(true)">
<button class="btn" ng-click="get_data()"><i class="icon-search"></i></button>
</form>
</div>
<div class="span1">
<i class="icon-remove pointer" ng-click="remove_query(q)"></i>
......
......@@ -147,7 +147,8 @@ angular.module('kibana.trends', [])
$scope.hits.new += n;
$scope.hits.old += o;
var percent = Math.round(percentage(hits.old,hits.new)*100)/100
var percent = percentage(hits.old,hits.new) == null ?
'?' : Math.round(percentage(hits.old,hits.new)*100)/100
// Create series
$scope.data[i] = {
label: $scope.panel.query[i].label || "query"+(parseInt(i)+1),
......@@ -155,7 +156,7 @@ angular.module('kibana.trends', [])
new : hits.new,
old : hits.old
},
percent: _.isNull(percent) ? 0 : percent
percent: percent
};
i++;
......@@ -171,7 +172,7 @@ angular.module('kibana.trends', [])
}
function percentage(x,y) {
return 100*(y-x)/x
return x == 0 ? null : 100*(y-x)/x
}
$scope.remove_query = function(q) {
......
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