Merge pull request #88 from spenceralger/master

updates for latest changes in Kibana
This commit is contained in:
spenceralger 2014-01-27 08:11:12 -08:00
commit be5078ba7f
5 changed files with 18 additions and 41 deletions

View file

@ -12,17 +12,18 @@
define([
'angular',
'app',
'underscore',
'kbn'
'kbn',
'lodash',
'factories/store'
],
function (angular, app, _, kbn) {
function (angular, app, kbn, _) {
'use strict';
var module = angular.module('kibana.panels.marvel.cluster', []);
app.useModule(module);
module.controller('marvel.cluster', function($scope, $modal, $q, $http,
querySrv, dashboard, filterSrv, kbnVersion) {
querySrv, dashboard, filterSrv, kbnVersion, storeFactory) {
$scope.panelMeta = {
modals : [],
editorTabs : [],
@ -38,36 +39,12 @@ function (angular, app, _, kbn) {
var reportInterval = 86400000;
function store(expression) {
// get the current value, parse if it exists
var current = localStorage.getItem(expression);
if (current != null) {
try {
current = JSON.parse(current);
} catch (e) {
current = null;
}
}
// listen for changes and store them in localStorage,
// unless it is set to undefined then it will be removed
$scope.$watch(expression, function (val) {
if (_.isUndefined(val)) {
localStorage.removeItem(expression);
} else {
localStorage.setItem(expression, JSON.stringify(val));
}
});
return current;
}
// setup the optIn and version values
var marvelOpts = $scope.marvelOpts = {
report: store('marvelOpts.report'),
version: store('marvelOpts.version'),
lastReport: store('marvelOpts.lastReport')
};
var marvelOpts = storeFactory($scope, 'marvelOpts', {
report: null,
version: null,
lastReport: null
});
$scope.init = function () {
$scope.kbnVersion = kbnVersion;

View file

@ -14,10 +14,10 @@
define([
'angular',
'app',
'underscore',
'jquery'
'jquery',
'lodash',
],
function (angular, app, _, $) {
function (angular, app, $, _) {
'use strict';
var module = angular.module('kibana.panels.marvel.navigation', []);

View file

@ -2,7 +2,7 @@ define([
'angular',
'app',
'kbn',
'underscore',
'lodash',
'jquery',
'jquery.flot',
'jquery.flot.time'

View file

@ -216,7 +216,6 @@ define([
exec: function () {
output.update('');
submitCurrentRequestToES(function (resp) {
output.getSession().setMode("ace/mode/json");
output.update(resp);
});
}
@ -224,7 +223,6 @@ define([
$send.click(function () {
submitCurrentRequestToES(function (resp) {
output.getSession().setMode("ace/mode/json");
output.update(resp);
});
return false;

View file

@ -7,9 +7,11 @@ define([
var $el = $("#output");
var output = ace.require('ace/ace').edit($el[0]);
output.update = function (val, cb) {
output.getSession().setValue(val);
var session = output.getSession();
session.setMode(val ? 'ace/mode/json' : 'ace/mode/text');
session.setValue(val);
if (typeof cb === 'function') {
setTimeout(cb);
}