Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved dash controller to navbar. Settings for it to dashboard settings. #467

Merged
merged 2 commits into from
Sep 6, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/css/bootstrap.dark.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion common/css/bootstrap.light.min.css

Large diffs are not rendered by default.

34 changes: 0 additions & 34 deletions dashboards/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,40 +91,6 @@
"status": "Stable"
}
]
},
{
"title": "Loader",
"height": "50px",
"editable": true,
"collapse": false,
"collapsable": true,
"panels": [
{
"error": false,
"span": 3,
"editable": true,
"group": [
"default"
],
"type": "dashcontrol",
"save": {
"gist": false,
"elasticsearch": true,
"local": true,
"default": true
},
"load": {
"gist": true,
"elasticsearch": true,
"local": true
},
"hide_control": false,
"elasticsearch_size": 20,
"temp": true,
"ttl_enable": true,
"temp_ttl": "30d"
}
]
}
],
"editable": true,
Expand Down
39 changes: 0 additions & 39 deletions dashboards/guided.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,45 +38,6 @@
"collapse": false,
"collapsable": true,
"panels": [
{
"error": false,
"span": 3,
"editable": true,
"group": [
"default"
],
"type": "dashcontrol",
"save": {
"gist": false,
"elasticsearch": true,
"local": true,
"default": true
},
"load": {
"gist": true,
"elasticsearch": true,
"local": true
},
"hide_control": false,
"elasticsearch_size": 20,
"temp": true,
"temp_ttl": "30d",
"ttl_enable": true
},
{
"error": false,
"span": 4,
"editable": true,
"group": [
"default"
],
"type": "text",
"status": "Stable",
"mode": "markdown",
"content": "The dashcontrol panel to the left lets you save this dashboard to Elasticsearch once you have it how you like it. See the note on the welcome page about setting a global default.",
"style": {},
"title": "The dashcontrol panel"
},
{
"error": false,
"span": 5,
Expand Down
4 changes: 0 additions & 4 deletions dashboards/logstash.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ dashboard.rows[0].panels = [
type: 'timepicker',
span: 6,
timespan: ARGS.from||_d_timespan
},
{
type: 'dashcontrol',
span: 3
}
];

Expand Down
25 changes: 0 additions & 25 deletions dashboards/logstash.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,31 +76,6 @@
},
"filter_id": 0,
"status": "Stable"
},
{
"error": false,
"span": 3,
"editable": true,
"group": [
"default"
],
"type": "dashcontrol",
"save": {
"gist": false,
"elasticsearch": true,
"local": true,
"default": true
},
"load": {
"gist": true,
"elasticsearch": true,
"local": true
},
"hide_control": false,
"elasticsearch_size": 20,
"temp": true,
"temp_ttl": "30d",
"ttl_enable": true
}
]
},
Expand Down
43 changes: 2 additions & 41 deletions dashboards/noted.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,45 +38,6 @@
"collapse": false,
"collapsable": true,
"panels": [
{
"error": false,
"span": 3,
"editable": true,
"group": [
"default"
],
"type": "dashcontrol",
"save": {
"gist": false,
"elasticsearch": true,
"local": true,
"default": true
},
"load": {
"gist": true,
"elasticsearch": true,
"local": true
},
"hide_control": false,
"elasticsearch_size": 20,
"temp": true,
"temp_ttl": "30d",
"ttl_enable": true
},
{
"error": false,
"span": 4,
"editable": true,
"group": [
"default"
],
"type": "text",
"status": "Stable",
"mode": "markdown",
"content": "The dashcontrol panel to the left lets you save this dashboard to Elasticsearch once you have it how you like it. See the note on the welcome page about setting a global default.",
"style": {},
"title": "The dashcontrol panel"
},
{
"error": false,
"span": 5,
Expand Down Expand Up @@ -212,6 +173,6 @@
"index": {
"interval": "none",
"pattern": "[logstash-]YYYY.MM.DD",
"default": "NOT_CONFIGURED"
"default": "_all"
}
}
}
11 changes: 7 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<!DOCTYPE html>
<!--[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 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
Expand Down Expand Up @@ -39,9 +37,14 @@
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container-fluid">
<p class="navbar-text pull-right version"><strong>Kibana 3</strong> milestone 3</p>
<span class="brand">{{dashboard.current.title}}</span>
<div class="brand"><i class='icon-cog pointer' ng-show='dashboard.current.editable' bs-modal="'partials/dasheditor.html'"></i></div>
<ul class="nav" ng-show='dashboard.current.editable'>
<li>
<a href='#' bs-modal="'partials/dasheditor.html'"><i class='icon-cog pointer'></i></a>
</li>
</ul>
<ul class="nav pull-right" ng-controller='dashLoader' ng-init="init()" ng-include="'partials/dashLoader.html'">
</ul>
</div>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ _.each(config.modules, function(v) {

/* Application level module which depends on filters, controllers, and services */
labjs.wait(function(){
// Create the module
angular.module('kibana', modules).config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/dashboard', {
Expand All @@ -58,6 +59,8 @@ labjs.wait(function(){
redirectTo: 'dashboard'
});
}]);

// Wait for ready, then bootstrap
angular.element(document).ready(function() {
$('body').attr('ng-controller', 'DashCtrl');
angular.bootstrap(document, ['kibana']);
Expand Down
112 changes: 112 additions & 0 deletions js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,118 @@ angular.module('kibana.controllers', [])

$scope.init();

})
.controller('dashLoader', function($scope, $http, timer, dashboard, alertSrv) {

$scope.loader = dashboard.current.loader;

$scope.init = function() {
$scope.gist_pattern = /(^\d{5,}$)|(^[a-z0-9]{10,}$)|(gist.github.com(\/*.*)\/[a-z0-9]{5,}\/*$)/;
$scope.gist = $scope.gist || {};
$scope.elasticsearch = $scope.elasticsearch || {};
};

$scope.showDropdown = function(type) {
var _l = $scope.loader;
if(type === 'load') {
return (_l.load_elasticsearch || _l.load_gist || _l.load_local);
}
if(type === 'save') {
return (_l.save_elasticsearch || _l.save_gist || _l.local_local || _l.save_default);
}
if(type === 'share') {
return (_l.save_temp);
}
return false;
};

$scope.set_default = function() {
if(dashboard.set_default()) {
alertSrv.set('Local Default Set',dashboard.current.title+' has been set as your local default','success',5000);
} else {
alertSrv.set('Incompatible Browser','Sorry, your browser is too old for this feature','error',5000);
}
};

$scope.purge_default = function() {
if(dashboard.purge_default()) {
alertSrv.set('Local Default Clear','Your local default dashboard has been cleared','success',5000);
} else {
alertSrv.set('Incompatible Browser','Sorry, your browser is too old for this feature','error',5000);
}
};

$scope.elasticsearch_save = function(type,ttl) {
dashboard.elasticsearch_save(
type,
($scope.elasticsearch.title || dashboard.current.title),
($scope.loader.save_temp_ttl_enable ? ttl : false)
).then(
function(result) {
if(!_.isUndefined(result._id)) {
alertSrv.set('Dashboard Saved','This dashboard has been saved to Elasticsearch as "' +
result._id + '"','success',5000);
if(type === 'temp') {
$scope.share = dashboard.share_link(dashboard.current.title,'temp',result._id);
}
} else {
alertSrv.set('Save failed','Dashboard could not be saved to Elasticsearch','error',5000);
}
});
};

$scope.elasticsearch_delete = function(id) {
dashboard.elasticsearch_delete(id).then(
function(result) {
if(!_.isUndefined(result)) {
if(result.found) {
alertSrv.set('Dashboard Deleted',id+' has been deleted','success',5000);
// Find the deleted dashboard in the cached list and remove it
var toDelete = _.where($scope.elasticsearch.dashboards,{_id:id})[0];
$scope.elasticsearch.dashboards = _.without($scope.elasticsearch.dashboards,toDelete);
} else {
alertSrv.set('Dashboard Not Found','Could not find '+id+' in Elasticsearch','warning',5000);
}
} else {
alertSrv.set('Dashboard Not Deleted','An error occurred deleting the dashboard','error',5000);
}
}
);
};

$scope.elasticsearch_dblist = function(query) {
dashboard.elasticsearch_list(query,$scope.loader.load_elasticsearch_size).then(
function(result) {
if(!_.isUndefined(result.hits)) {
$scope.hits = result.hits.total;
$scope.elasticsearch.dashboards = result.hits.hits;
}
});
};

$scope.save_gist = function() {
dashboard.save_gist($scope.gist.title).then(
function(link) {
if(!_.isUndefined(link)) {
$scope.gist.last = link;
alertSrv.set('Gist saved','You will be able to access your exported dashboard file at '+
'<a href="'+link+'">'+link+'</a> in a moment','success');
} else {
alertSrv.set('Save failed','Gist could not be saved','error',5000);
}
});
};

$scope.gist_dblist = function(id) {
dashboard.gist_list(id).then(
function(files) {
if(files && files.length > 0) {
$scope.gist.files = files;
} else {
alertSrv.set('Gist Failed','Could not retrieve dashboard list from gist','error',5000);
}
});
};
});


Expand Down
Loading