mirror of
https://github.com/grafana/grafana.git
synced 2026-08-18 17:15:08 -05:00
working on rendering panel with phantomjs
This commit is contained in:
Executable
BIN
Binary file not shown.
@@ -0,0 +1,32 @@
|
||||
var page = require('webpage').create();
|
||||
var args = require('system').args;
|
||||
var params = {};
|
||||
|
||||
args.forEach(function(arg) {
|
||||
var parts = arg.split('=');
|
||||
params[parts[0]] = parts[1];
|
||||
});
|
||||
|
||||
var usage = "url=<url> png=<filename> width=<width> height=<height>";
|
||||
|
||||
if (!params.url || !params.png) {
|
||||
console.log(usage);
|
||||
phantom.exit();
|
||||
}
|
||||
|
||||
page.viewportSize = {
|
||||
width: '800',
|
||||
height: '400'
|
||||
};
|
||||
|
||||
page.open(params.url, function (status) {
|
||||
console.log('Loading a web page');
|
||||
|
||||
setTimeout(function() {
|
||||
console.log('rendering panel to ' + params.png);
|
||||
|
||||
page.render(params.png);
|
||||
phantom.exit();
|
||||
|
||||
}, 2000);
|
||||
});
|
||||
Reference in New Issue
Block a user