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> <!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en" id="ng-app"> <![endif]--> <!--[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 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 IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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"> <meta name="description" content="Search based application built using ElasticSearch, elastic.js, and Angular.js">
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
<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.dark.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">
<link rel="stylesheet" href="common/css/main.css"> <link rel="stylesheet" href="common/css/main.css">
<link rel="stylesheet" href="common/css/elasticjs.css"> <link rel="stylesheet" href="common/css/elasticjs.css">
<link rel="stylesheet" href="common/css/timepicker.css"> <link rel="stylesheet" href="common/css/timepicker.css">
</head>
<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>
</div>
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container-fluid">
<p class="navbar-text pull-right"><small><strong>Kibana 3</strong> <small>milestone 2</small></small></p>
<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>
</div>
</div>
<div class="container-fluid main">
<div class="row-fluid">
<div ng-view></div>
</div>
</div>
</body>
<!-- project dependency libs --> <!-- project dependency libs -->
<script src="common/lib/LAB.min.js"></script> <script src="common/lib/LAB.min.js"></script>
...@@ -27,26 +50,4 @@ ...@@ -27,26 +50,4 @@
<script src="config.js"></script> <script src="config.js"></script>
<script src="js/app.js"></script> <script src="js/app.js"></script>
</head>
<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>
</div>
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container-fluid">
<p class="navbar-text pull-right"><small><strong>Kibana 3</strong> <small>milestone 2</small></small></p>
<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>
</div>
</div>
<div class="container-fluid main">
<div class="row-fluid">
<div ng-view></div>
</div>
</div>
</body>
</html> </html>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</div> </div>
<div class="span3"> <div class="span3">
<label class="small">Time Ago</label> <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>
<div class="span2"> <div class="span2">
<label class="small">Font Size</label> <label class="small">Font Size</label>
...@@ -52,10 +52,7 @@ ...@@ -52,10 +52,7 @@
</form> </form>
</div> </div>
<div class="span8"> <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)"> <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>
<div class="span1"> <div class="span1">
<i class="icon-remove pointer" ng-click="remove_query(q)"></i> <i class="icon-remove pointer" ng-click="remove_query(q)"></i>
......
...@@ -147,7 +147,8 @@ angular.module('kibana.trends', []) ...@@ -147,7 +147,8 @@ angular.module('kibana.trends', [])
$scope.hits.new += n; $scope.hits.new += n;
$scope.hits.old += o; $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 // Create series
$scope.data[i] = { $scope.data[i] = {
label: $scope.panel.query[i].label || "query"+(parseInt(i)+1), label: $scope.panel.query[i].label || "query"+(parseInt(i)+1),
...@@ -155,7 +156,7 @@ angular.module('kibana.trends', []) ...@@ -155,7 +156,7 @@ angular.module('kibana.trends', [])
new : hits.new, new : hits.new,
old : hits.old old : hits.old
}, },
percent: _.isNull(percent) ? 0 : percent percent: percent
}; };
i++; i++;
...@@ -171,7 +172,7 @@ angular.module('kibana.trends', []) ...@@ -171,7 +172,7 @@ angular.module('kibana.trends', [])
} }
function percentage(x,y) { function percentage(x,y) {
return 100*(y-x)/x return x == 0 ? null : 100*(y-x)/x
} }
$scope.remove_query = function(q) { $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