Skip to content

Commit

Permalink
Merge pull request #96 from e-ucm/kibanaObject
Browse files Browse the repository at this point in the history
Kibana object
  • Loading branch information
Dan Cristian, Rotaru committed Feb 19, 2018
2 parents 2f1b1c2 + 0203b55 commit 8eb30e5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
23 changes: 23 additions & 0 deletions app/public/js/controllers/kibana.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@ angular.module('kibanaApp', ['ngStorage', 'services', 'ngFileUpload'])
'{"name":"_score","type":"number","count":0,"scripted":false,"indexed":false,"analyzed":false,"doc_values":false}]'
}, null, ' ');

$scope.exampleObject = '';
$http.get(CONSTANTS.PROXY + '/kibana/object/' + $scope.version._id).success(function (data) {
$scope.exampleObject = JSON.stringify(data, null, 2);
});

$scope.exampleVisualization = JSON.stringify({
title: 'UsersScore',
visState: '{\"title\":\"Users score\",\"type\":\"histogram\",\"params\":{' +
Expand Down Expand Up @@ -402,6 +407,24 @@ angular.module('kibanaApp', ['ngStorage', 'services', 'ngFileUpload'])
}
};

$scope.addIndexObject = function () {
var object = JSON.parse(document.getElementById('exampleObject').value);
if (object) {
$http.post(CONSTANTS.PROXY + '/kibana/object/' + $scope.version._id, object).success(function (data) {
$.notify('<strong>Object saved successfully</strong>.', {
offset: { x: 10, y: 65 }
});
}).error(function (data, status) {
$.notify('<strong>Error while saving object</strong>', {
offset: { x: 10, y: 65 },
type: 'danger'
});
console.error('Error on post /kibana/object/' + $scope.version._id + ' ' +
JSON.stringify(data) + ', status: ' + status);
});
}
};

$scope.addTemplateVisualization = function () {
var visualization = JSON.parse(document.getElementById('exampleVisualization').value);
if (visualization) {
Expand Down
7 changes: 6 additions & 1 deletion app/views/view/data/configuration/kibanaIndex.jade
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@
span.glyphicon.glyphicon-arrow-left
li(class="next")
a(href="#kibanaVisualization" role="tab" data-toggle="tab" ng-click="selectedConfigView = 'kibanaVisualization'") Next
span.glyphicon.glyphicon-arrow-right
span.glyphicon.glyphicon-arrow-right
.row
hr
h1 Index Object
textarea#exampleObject(rows='6' ng-model='exampleObject')
button.btn.btn-primary.top15(ng-click='addIndexObject()') Use as index object

0 comments on commit 8eb30e5

Please sign in to comment.