mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
add export to csv in table panel
This commit is contained in:
@@ -186,8 +186,29 @@ function($, _) {
|
||||
text += series.alias + ';' + new Date(dp[1]).toISOString() + ';' + dp[0] + '\n';
|
||||
});
|
||||
});
|
||||
var blob = new Blob([text], { type: "text/csv;charset=utf-8" });
|
||||
window.saveAs(blob, 'grafana_data_export.csv');
|
||||
kbn.saveSaveBlob(text, 'grafana_data_export.csv');
|
||||
};
|
||||
|
||||
kbn.exportTableDataToCsv = function(table) {
|
||||
var text = '';
|
||||
// add header
|
||||
_.each(table.columns, function(column) {
|
||||
text += column.text + ';';
|
||||
});
|
||||
text += '\n';
|
||||
// process data
|
||||
_.each(table.rows, function(row) {
|
||||
_.each(row, function(value) {
|
||||
text += value + ';';
|
||||
});
|
||||
text += '\n';
|
||||
});
|
||||
kbn.saveSaveBlob(text, 'grafana_data_export.csv');
|
||||
};
|
||||
|
||||
kbn.saveSaveBlob = function(payload, fname) {
|
||||
var blob = new Blob([payload], { type: "text/csv;charset=utf-8" });
|
||||
window.saveAs(blob, fname);
|
||||
};
|
||||
|
||||
kbn.stringToJsRegex = function(str) {
|
||||
|
||||
Reference in New Issue
Block a user