Skip to content

Commit 4eb440c

Browse files
committed
Fix babel issues
1 parent 1e8f481 commit 4eb440c

File tree

3 files changed

+3719
-2555
lines changed

3 files changed

+3719
-2555
lines changed

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,18 @@
1313
"license": "MIT",
1414
"devDependencies": {
1515
"@grafana/data": "next",
16-
"@grafana/ui": "next",
1716
"@grafana/toolkit": "next",
17+
"@grafana/ui": "next",
1818
"@types/grafana": "github:CorpGlory/types-grafana.git"
1919
},
2020
"resolutions": {
2121
"@babel/preset-env": "7.9.0"
2222
},
2323
"engines": {
2424
"node": ">=12 <13"
25+
},
26+
"dependencies": {
27+
"@babel/preset-env": "^7.12.1",
28+
"babel-loader": "^8.2.1"
2529
}
2630
}

src/module.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import config from 'grafana/app/core/config';
99
import jQuery from 'jquery';
1010
import { DataFrame } from '@grafana/data';
1111

12-
const SEL_DISABLE_DOWNLOAD_CSV = '<llow-csv><ble-csv><llow-download><ble-download>'.replace(/<(.+?)>/g, ':not([data-disa$1])');
12+
const SEL_DISABLE_DOWNLOAD_CSV = '<llow-csv><ble-csv><llow-download><ble-download>'.replace(
13+
/<(.+?)>/g,
14+
':not([data-disa$1])'
15+
);
1316

1417
const DEFAULT_PANEL_SETTINGS = {
1518
html: '<h2>Output of available datasets:</h2>\n<div><pre>{{ JSON.stringify(dataset, null, 2) }}</pre></div>',
@@ -209,7 +212,9 @@ export default class SimpleCtrl extends MetricsPanelCtrl {
209212
.reduce((carry, table, index) => {
210213
if (jQuery(table).is(SEL_DISABLE_DOWNLOAD_CSV)) {
211214
carry.push({
212-
text: table.getAttribute('data-title') ? `Export "${table.getAttribute('data-title')}" As CSV` : `Export Table #${index + 1} As CSV`,
215+
text: table.getAttribute('data-title')
216+
? `Export "${table.getAttribute('data-title')}" As CSV`
217+
: `Export Table #${index + 1} As CSV`,
213218
icon: 'fa fa-fw fa-table',
214219
click: `ctrl.csvifyTable(${index})`,
215220
});
@@ -399,7 +404,8 @@ export default class SimpleCtrl extends MetricsPanelCtrl {
399404
{ headers: columnNames }
400405
);
401406
let blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8' });
402-
let fileName = this.panel.title + JS.formatDate(new Date(), " (YYYY-MM-DD 'at' H.mm.ss)") + `.dataset-${data.raw.refId}.csv`;
407+
let fileName =
408+
this.panel.title + JS.formatDate(new Date(), " (YYYY-MM-DD 'at' H.mm.ss)") + `.dataset-${data.raw.refId}.csv`;
403409
saveAs(blob, fileName);
404410
}
405411

@@ -454,7 +460,11 @@ export default class SimpleCtrl extends MetricsPanelCtrl {
454460
toParams(objValues, opt_prefixVar) {
455461
return Object.entries(objValues)
456462
.reduce((arrParams, [key, value]) => {
457-
return arrParams.concat(JS.toArray(value).map(value => this.encode((opt_prefixVar ? 'var-' : '') + key) + '=' + this.encode(value)));
463+
return arrParams.concat(
464+
JS.toArray(value).map(
465+
value => this.encode((opt_prefixVar ? 'var-' : '') + key) + '=' + this.encode(value)
466+
)
467+
);
458468
}, [])
459469
.join('&');
460470
},
@@ -475,7 +485,8 @@ export default class SimpleCtrl extends MetricsPanelCtrl {
475485
getVarValues(opt_filter, opt_negate) {
476486
if (opt_filter && 'function' !== typeof opt_filter) {
477487
let arrFilter = JS.toArray(opt_filter);
478-
opt_filter = key => arrFilter.some(filter => (filter instanceof RegExp ? filter.test(key) : filter === key));
488+
opt_filter = key =>
489+
arrFilter.some(filter => (filter instanceof RegExp ? filter.test(key) : filter === key));
479490
}
480491

481492
return ctrl.templateSrv.variables.reduce((values, variable) => {

0 commit comments

Comments
 (0)