Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request elastic#88 from spenceralger/master
Browse files Browse the repository at this point in the history
updates for latest changes in Kibana
  • Loading branch information
spenceralger committed Jan 27, 2014
2 parents a54b0c6 + b1fa8af commit be5078b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 41 deletions.
43 changes: 10 additions & 33 deletions kibana/panels/cluster/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 : [],
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions kibana/panels/navigation/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', []);
Expand Down
2 changes: 1 addition & 1 deletion kibana/panels/stats_table/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ define([
'angular',
'app',
'kbn',
'underscore',
'lodash',
'jquery',
'jquery.flot',
'jquery.flot.time'
Expand Down
2 changes: 0 additions & 2 deletions sense/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,13 @@ define([
exec: function () {
output.update('');
submitCurrentRequestToES(function (resp) {
output.getSession().setMode("ace/mode/json");
output.update(resp);
});
}
});

$send.click(function () {
submitCurrentRequestToES(function (resp) {
output.getSession().setMode("ace/mode/json");
output.update(resp);
});
return false;
Expand Down
6 changes: 4 additions & 2 deletions sense/app/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit be5078b

Please sign in to comment.