Commit 5768d7a2 by Torkel Ödegaard

Merge branch 'master' into dashboard_loading_refactoring

Conflicts:
	src/app/partials/dashboard.html
	src/app/partials/dasheditor.html
	src/app/services/graphite/graphiteDatasource.js
parents d9f2fca6 91b48258
vNext vNext
**New features or improvements** **New features or improvements**
- Allow [[..]] filter notation in all text panels (markdown/html/text) (Issue #511)
**Changes**
- Use unix epoch for Graphite from/to for absolute time ranges (Closes #536)
**Fixes**
- Fix formatting negative values (PR #545)
# 1.6.1 (2014-06-24)
**New features or improvements**
- Ability to set y min/max for right y-axis (RR #519, Closes #360) - thx @acedrew - Ability to set y min/max for right y-axis (RR #519, Closes #360) - thx @acedrew
**Fixes** **Fixes**
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"company": "Coding Instinct AB" "company": "Coding Instinct AB"
}, },
"name": "grafana", "name": "grafana",
"version": "1.6.0", "version": "1.6.1",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "http://github.com/torkelo/grafana.git" "url": "http://github.com/torkelo/grafana.git"
......
...@@ -481,23 +481,23 @@ function($, _, moment) { ...@@ -481,23 +481,23 @@ function($, _, moment) {
}; };
kbn.msFormat = function(size, decimals) { kbn.msFormat = function(size, decimals) {
if (size < 1000) { if (Math.abs(size) < 1000) {
return size.toFixed(0) + " ms"; return size.toFixed(0) + " ms";
} }
// Less than 1 min // Less than 1 min
else if (size < 60000) { else if (Math.abs(size) < 60000) {
return (size / 1000).toFixed(decimals) + " s"; return (size / 1000).toFixed(decimals) + " s";
} }
// Less than 1 hour, devide in minutes // Less than 1 hour, devide in minutes
else if (size < 3600000) { else if (Math.abs(size) < 3600000) {
return (size / 60000).toFixed(decimals) + " min"; return (size / 60000).toFixed(decimals) + " min";
} }
// Less than one day, devide in hours // Less than one day, devide in hours
else if (size < 86400000) { else if (Math.abs(size) < 86400000) {
return (size / 3600000).toFixed(decimals) + " hour"; return (size / 3600000).toFixed(decimals) + " hour";
} }
// Less than one year, devide in days // Less than one year, devide in days
else if (size < 31536000000) { else if (Math.abs(size) < 31536000000) {
return (size / 86400000).toFixed(decimals) + " day"; return (size / 86400000).toFixed(decimals) + " day";
} }
...@@ -506,23 +506,23 @@ function($, _, moment) { ...@@ -506,23 +506,23 @@ function($, _, moment) {
kbn.sFormat = function(size, decimals) { kbn.sFormat = function(size, decimals) {
// Less than 10 min, use seconds // Less than 10 min, use seconds
if (size < 600) { if (Math.abs(size) < 600) {
return size.toFixed(decimals) + " s"; return size.toFixed(decimals) + " s";
} }
// Less than 1 hour, devide in minutes // Less than 1 hour, devide in minutes
else if (size < 3600) { else if (Math.abs(size) < 3600) {
return (size / 60).toFixed(decimals) + " min"; return (size / 60).toFixed(decimals) + " min";
} }
// Less than one day, devide in hours // Less than one day, devide in hours
else if (size < 86400) { else if (Math.abs(size) < 86400) {
return (size / 3600).toFixed(decimals) + " hour"; return (size / 3600).toFixed(decimals) + " hour";
} }
// Less than one week, devide in days // Less than one week, devide in days
else if (size < 604800) { else if (Math.abs(size) < 604800) {
return (size / 86400).toFixed(decimals) + " day"; return (size / 86400).toFixed(decimals) + " day";
} }
// Less than one year, devide in week // Less than one year, devide in week
else if (size < 31536000) { else if (Math.abs(size) < 31536000) {
return (size / 604800).toFixed(decimals) + " week"; return (size / 604800).toFixed(decimals) + " week";
} }
...@@ -530,10 +530,10 @@ function($, _, moment) { ...@@ -530,10 +530,10 @@ function($, _, moment) {
}; };
kbn.microsFormat = function(size, decimals) { kbn.microsFormat = function(size, decimals) {
if (size < 1000) { if (Math.abs(size) < 1000) {
return size.toFixed(0) + " µs"; return size.toFixed(0) + " µs";
} }
else if (size < 1000000) { else if (Math.abs(size) < 1000000) {
return (size / 1000).toFixed(decimals) + " ms"; return (size / 1000).toFixed(decimals) + " ms";
} }
else { else {
...@@ -542,16 +542,16 @@ function($, _, moment) { ...@@ -542,16 +542,16 @@ function($, _, moment) {
}; };
kbn.nanosFormat = function(size, decimals) { kbn.nanosFormat = function(size, decimals) {
if (size < 1000) { if (Math.abs(size) < 1000) {
return size.toFixed(0) + " ns"; return size.toFixed(0) + " ns";
} }
else if (size < 1000000) { else if (Math.abs(size) < 1000000) {
return (size / 1000).toFixed(decimals) + " µs"; return (size / 1000).toFixed(decimals) + " µs";
} }
else if (size < 1000000000) { else if (Math.abs(size) < 1000000000) {
return (size / 1000000).toFixed(decimals) + " ms"; return (size / 1000000).toFixed(decimals) + " ms";
} }
else if (size < 60000000000){ else if (Math.abs(size) < 60000000000){
return (size / 1000000000).toFixed(decimals) + " s"; return (size / 1000000000).toFixed(decimals) + " s";
} }
else { else {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
"type": "text", "type": "text",
"loadingEditor": false, "loadingEditor": false,
"mode": "markdown", "mode": "markdown",
"content": "####Thank you for trying out Grafana! \n\nGeneral documentation is found in the readme and in the wiki section of the [Github Project](https://github.com/torkelo/grafana). If you encounter any problem or have an idea for an improvement do not hesitate to open a github issue. \n\nTips: \n\n- Ctrl+S saves the current dashboard\n- Ctrl+F Opens the dashboard finder (searches elastic search)\n- Ctrl+H Hide/show row controls \n- Click and drag graph title to move panel (only works when row controls are enabled)\n\nIf you do not see a graph in the panel bellow the browser cannot access your graphite installation. Please make sure that the graphiteUrl property in config.js is correctly set and accessible.", "content": "####Thank you for trying out Grafana! \n\nGeneral documentation is found in the readme and in the wiki section of the [Github Project](https://github.com/torkelo/grafana). If you encounter any problem or have an idea for an improvement do not hesitate to open a github issue. \n\nTips: \n\n- Ctrl+S saves the current dashboard\n- Ctrl+F Opens the dashboard finder (searches elastic search)\n- Ctrl+H Hide/show row controls \n- Click and drag graph title to move panel (only works when row controls are enabled)\n\nIf you do not see a graph in the panel below the browser cannot access your graphite installation. Please make sure that datasources property in config.js is correctly set and that any urls accessible from your browser.",
"style": {}, "style": {},
"title": "Welcome to Grafana" "title": "Welcome to Grafana"
} }
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
{ {
"span": 12, "span": 12,
"editable": true, "editable": true,
"type": "graphite", "type": "graph",
"x-axis": true, "x-axis": true,
"y-axis": true, "y-axis": true,
"scale": 1, "scale": 1,
......
<div ng-controller='text' ng-init="init()" style="min-height:{{panel.height || row.height}}" ng-dblclick="openEditor()"> <div ng-controller='text' ng-init="init()" style="min-height:{{panel.height || row.height}}" ng-dblclick="openEditor()">
<!--<p ng-style="panel.style" ng-bind-html-unsafe="panel.content | striphtml | newlines"></p>--> <p ng-bind-html-unsafe="content">
<markdown ng-show="ready && panel.mode == 'markdown'">
{{panel.content}}
</markdown>
<p ng-show="panel.mode == 'text'" ng-style='panel.style' ng-bind-html-unsafe="panel.content | striphtml | newlines">
</p>
<p ng-show="panel.mode == 'html'" ng-bind-html-unsafe="panel.content">
</p> </p>
</div> </div>
...@@ -14,7 +14,8 @@ define([ ...@@ -14,7 +14,8 @@ define([
'angular', 'angular',
'app', 'app',
'underscore', 'underscore',
'require' 'require',
'services/filterSrv'
], ],
function (angular, app, _, require) { function (angular, app, _, require) {
'use strict'; 'use strict';
...@@ -22,7 +23,7 @@ function (angular, app, _, require) { ...@@ -22,7 +23,7 @@ function (angular, app, _, require) {
var module = angular.module('kibana.panels.text', []); var module = angular.module('kibana.panels.text', []);
app.useModule(module); app.useModule(module);
module.controller('text', function($scope) { module.controller('text', function($scope, filterSrv) {
$scope.panelMeta = { $scope.panelMeta = {
description : "A static text panel that can use plain text, markdown, or (sanitized) HTML" description : "A static text panel that can use plain text, markdown, or (sanitized) HTML"
...@@ -39,63 +40,58 @@ function (angular, app, _, require) { ...@@ -39,63 +40,58 @@ function (angular, app, _, require) {
$scope.init = function() { $scope.init = function() {
$scope.initBaseController(this, $scope); $scope.initBaseController(this, $scope);
$scope.ready = false; $scope.ready = false;
$scope.$on('refresh', $scope.render);
$scope.render();
}; };
$scope.render = function() { $scope.render = function() {
$scope.$emit('render'); if ($scope.panel.mode === 'markdown') {
$scope.renderMarkdown($scope.panel.content);
}
else if ($scope.panel.mode === 'html') {
$scope.updateContent($scope.panel.content);
}
else if ($scope.panel.mode === 'text') {
$scope.renderText($scope.panel.content);
}
}; };
$scope.openEditor = function() { $scope.renderText = function(content) {
//$scope.$emit('open-modal','paneleditor'); content = content
console.log('scope id', $scope.$id); .replace(/&/g, '&amp;')
.replace(/>/g, '&gt;')
.replace(/</g, '&lt;')
.replace(/\n/g, '<br/>');
$scope.updateContent(content);
}; };
}); $scope.renderMarkdown = function(content) {
require(['./lib/showdown'], function (Showdown) {
var converter = new Showdown.converter();
var text = content
.replace(/&/g, '&amp;')
.replace(/>/g, '&gt;')
.replace(/</g, '&lt;');
module.directive('markdown', function() { $scope.updateContent(converter.makeHtml(text));
return { });
restrict: 'E', };
link: function(scope, element) {
scope.$on('render', function() { $scope.updateContent = function(html) {
render_panel(); try {
}); $scope.content = filterSrv.applyTemplateToTarget(html);
function render_panel() {
require(['./lib/showdown'], function (Showdown) {
scope.ready = true;
var converter = new Showdown.converter();
var text = scope.panel.content.replace(/&/g, '&amp;')
.replace(/>/g, '&gt;')
.replace(/</g, '&lt;');
var htmlText = converter.makeHtml(text);
element.html(htmlText);
// For whatever reason, this fixes chrome. I don't like it, I think
// it makes things slow?
if(!scope.$$phase) {
scope.$apply();
}
});
}
render_panel(); if(!$scope.$$phase) {
$scope.$apply();
}
} catch(e) {
} }
}; };
});
module.filter('newlines', function() { $scope.openEditor = function() {
return function (input) {
return input.replace(/\n/g, '<br/>');
}; };
});
module.filter('striphtml', function () {
return function(text) {
return text
.replace(/&/g, '&amp;')
.replace(/>/g, '&gt;')
.replace(/</g, '&lt;');
};
}); });
}); });
\ No newline at end of file
...@@ -51,32 +51,32 @@ ...@@ -51,32 +51,32 @@
</span> </span>
<ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="drop1"> <ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="drop1">
<li class="dropdown-submenu"> <li class="dropdown-submenu">
<a href="javascript:void();">Add Panel</a> <a href="javascript:void(0);">Add Panel</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a ng-click="add_panel_default('graph')">Graph</li></a> <li><a ng-click="add_panel_default('graph')">Graph</a></li>
<li><a ng-click="add_panel_default('text')">Text</li></a> <li><a ng-click="add_panel_default('text')">Text</a></li>
</ul> </ul>
</li> </li>
<li class="dropdown-submenu"> <li class="dropdown-submenu">
<a href="javascript:void();">Set height</a> <a href="javascript:void(0);">Set height</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a ng-click="set_height('100px')">100 px</li></a> <li><a ng-click="set_height('100px')">100 px</a></li>
<li><a ng-click="set_height('150px')">150 px</li></a> <li><a ng-click="set_height('150px')">150 px</a></li>
<li><a ng-click="set_height('200px')">200 px</li></a> <li><a ng-click="set_height('200px')">200 px</a></li>
<li><a ng-click="set_height('250px')">250 px</li></a> <li><a ng-click="set_height('250px')">250 px</a></li>
<li><a ng-click="set_height('300px')">300 px</li></a> <li><a ng-click="set_height('300px')">300 px</a></li>
<li><a ng-click="set_height('350px')">350 px</li></a> <li><a ng-click="set_height('350px')">350 px</a></li>
<li><a ng-click="set_height('450px')">450 px</li></a> <li><a ng-click="set_height('450px')">450 px</a></li>
<li><a ng-click="set_height('500px')">500 px</li></a> <li><a ng-click="set_height('500px')">500 px</a></li>
<li><a ng-click="set_height('600px')">600 px</li></a> <li><a ng-click="set_height('600px')">600 px</a></li>
<li><a ng-click="set_height('700px')">700 px</li></a> <li><a ng-click="set_height('700px')">700 px</a></li>
</ul> </ul>
</li> </li>
<li class="dropdown-submenu"> <li class="dropdown-submenu">
<a href="javascript:void();">Move</a> <a href="javascript:void(0);">Move</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a ng-click="move_row(-1)">Up</li></a> <li><a ng-click="move_row(-1)">Up</a></li>
<li><a ng-click="move_row(1)">Down</li></a> <li><a ng-click="move_row(1)">Down</a></li>
</ul> </ul>
</li> </li>
<li> <li>
......
...@@ -47,8 +47,9 @@ ...@@ -47,8 +47,9 @@
</div> </div>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="btn btn-success" ng-click="start();dismiss();"><i class="icon-play"></i> Start</button> <button class="btn btn-success" ng-click="start();dismiss();"><i class="icon-play"></i> Start</button>
<button type="button" class="btn btn-primary" ng-click="dismiss();"><i class="icon-ban-circle"></i> Cancel</button> <button type="button" class="btn btn-primary" ng-click="dismiss();"><i class="icon-ban-circle"></i> Cancel</button>
</div>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -120,3 +120,4 @@ ...@@ -120,3 +120,4 @@
</form> </form>
</div> </div>
</li> </li>
</ul>
...@@ -64,6 +64,11 @@ function (_) { ...@@ -64,6 +64,11 @@ function (_) {
}); });
addFuncDef({ addFuncDef({
name: 'diffSeries',
category: categories.Combine,
});
addFuncDef({
name: 'averageSeries', name: 'averageSeries',
shortName: 'avg', shortName: 'avg',
category: categories.Combine, category: categories.Combine,
......
...@@ -104,15 +104,7 @@ function (angular, _, $, config, kbn, moment) { ...@@ -104,15 +104,7 @@ function (angular, _, $, config, kbn, moment) {
} }
} }
if (timezone === 'browser') { return date.unix();
date = date.local();
}
if (config.timezoneOffset) {
date = date.zone(config.timezoneOffset);
}
return date.format('HH:mm_YYYYMMDD');
}; };
GraphiteDatasource.prototype.metricFindQuery = function(filterSrv, query) { GraphiteDatasource.prototype.metricFindQuery = function(filterSrv, query) {
......
...@@ -33,9 +33,7 @@ function (angular, _, kbn) { ...@@ -33,9 +33,7 @@ function (angular, _, kbn) {
var groupByTags = {}; var groupByTags = {};
_.each(queries, function(query) { _.each(queries, function(query) {
_.each(query.tags, function(val, key) { _.each(query.tags, function(val, key) {
if (val === "*") { groupByTags[key] = true;
groupByTags[key] = true;
}
}); });
}); });
......
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