Commit a8570135 by Rashid Khan

Made dashcontrol es index configurable

parent c72053a0
...@@ -25,8 +25,11 @@ ...@@ -25,8 +25,11 @@
<div class="span2"> <div class="span2">
<label class="small"> Elasticsearch </label><input type="checkbox" ng-model="panel.load.elasticsearch" ng-checked="panel.load.elasticsearch"> <label class="small"> Elasticsearch </label><input type="checkbox" ng-model="panel.load.elasticsearch" ng-checked="panel.load.elasticsearch">
</div> </div>
<div class="span4" ng-show="panel.load.elasticsearch"> <div class="span3" ng-show="panel.load.elasticsearch">
<label class="small"> Elasticsearch list size</label><input class="input-small" type="number" ng-model="panel.elasticsearch_size"> <label class="small">ES list size</label><input class="input-mini" type="number" ng-model="panel.elasticsearch_size">
</div>
<div class="span3" ng-show="panel.load.elasticsearch">
<label class="small">ES store index</label><input class="input-small" type="text" ng-model="panel.elasticsearch_saveto">
</div> </div>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -18,6 +18,7 @@ angular.module('kibana.dashcontrol', []) ...@@ -18,6 +18,7 @@ angular.module('kibana.dashcontrol', [])
local: true, local: true,
}, },
elasticsearch_size: 20, elasticsearch_size: 20,
elasticsearch_saveto: 'kibana-int'
} }
_.defaults($scope.panel,_d); _.defaults($scope.panel,_d);
...@@ -61,7 +62,7 @@ angular.module('kibana.dashcontrol', []) ...@@ -61,7 +62,7 @@ angular.module('kibana.dashcontrol', [])
$scope.save_elasticsearch = function() { $scope.save_elasticsearch = function() {
var save = _.clone($scope.dashboards) var save = _.clone($scope.dashboards)
save.title = $scope.elasticsearch.title; save.title = $scope.elasticsearch.title;
var result = $scope.ejs.Document('kibana-int','dashboard',save.title).source({ var result = $scope.ejs.Document($scope.panel.elasticsearch_saveto,'dashboard',save.title).source({
user: 'guest', user: 'guest',
group: 'guest', group: 'guest',
title: save.title, title: save.title,
...@@ -75,7 +76,7 @@ angular.module('kibana.dashcontrol', []) ...@@ -75,7 +76,7 @@ angular.module('kibana.dashcontrol', [])
} }
$scope.delete_elasticsearch = function(dashboard) { $scope.delete_elasticsearch = function(dashboard) {
var result = $scope.ejs.Document('kibana-int','dashboard',dashboard._id).doDelete(); var result = $scope.ejs.Document($scope.panel.elasticsearch_saveto,'dashboard',dashboard._id).doDelete();
result.then(function(result) { result.then(function(result) {
$scope.alert('Dashboard Deleted','','success',5000) $scope.alert('Dashboard Deleted','','success',5000)
$scope.elasticsearch.dashboards = _.without($scope.elasticsearch.dashboards,dashboard) $scope.elasticsearch.dashboards = _.without($scope.elasticsearch.dashboards,dashboard)
...@@ -84,7 +85,7 @@ angular.module('kibana.dashcontrol', []) ...@@ -84,7 +85,7 @@ angular.module('kibana.dashcontrol', [])
$scope.elasticsearch_dblist = function(query) { $scope.elasticsearch_dblist = function(query) {
if($scope.panel.load.elasticsearch) { if($scope.panel.load.elasticsearch) {
var request = $scope.ejs.Request().indices('kibana-int').types('dashboard'); var request = $scope.ejs.Request().indices($scope.panel.elasticsearch_saveto).types('dashboard');
var results = request.query( var results = request.query(
$scope.ejs.QueryStringQuery(query || '*') $scope.ejs.QueryStringQuery(query || '*')
).size($scope.panel.elasticsearch_size).doSearch(); ).size($scope.panel.elasticsearch_size).doSearch();
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<i ng-click="panel.offset = (panel.offset + panel.size);get_data();" ng-show="hits > (panel.offset + data.length)" class='icon-arrow-right pointer'></i> <i ng-click="panel.offset = (panel.offset + panel.size);get_data();" ng-show="hits > (panel.offset + data.length)" class='icon-arrow-right pointer'></i>
</div> </div>
</div> </div>
<div class="small" ng-show="panel.fields.length == 0">No columns configured. You may want to add a <strong>fields panel</strong>, or click the edit button in the top right of this panel to add some columns</div>
<table class="table table-condensed table-striped" ng-style="panel.style"> <table class="table table-condensed table-striped" ng-style="panel.style">
<thead> <thead>
<th style="white-space:nowrap" ng-repeat="field in panel.fields"> <th style="white-space:nowrap" ng-repeat="field in panel.fields">
......
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