diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..f4a18b851 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,15 @@ +name: Lint frontend + +on: [push] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'yarn' + - run: yarn install + - run: yarn lint diff --git a/.gitignore b/.gitignore index bb6066501..f774463e0 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,4 @@ docker/blocks/tempo/tempo-data .idea .vscode/ !.vscode/launch.json -.eslintcache \ No newline at end of file +.eslintcache diff --git a/jest.config.js b/jest.config.js index 1272c16a0..613c00bcd 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,7 +8,5 @@ const originalConfig = require('./.config/jest.config'); module.exports = { // Jest configuration provided by Grafana scaffolding ...originalConfig, - transformIgnorePatterns: originalConfig.transformIgnorePatterns.map((pattern) => - pattern.startsWith('node_modules') ? `../../${pattern}` : pattern - ), -}; \ No newline at end of file + transformIgnorePatterns: originalConfig.transformIgnorePatterns.map((pattern) => (pattern.startsWith('node_modules') ? `../../${pattern}` : pattern)), +}; diff --git a/snapshots.js b/snapshots.js index ec30c0c8b..fb4197c7f 100644 --- a/snapshots.js +++ b/snapshots.js @@ -1,1160 +1,1082 @@ module.exports = { - "__version": "10.11.0", - "sanity check": { - "health check": { - "1": { - "message": "OK", - "status": "OK" - } - } + __version: '10.11.0', + 'sanity check': { + 'health check': { + 1: { + message: 'OK', + status: 'OK', + }, + }, }, - "test the backend response": { - "backend json query": { - "1": { - "schema": { - "name": "A", - "refId": "A", - "meta": { - "typeVersion": [ - 0, - 0 - ], - "custom": { - "data": "[{\"name\":\"foo\",\"age\":30},{\"name\":\"bar\",\"age\":17}]", - "duration": 0, - "error": "", - "query": { - "alias": "", - "columns": [], - "computed_columns": [], - "csv_options": { - "columns": "", - "comment": "", - "delimiter": "", - "relax_column_count": false, - "skip_empty_lines": false, - "skip_lines_with_error": false + 'test the backend response': { + 'backend json query': { + 1: { + schema: { + name: 'A', + refId: 'A', + meta: { + typeVersion: [0, 0], + custom: { + data: '[{"name":"foo","age":30},{"name":"bar","age":17}]', + duration: 0, + error: '', + query: { + alias: '', + columns: [], + computed_columns: [], + csv_options: { + columns: '', + comment: '', + delimiter: '', + relax_column_count: false, + skip_empty_lines: false, + skip_lines_with_error: false, + }, + data: '[{"name":"foo","age":30},{"name":"bar","age":17}]', + dataOverrides: null, + expression: '', + filterExpression: '', + filters: null, + format: '', + global_query_id: '', + groq: '', + json_options: { + columnar: false, + root_is_not_array: false, }, - "data": "[{\"name\":\"foo\",\"age\":30},{\"name\":\"bar\",\"age\":17}]", - "dataOverrides": null, - "expression": "", - "filterExpression": "", - "filters": null, - "format": "", - "global_query_id": "", - "groq": "", - "json_options": { - "columnar": false, - "root_is_not_array": false + parser: 'backend', + query_mode: '', + refId: 'A', + root_selector: '', + seriesCount: 0, + source: 'inline', + sqlite_query: '', + summarizeBy: '', + summarizeExpression: '', + type: 'json', + uql: '', + url: '', + url_options: { + body_content_type: '', + body_form: null, + body_graphql_query: '', + body_graphql_variables: '', + body_type: '', + data: '', + headers: null, + method: '', + params: null, }, - "parser": "backend", - "query_mode": "", - "refId": "A", - "root_selector": "", - "seriesCount": 0, - "source": "inline", - "sqlite_query": "", - "summarizeBy": "", - "summarizeExpression": "", - "type": "json", - "uql": "", - "url": "", - "url_options": { - "body_content_type": "", - "body_form": null, - "body_graphql_query": "", - "body_graphql_variables": "", - "body_type": "", - "data": "", - "headers": null, - "method": "", - "params": null - } }, - "responseCodeFromServer": 0 + responseCodeFromServer: 0, }, - "executedQueryString": "This feature is not available for this type of query yet" + executedQueryString: 'This feature is not available for this type of query yet', }, - "fields": [ + fields: [ { - "name": "age", - "type": "number", - "typeInfo": { - "frame": "float64", - "nullable": true - } + name: 'age', + type: 'number', + typeInfo: { + frame: 'float64', + nullable: true, + }, }, { - "name": "name", - "type": "string", - "typeInfo": { - "frame": "string", - "nullable": true - } - } - ] + name: 'name', + type: 'string', + typeInfo: { + frame: 'string', + nullable: true, + }, + }, + ], }, - "data": { - "values": [ - [ - 30, - 17 - ], - [ - "foo", - "bar" - ] - ] - } - } + data: { + values: [ + [30, 17], + ['foo', 'bar'], + ], + }, + }, }, - "backend csv query": { - "1": { - "schema": { - "name": "A", - "refId": "A", - "meta": { - "typeVersion": [ - 0, - 0 - ], - "custom": { - "data": "name,age\nfoo,30\nbar,17", - "duration": 0, - "error": "", - "query": { - "alias": "", - "columns": [], - "computed_columns": [], - "csv_options": { - "columns": "", - "comment": "", - "delimiter": "", - "relax_column_count": false, - "skip_empty_lines": false, - "skip_lines_with_error": false + 'backend csv query': { + 1: { + schema: { + name: 'A', + refId: 'A', + meta: { + typeVersion: [0, 0], + custom: { + data: 'name,age\nfoo,30\nbar,17', + duration: 0, + error: '', + query: { + alias: '', + columns: [], + computed_columns: [], + csv_options: { + columns: '', + comment: '', + delimiter: '', + relax_column_count: false, + skip_empty_lines: false, + skip_lines_with_error: false, }, - "data": "name,age\nfoo,30\nbar,17", - "dataOverrides": null, - "expression": "", - "filterExpression": "", - "filters": null, - "format": "", - "global_query_id": "", - "groq": "", - "json_options": { - "columnar": false, - "root_is_not_array": false + data: 'name,age\nfoo,30\nbar,17', + dataOverrides: null, + expression: '', + filterExpression: '', + filters: null, + format: '', + global_query_id: '', + groq: '', + json_options: { + columnar: false, + root_is_not_array: false, + }, + parser: 'backend', + query_mode: '', + refId: 'A', + root_selector: '', + seriesCount: 0, + source: 'inline', + sqlite_query: '', + summarizeBy: '', + summarizeExpression: '', + type: 'csv', + uql: '', + url: '', + url_options: { + body_content_type: '', + body_form: null, + body_graphql_query: '', + body_graphql_variables: '', + body_type: '', + data: '', + headers: null, + method: '', + params: null, }, - "parser": "backend", - "query_mode": "", - "refId": "A", - "root_selector": "", - "seriesCount": 0, - "source": "inline", - "sqlite_query": "", - "summarizeBy": "", - "summarizeExpression": "", - "type": "csv", - "uql": "", - "url": "", - "url_options": { - "body_content_type": "", - "body_form": null, - "body_graphql_query": "", - "body_graphql_variables": "", - "body_type": "", - "data": "", - "headers": null, - "method": "", - "params": null - } }, - "responseCodeFromServer": 0 + responseCodeFromServer: 0, }, - "executedQueryString": "This feature is not available for this type of query yet" + executedQueryString: 'This feature is not available for this type of query yet', }, - "fields": [ + fields: [ { - "name": "age", - "type": "string", - "typeInfo": { - "frame": "string", - "nullable": true - } + name: 'age', + type: 'string', + typeInfo: { + frame: 'string', + nullable: true, + }, }, { - "name": "name", - "type": "string", - "typeInfo": { - "frame": "string", - "nullable": true - } - } - ] + name: 'name', + type: 'string', + typeInfo: { + frame: 'string', + nullable: true, + }, + }, + ], }, - "data": { - "values": [ - [ - "30", - "17" - ], - [ - "foo", - "bar" - ] - ] - } - } + data: { + values: [ + ['30', '17'], + ['foo', 'bar'], + ], + }, + }, }, - "backend tsv query": { - "1": { - "schema": { - "name": "A", - "refId": "A", - "meta": { - "typeVersion": [ - 0, - 0 - ], - "custom": { - "data": "name age\nfoo 30\nbar 17", - "duration": 0, - "error": "", - "query": { - "alias": "", - "columns": [], - "computed_columns": [], - "csv_options": { - "columns": "", - "comment": "", - "delimiter": "", - "relax_column_count": false, - "skip_empty_lines": false, - "skip_lines_with_error": false + 'backend tsv query': { + 1: { + schema: { + name: 'A', + refId: 'A', + meta: { + typeVersion: [0, 0], + custom: { + data: 'name age\nfoo 30\nbar 17', + duration: 0, + error: '', + query: { + alias: '', + columns: [], + computed_columns: [], + csv_options: { + columns: '', + comment: '', + delimiter: '', + relax_column_count: false, + skip_empty_lines: false, + skip_lines_with_error: false, + }, + data: 'name age\nfoo 30\nbar 17', + dataOverrides: null, + expression: '', + filterExpression: '', + filters: null, + format: '', + global_query_id: '', + groq: '', + json_options: { + columnar: false, + root_is_not_array: false, }, - "data": "name age\nfoo 30\nbar 17", - "dataOverrides": null, - "expression": "", - "filterExpression": "", - "filters": null, - "format": "", - "global_query_id": "", - "groq": "", - "json_options": { - "columnar": false, - "root_is_not_array": false + parser: 'backend', + query_mode: '', + refId: 'A', + root_selector: '', + seriesCount: 0, + source: 'inline', + sqlite_query: '', + summarizeBy: '', + summarizeExpression: '', + type: 'tsv', + uql: '', + url: '', + url_options: { + body_content_type: '', + body_form: null, + body_graphql_query: '', + body_graphql_variables: '', + body_type: '', + data: '', + headers: null, + method: '', + params: null, }, - "parser": "backend", - "query_mode": "", - "refId": "A", - "root_selector": "", - "seriesCount": 0, - "source": "inline", - "sqlite_query": "", - "summarizeBy": "", - "summarizeExpression": "", - "type": "tsv", - "uql": "", - "url": "", - "url_options": { - "body_content_type": "", - "body_form": null, - "body_graphql_query": "", - "body_graphql_variables": "", - "body_type": "", - "data": "", - "headers": null, - "method": "", - "params": null - } }, - "responseCodeFromServer": 0 + responseCodeFromServer: 0, }, - "executedQueryString": "This feature is not available for this type of query yet" + executedQueryString: 'This feature is not available for this type of query yet', }, - "fields": [ + fields: [ { - "name": "name age", - "type": "string", - "typeInfo": { - "frame": "string", - "nullable": true - } - } - ] + name: 'name age', + type: 'string', + typeInfo: { + frame: 'string', + nullable: true, + }, + }, + ], }, - "data": { - "values": [ - [ - "foo 30", - "bar 17" - ] - ] - } - } + data: { + values: [['foo 30', 'bar 17']], + }, + }, }, - "backend graphql query": { - "1": { - "schema": { - "name": "A", - "refId": "A", - "meta": { - "typeVersion": [ - 0, - 0 - ], - "custom": { - "data": "[{\"name\":\"foo\",\"age\":30},{\"name\":\"bar\",\"age\":17}]", - "duration": 0, - "error": "", - "query": { - "alias": "", - "columns": [], - "computed_columns": [], - "csv_options": { - "columns": "", - "comment": "", - "delimiter": "", - "relax_column_count": false, - "skip_empty_lines": false, - "skip_lines_with_error": false + 'backend graphql query': { + 1: { + schema: { + name: 'A', + refId: 'A', + meta: { + typeVersion: [0, 0], + custom: { + data: '[{"name":"foo","age":30},{"name":"bar","age":17}]', + duration: 0, + error: '', + query: { + alias: '', + columns: [], + computed_columns: [], + csv_options: { + columns: '', + comment: '', + delimiter: '', + relax_column_count: false, + skip_empty_lines: false, + skip_lines_with_error: false, + }, + data: '[{"name":"foo","age":30},{"name":"bar","age":17}]', + dataOverrides: null, + expression: '', + filterExpression: '', + filters: null, + format: '', + global_query_id: '', + groq: '', + json_options: { + columnar: false, + root_is_not_array: false, }, - "data": "[{\"name\":\"foo\",\"age\":30},{\"name\":\"bar\",\"age\":17}]", - "dataOverrides": null, - "expression": "", - "filterExpression": "", - "filters": null, - "format": "", - "global_query_id": "", - "groq": "", - "json_options": { - "columnar": false, - "root_is_not_array": false + parser: 'backend', + query_mode: '', + refId: 'A', + root_selector: '', + seriesCount: 0, + source: 'inline', + sqlite_query: '', + summarizeBy: '', + summarizeExpression: '', + type: 'graphql', + uql: '', + url: '', + url_options: { + body_content_type: '', + body_form: null, + body_graphql_query: '', + body_graphql_variables: '', + body_type: '', + data: '', + headers: null, + method: '', + params: null, }, - "parser": "backend", - "query_mode": "", - "refId": "A", - "root_selector": "", - "seriesCount": 0, - "source": "inline", - "sqlite_query": "", - "summarizeBy": "", - "summarizeExpression": "", - "type": "graphql", - "uql": "", - "url": "", - "url_options": { - "body_content_type": "", - "body_form": null, - "body_graphql_query": "", - "body_graphql_variables": "", - "body_type": "", - "data": "", - "headers": null, - "method": "", - "params": null - } }, - "responseCodeFromServer": 0 + responseCodeFromServer: 0, }, - "executedQueryString": "This feature is not available for this type of query yet" + executedQueryString: 'This feature is not available for this type of query yet', }, - "fields": [ + fields: [ { - "name": "age", - "type": "number", - "typeInfo": { - "frame": "float64", - "nullable": true - } + name: 'age', + type: 'number', + typeInfo: { + frame: 'float64', + nullable: true, + }, }, { - "name": "name", - "type": "string", - "typeInfo": { - "frame": "string", - "nullable": true - } - } - ] + name: 'name', + type: 'string', + typeInfo: { + frame: 'string', + nullable: true, + }, + }, + ], }, - "data": { - "values": [ - [ - 30, - 17 - ], - [ - "foo", - "bar" - ] - ] - } - } + data: { + values: [ + [30, 17], + ['foo', 'bar'], + ], + }, + }, }, - "backend xml query": { - "1": { - "schema": { - "name": "A", - "refId": "A", - "meta": { - "typeVersion": [ - 0, - 0 - ], - "custom": { - "data": " foo 30 bar 17 ", - "duration": 0, - "error": "", - "query": { - "alias": "", - "columns": [], - "computed_columns": [], - "csv_options": { - "columns": "", - "comment": "", - "delimiter": "", - "relax_column_count": false, - "skip_empty_lines": false, - "skip_lines_with_error": false + 'backend xml query': { + 1: { + schema: { + name: 'A', + refId: 'A', + meta: { + typeVersion: [0, 0], + custom: { + data: ' foo 30 bar 17 ', + duration: 0, + error: '', + query: { + alias: '', + columns: [], + computed_columns: [], + csv_options: { + columns: '', + comment: '', + delimiter: '', + relax_column_count: false, + skip_empty_lines: false, + skip_lines_with_error: false, }, - "data": " foo 30 bar 17 ", - "dataOverrides": null, - "expression": "", - "filterExpression": "", - "filters": null, - "format": "", - "global_query_id": "", - "groq": "", - "json_options": { - "columnar": false, - "root_is_not_array": false + data: ' foo 30 bar 17 ', + dataOverrides: null, + expression: '', + filterExpression: '', + filters: null, + format: '', + global_query_id: '', + groq: '', + json_options: { + columnar: false, + root_is_not_array: false, + }, + parser: 'backend', + query_mode: '', + refId: 'A', + root_selector: '', + seriesCount: 0, + source: 'inline', + sqlite_query: '', + summarizeBy: '', + summarizeExpression: '', + type: 'xml', + uql: '', + url: '', + url_options: { + body_content_type: '', + body_form: null, + body_graphql_query: '', + body_graphql_variables: '', + body_type: '', + data: '', + headers: null, + method: '', + params: null, }, - "parser": "backend", - "query_mode": "", - "refId": "A", - "root_selector": "", - "seriesCount": 0, - "source": "inline", - "sqlite_query": "", - "summarizeBy": "", - "summarizeExpression": "", - "type": "xml", - "uql": "", - "url": "", - "url_options": { - "body_content_type": "", - "body_form": null, - "body_graphql_query": "", - "body_graphql_variables": "", - "body_type": "", - "data": "", - "headers": null, - "method": "", - "params": null - } }, - "responseCodeFromServer": 0 + responseCodeFromServer: 0, }, - "executedQueryString": "This feature is not available for this type of query yet" + executedQueryString: 'This feature is not available for this type of query yet', }, - "fields": [ + fields: [ { - "name": "root", - "type": "string", - "typeInfo": { - "frame": "string", - "nullable": true - } - } - ] + name: 'root', + type: 'string', + typeInfo: { + frame: 'string', + nullable: true, + }, + }, + ], }, - "data": { - "values": [ - [ - "{\"row\":[{\"age\":\"30\",\"name\":\"foo\"},{\"age\":\"17\",\"name\":\"bar\"}]}" - ] - ] - } - } + data: { + values: [['{"row":[{"age":"30","name":"foo"},{"age":"17","name":"bar"}]}']], + }, + }, }, - "backend xml query with root selector and columns": { - "1": { - "schema": { - "name": "A", - "refId": "A", - "meta": { - "typeVersion": [ - 0, - 0 - ], - "custom": { - "data": " foo 30 bar 17 ", - "duration": 0, - "error": "", - "query": { - "alias": "", - "columns": [ + 'backend xml query with root selector and columns': { + 1: { + schema: { + name: 'A', + refId: 'A', + meta: { + typeVersion: [0, 0], + custom: { + data: ' foo 30 bar 17 ', + duration: 0, + error: '', + query: { + alias: '', + columns: [ { - "selector": "age", - "text": "Age", - "timestampFormat": "", - "type": "number" + selector: 'age', + text: 'Age', + timestampFormat: '', + type: 'number', }, { - "selector": "name", - "text": "Name", - "timestampFormat": "", - "type": "string" - } + selector: 'name', + text: 'Name', + timestampFormat: '', + type: 'string', + }, ], - "computed_columns": [], - "csv_options": { - "columns": "", - "comment": "", - "delimiter": "", - "relax_column_count": false, - "skip_empty_lines": false, - "skip_lines_with_error": false + computed_columns: [], + csv_options: { + columns: '', + comment: '', + delimiter: '', + relax_column_count: false, + skip_empty_lines: false, + skip_lines_with_error: false, }, - "data": " foo 30 bar 17 ", - "dataOverrides": null, - "expression": "", - "filterExpression": "", - "filters": null, - "format": "", - "global_query_id": "", - "groq": "", - "json_options": { - "columnar": false, - "root_is_not_array": false + data: ' foo 30 bar 17 ', + dataOverrides: null, + expression: '', + filterExpression: '', + filters: null, + format: '', + global_query_id: '', + groq: '', + json_options: { + columnar: false, + root_is_not_array: false, + }, + parser: 'backend', + query_mode: '', + refId: 'A', + root_selector: 'root.row', + seriesCount: 0, + source: 'inline', + sqlite_query: '', + summarizeBy: '', + summarizeExpression: '', + type: 'xml', + uql: '', + url: '', + url_options: { + body_content_type: '', + body_form: null, + body_graphql_query: '', + body_graphql_variables: '', + body_type: '', + data: '', + headers: null, + method: '', + params: null, }, - "parser": "backend", - "query_mode": "", - "refId": "A", - "root_selector": "root.row", - "seriesCount": 0, - "source": "inline", - "sqlite_query": "", - "summarizeBy": "", - "summarizeExpression": "", - "type": "xml", - "uql": "", - "url": "", - "url_options": { - "body_content_type": "", - "body_form": null, - "body_graphql_query": "", - "body_graphql_variables": "", - "body_type": "", - "data": "", - "headers": null, - "method": "", - "params": null - } }, - "responseCodeFromServer": 0 + responseCodeFromServer: 0, }, - "executedQueryString": "This feature is not available for this type of query yet" + executedQueryString: 'This feature is not available for this type of query yet', }, - "fields": [ + fields: [ { - "name": "Age", - "type": "number", - "typeInfo": { - "frame": "float64", - "nullable": true - } + name: 'Age', + type: 'number', + typeInfo: { + frame: 'float64', + nullable: true, + }, }, { - "name": "Name", - "type": "string", - "typeInfo": { - "frame": "string", - "nullable": true - } - } - ] + name: 'Name', + type: 'string', + typeInfo: { + frame: 'string', + nullable: true, + }, + }, + ], }, - "data": { - "values": [ - [ - 30, - 17 - ], - [ - "foo", - "bar" - ] - ] - } - } + data: { + values: [ + [30, 17], + ['foo', 'bar'], + ], + }, + }, }, - "backend html query": { - "1": { - "schema": { - "name": "A", - "refId": "A", - "meta": { - "typeVersion": [ - 0, - 0 - ], - "custom": { - "data": "
name age
foo 30
bar 17
", - "duration": 0, - "error": "", - "query": { - "alias": "", - "columns": [], - "computed_columns": [], - "csv_options": { - "columns": "", - "comment": "", - "delimiter": "", - "relax_column_count": false, - "skip_empty_lines": false, - "skip_lines_with_error": false + 'backend html query': { + 1: { + schema: { + name: 'A', + refId: 'A', + meta: { + typeVersion: [0, 0], + custom: { + data: '
name age
foo 30
bar 17
', + duration: 0, + error: '', + query: { + alias: '', + columns: [], + computed_columns: [], + csv_options: { + columns: '', + comment: '', + delimiter: '', + relax_column_count: false, + skip_empty_lines: false, + skip_lines_with_error: false, }, - "data": "
name age
foo 30
bar 17
", - "dataOverrides": null, - "expression": "", - "filterExpression": "", - "filters": null, - "format": "", - "global_query_id": "", - "groq": "", - "json_options": { - "columnar": false, - "root_is_not_array": false + data: '
name age
foo 30
bar 17
', + dataOverrides: null, + expression: '', + filterExpression: '', + filters: null, + format: '', + global_query_id: '', + groq: '', + json_options: { + columnar: false, + root_is_not_array: false, + }, + parser: 'backend', + query_mode: '', + refId: 'A', + root_selector: '', + seriesCount: 0, + source: 'inline', + sqlite_query: '', + summarizeBy: '', + summarizeExpression: '', + type: 'html', + uql: '', + url: '', + url_options: { + body_content_type: '', + body_form: null, + body_graphql_query: '', + body_graphql_variables: '', + body_type: '', + data: '', + headers: null, + method: '', + params: null, }, - "parser": "backend", - "query_mode": "", - "refId": "A", - "root_selector": "", - "seriesCount": 0, - "source": "inline", - "sqlite_query": "", - "summarizeBy": "", - "summarizeExpression": "", - "type": "html", - "uql": "", - "url": "", - "url_options": { - "body_content_type": "", - "body_form": null, - "body_graphql_query": "", - "body_graphql_variables": "", - "body_type": "", - "data": "", - "headers": null, - "method": "", - "params": null - } }, - "responseCodeFromServer": 0 + responseCodeFromServer: 0, }, - "executedQueryString": "This feature is not available for this type of query yet" + executedQueryString: 'This feature is not available for this type of query yet', }, - "fields": [ + fields: [ { - "name": "table", - "type": "string", - "typeInfo": { - "frame": "string", - "nullable": true - } - } - ] + name: 'table', + type: 'string', + typeInfo: { + frame: 'string', + nullable: true, + }, + }, + ], }, - "data": { - "values": [ + data: { + values: [ [ - "{\"-class\":\"table table-bordered table-hover table-condensed\",\"tbody\":{\"tr\":[{\"td\":[\"foo\",{\"#content\":\"30\",\"-align\":\"right\"}]},{\"td\":[\"bar\",{\"#content\":\"17\",\"-align\":\"right\"}]}]},\"thead\":{\"tr\":{\"th\":[{\"#content\":\"name\",\"-title\":\"Field #1\"},{\"#content\":\"age\",\"-title\":\"Field #2\"}]}}}" - ] - ] - } - } - }, - "backend html query with root selector and columns": { - "1": { - "schema": { - "name": "A", - "refId": "A", - "meta": { - "typeVersion": [ - 0, - 0 + '{"-class":"table table-bordered table-hover table-condensed","tbody":{"tr":[{"td":["foo",{"#content":"30","-align":"right"}]},{"td":["bar",{"#content":"17","-align":"right"}]}]},"thead":{"tr":{"th":[{"#content":"name","-title":"Field #1"},{"#content":"age","-title":"Field #2"}]}}}', ], - "custom": { - "data": "
name age
foo 30
bar 17
", - "duration": 0, - "error": "", - "query": { - "alias": "", - "columns": [ + ], + }, + }, + }, + 'backend html query with root selector and columns': { + 1: { + schema: { + name: 'A', + refId: 'A', + meta: { + typeVersion: [0, 0], + custom: { + data: '
name age
foo 30
bar 17
', + duration: 0, + error: '', + query: { + alias: '', + columns: [ { - "selector": "td.0", - "text": "Name", - "timestampFormat": "", - "type": "string" + selector: 'td.0', + text: 'Name', + timestampFormat: '', + type: 'string', }, { - "selector": "td.1.#content", - "text": "Age", - "timestampFormat": "", - "type": "number" - } + selector: 'td.1.#content', + text: 'Age', + timestampFormat: '', + type: 'number', + }, ], - "computed_columns": [], - "csv_options": { - "columns": "", - "comment": "", - "delimiter": "", - "relax_column_count": false, - "skip_empty_lines": false, - "skip_lines_with_error": false + computed_columns: [], + csv_options: { + columns: '', + comment: '', + delimiter: '', + relax_column_count: false, + skip_empty_lines: false, + skip_lines_with_error: false, }, - "data": "
name age
foo 30
bar 17
", - "dataOverrides": null, - "expression": "", - "filterExpression": "", - "filters": null, - "format": "", - "global_query_id": "", - "groq": "", - "json_options": { - "columnar": false, - "root_is_not_array": false + data: '
name age
foo 30
bar 17
', + dataOverrides: null, + expression: '', + filterExpression: '', + filters: null, + format: '', + global_query_id: '', + groq: '', + json_options: { + columnar: false, + root_is_not_array: false, + }, + parser: 'backend', + query_mode: '', + refId: 'A', + root_selector: 'table.tbody.tr', + seriesCount: 0, + source: 'inline', + sqlite_query: '', + summarizeBy: '', + summarizeExpression: '', + type: 'html', + uql: '', + url: '', + url_options: { + body_content_type: '', + body_form: null, + body_graphql_query: '', + body_graphql_variables: '', + body_type: '', + data: '', + headers: null, + method: '', + params: null, }, - "parser": "backend", - "query_mode": "", - "refId": "A", - "root_selector": "table.tbody.tr", - "seriesCount": 0, - "source": "inline", - "sqlite_query": "", - "summarizeBy": "", - "summarizeExpression": "", - "type": "html", - "uql": "", - "url": "", - "url_options": { - "body_content_type": "", - "body_form": null, - "body_graphql_query": "", - "body_graphql_variables": "", - "body_type": "", - "data": "", - "headers": null, - "method": "", - "params": null - } }, - "responseCodeFromServer": 0 + responseCodeFromServer: 0, }, - "executedQueryString": "This feature is not available for this type of query yet" + executedQueryString: 'This feature is not available for this type of query yet', }, - "fields": [ + fields: [ { - "name": "Age", - "type": "number", - "typeInfo": { - "frame": "float64", - "nullable": true - } + name: 'Age', + type: 'number', + typeInfo: { + frame: 'float64', + nullable: true, + }, }, { - "name": "Name", - "type": "string", - "typeInfo": { - "frame": "string", - "nullable": true - } - } - ] + name: 'Name', + type: 'string', + typeInfo: { + frame: 'string', + nullable: true, + }, + }, + ], }, - "data": { - "values": [ - [ - 30, - 17 - ], - [ - "foo", - "bar" - ] - ] - } - } - } + data: { + values: [ + [30, 17], + ['foo', 'bar'], + ], + }, + }, + }, }, - "test the uql response": { - "uql json query": { - "1": { - "schema": { - "name": "A", - "refId": "A", - "meta": { - "typeVersion": [ - 0, - 0 - ], - "custom": { - "data": "[{\"name\":\"foo\",\"age\":30},{\"name\":\"bar\",\"age\":17}]", - "duration": 0, - "error": "", - "query": { - "alias": "", - "columns": [], - "computed_columns": [], - "csv_options": { - "columns": "", - "comment": "", - "delimiter": "", - "relax_column_count": false, - "skip_empty_lines": false, - "skip_lines_with_error": false + 'test the uql response': { + 'uql json query': { + 1: { + schema: { + name: 'A', + refId: 'A', + meta: { + typeVersion: [0, 0], + custom: { + data: '[{"name":"foo","age":30},{"name":"bar","age":17}]', + duration: 0, + error: '', + query: { + alias: '', + columns: [], + computed_columns: [], + csv_options: { + columns: '', + comment: '', + delimiter: '', + relax_column_count: false, + skip_empty_lines: false, + skip_lines_with_error: false, + }, + data: '[{"name":"foo","age":30},{"name":"bar","age":17}]', + dataOverrides: null, + expression: '', + filterExpression: '', + filters: null, + format: '', + global_query_id: '', + groq: '', + json_options: { + columnar: false, + root_is_not_array: false, }, - "data": "[{\"name\":\"foo\",\"age\":30},{\"name\":\"bar\",\"age\":17}]", - "dataOverrides": null, - "expression": "", - "filterExpression": "", - "filters": null, - "format": "", - "global_query_id": "", - "groq": "", - "json_options": { - "columnar": false, - "root_is_not_array": false + parser: 'uql', + query_mode: '', + refId: 'A', + root_selector: '', + seriesCount: 0, + source: 'inline', + sqlite_query: '', + summarizeBy: '', + summarizeExpression: '', + type: 'json', + uql: 'parse-json', + url: '', + url_options: { + body_content_type: '', + body_form: null, + body_graphql_query: '', + body_graphql_variables: '', + body_type: '', + data: '', + headers: null, + method: '', + params: null, }, - "parser": "uql", - "query_mode": "", - "refId": "A", - "root_selector": "", - "seriesCount": 0, - "source": "inline", - "sqlite_query": "", - "summarizeBy": "", - "summarizeExpression": "", - "type": "json", - "uql": "parse-json", - "url": "", - "url_options": { - "body_content_type": "", - "body_form": null, - "body_graphql_query": "", - "body_graphql_variables": "", - "body_type": "", - "data": "", - "headers": null, - "method": "", - "params": null - } }, - "responseCodeFromServer": 0 + responseCodeFromServer: 0, }, - "executedQueryString": "This feature is not available for this type of query yet" + executedQueryString: 'This feature is not available for this type of query yet', }, - "fields": [] + fields: [], }, - "data": { - "values": [] - } - } + data: { + values: [], + }, + }, }, - "uql csv query": { - "1": { - "schema": { - "name": "A", - "refId": "A", - "meta": { - "typeVersion": [ - 0, - 0 - ], - "custom": { - "data": "name,age\nfoo,30\nbar,17", - "duration": 0, - "error": "", - "query": { - "alias": "", - "columns": [], - "computed_columns": [], - "csv_options": { - "columns": "", - "comment": "", - "delimiter": "", - "relax_column_count": false, - "skip_empty_lines": false, - "skip_lines_with_error": false + 'uql csv query': { + 1: { + schema: { + name: 'A', + refId: 'A', + meta: { + typeVersion: [0, 0], + custom: { + data: 'name,age\nfoo,30\nbar,17', + duration: 0, + error: '', + query: { + alias: '', + columns: [], + computed_columns: [], + csv_options: { + columns: '', + comment: '', + delimiter: '', + relax_column_count: false, + skip_empty_lines: false, + skip_lines_with_error: false, + }, + data: 'name,age\nfoo,30\nbar,17', + dataOverrides: null, + expression: '', + filterExpression: '', + filters: null, + format: '', + global_query_id: '', + groq: '', + json_options: { + columnar: false, + root_is_not_array: false, }, - "data": "name,age\nfoo,30\nbar,17", - "dataOverrides": null, - "expression": "", - "filterExpression": "", - "filters": null, - "format": "", - "global_query_id": "", - "groq": "", - "json_options": { - "columnar": false, - "root_is_not_array": false + parser: 'uql', + query_mode: '', + refId: 'A', + root_selector: '', + seriesCount: 0, + source: 'inline', + sqlite_query: '', + summarizeBy: '', + summarizeExpression: '', + type: 'csv', + uql: 'parse-csv', + url: '', + url_options: { + body_content_type: '', + body_form: null, + body_graphql_query: '', + body_graphql_variables: '', + body_type: '', + data: '', + headers: null, + method: '', + params: null, }, - "parser": "uql", - "query_mode": "", - "refId": "A", - "root_selector": "", - "seriesCount": 0, - "source": "inline", - "sqlite_query": "", - "summarizeBy": "", - "summarizeExpression": "", - "type": "csv", - "uql": "parse-csv", - "url": "", - "url_options": { - "body_content_type": "", - "body_form": null, - "body_graphql_query": "", - "body_graphql_variables": "", - "body_type": "", - "data": "", - "headers": null, - "method": "", - "params": null - } }, - "responseCodeFromServer": 0 + responseCodeFromServer: 0, }, - "executedQueryString": "This feature is not available for this type of query yet" + executedQueryString: 'This feature is not available for this type of query yet', }, - "fields": [] + fields: [], }, - "data": { - "values": [] - } - } + data: { + values: [], + }, + }, }, - "uql tsv query": { - "1": { - "schema": { - "name": "A", - "refId": "A", - "meta": { - "typeVersion": [ - 0, - 0 - ], - "custom": { - "data": "name age\nfoo 30\nbar 17", - "duration": 0, - "error": "", - "query": { - "alias": "", - "columns": [], - "computed_columns": [], - "csv_options": { - "columns": "", - "comment": "", - "delimiter": "", - "relax_column_count": false, - "skip_empty_lines": false, - "skip_lines_with_error": false + 'uql tsv query': { + 1: { + schema: { + name: 'A', + refId: 'A', + meta: { + typeVersion: [0, 0], + custom: { + data: 'name age\nfoo 30\nbar 17', + duration: 0, + error: '', + query: { + alias: '', + columns: [], + computed_columns: [], + csv_options: { + columns: '', + comment: '', + delimiter: '', + relax_column_count: false, + skip_empty_lines: false, + skip_lines_with_error: false, }, - "data": "name age\nfoo 30\nbar 17", - "dataOverrides": null, - "expression": "", - "filterExpression": "", - "filters": null, - "format": "", - "global_query_id": "", - "groq": "", - "json_options": { - "columnar": false, - "root_is_not_array": false + data: 'name age\nfoo 30\nbar 17', + dataOverrides: null, + expression: '', + filterExpression: '', + filters: null, + format: '', + global_query_id: '', + groq: '', + json_options: { + columnar: false, + root_is_not_array: false, + }, + parser: 'uql', + query_mode: '', + refId: 'A', + root_selector: '', + seriesCount: 0, + source: 'inline', + sqlite_query: '', + summarizeBy: '', + summarizeExpression: '', + type: 'tsv', + uql: 'parse-csv --delimiter "\\t"', + url: '', + url_options: { + body_content_type: '', + body_form: null, + body_graphql_query: '', + body_graphql_variables: '', + body_type: '', + data: '', + headers: null, + method: '', + params: null, }, - "parser": "uql", - "query_mode": "", - "refId": "A", - "root_selector": "", - "seriesCount": 0, - "source": "inline", - "sqlite_query": "", - "summarizeBy": "", - "summarizeExpression": "", - "type": "tsv", - "uql": "parse-csv --delimiter \"\\t\"", - "url": "", - "url_options": { - "body_content_type": "", - "body_form": null, - "body_graphql_query": "", - "body_graphql_variables": "", - "body_type": "", - "data": "", - "headers": null, - "method": "", - "params": null - } }, - "responseCodeFromServer": 0 + responseCodeFromServer: 0, }, - "executedQueryString": "This feature is not available for this type of query yet" + executedQueryString: 'This feature is not available for this type of query yet', }, - "fields": [] + fields: [], + }, + data: { + values: [], }, - "data": { - "values": [] - } - } + }, }, - "uql graphql query": { - "1": { - "schema": { - "name": "A", - "refId": "A", - "meta": { - "typeVersion": [ - 0, - 0 - ], - "custom": { - "data": "[{\"name\":\"foo\",\"age\":30},{\"name\":\"bar\",\"age\":17}]", - "duration": 0, - "error": "", - "query": { - "alias": "", - "columns": [], - "computed_columns": [], - "csv_options": { - "columns": "", - "comment": "", - "delimiter": "", - "relax_column_count": false, - "skip_empty_lines": false, - "skip_lines_with_error": false + 'uql graphql query': { + 1: { + schema: { + name: 'A', + refId: 'A', + meta: { + typeVersion: [0, 0], + custom: { + data: '[{"name":"foo","age":30},{"name":"bar","age":17}]', + duration: 0, + error: '', + query: { + alias: '', + columns: [], + computed_columns: [], + csv_options: { + columns: '', + comment: '', + delimiter: '', + relax_column_count: false, + skip_empty_lines: false, + skip_lines_with_error: false, }, - "data": "[{\"name\":\"foo\",\"age\":30},{\"name\":\"bar\",\"age\":17}]", - "dataOverrides": null, - "expression": "", - "filterExpression": "", - "filters": null, - "format": "", - "global_query_id": "", - "groq": "", - "json_options": { - "columnar": false, - "root_is_not_array": false + data: '[{"name":"foo","age":30},{"name":"bar","age":17}]', + dataOverrides: null, + expression: '', + filterExpression: '', + filters: null, + format: '', + global_query_id: '', + groq: '', + json_options: { + columnar: false, + root_is_not_array: false, + }, + parser: 'uql', + query_mode: '', + refId: 'A', + root_selector: '', + seriesCount: 0, + source: 'inline', + sqlite_query: '', + summarizeBy: '', + summarizeExpression: '', + type: 'graphql', + uql: 'parse-json', + url: '', + url_options: { + body_content_type: '', + body_form: null, + body_graphql_query: '', + body_graphql_variables: '', + body_type: '', + data: '', + headers: null, + method: '', + params: null, }, - "parser": "uql", - "query_mode": "", - "refId": "A", - "root_selector": "", - "seriesCount": 0, - "source": "inline", - "sqlite_query": "", - "summarizeBy": "", - "summarizeExpression": "", - "type": "graphql", - "uql": "parse-json", - "url": "", - "url_options": { - "body_content_type": "", - "body_form": null, - "body_graphql_query": "", - "body_graphql_variables": "", - "body_type": "", - "data": "", - "headers": null, - "method": "", - "params": null - } }, - "responseCodeFromServer": 0 + responseCodeFromServer: 0, }, - "executedQueryString": "This feature is not available for this type of query yet" + executedQueryString: 'This feature is not available for this type of query yet', }, - "fields": [] + fields: [], + }, + data: { + values: [], }, - "data": { - "values": [] - } - } + }, }, - "uql xml query": { - "1": { - "schema": { - "name": "A", - "refId": "A", - "meta": { - "typeVersion": [ - 0, - 0 - ], - "custom": { - "data": " foo 30 bar 17 ", - "duration": 0, - "error": "", - "query": { - "alias": "", - "columns": [], - "computed_columns": [], - "csv_options": { - "columns": "", - "comment": "", - "delimiter": "", - "relax_column_count": false, - "skip_empty_lines": false, - "skip_lines_with_error": false + 'uql xml query': { + 1: { + schema: { + name: 'A', + refId: 'A', + meta: { + typeVersion: [0, 0], + custom: { + data: ' foo 30 bar 17 ', + duration: 0, + error: '', + query: { + alias: '', + columns: [], + computed_columns: [], + csv_options: { + columns: '', + comment: '', + delimiter: '', + relax_column_count: false, + skip_empty_lines: false, + skip_lines_with_error: false, + }, + data: ' foo 30 bar 17 ', + dataOverrides: null, + expression: '', + filterExpression: '', + filters: null, + format: '', + global_query_id: '', + groq: '', + json_options: { + columnar: false, + root_is_not_array: false, }, - "data": " foo 30 bar 17 ", - "dataOverrides": null, - "expression": "", - "filterExpression": "", - "filters": null, - "format": "", - "global_query_id": "", - "groq": "", - "json_options": { - "columnar": false, - "root_is_not_array": false + parser: 'uql', + query_mode: '', + refId: 'A', + root_selector: '', + seriesCount: 0, + source: 'inline', + sqlite_query: '', + summarizeBy: '', + summarizeExpression: '', + type: 'xml', + uql: 'parse-json', + url: '', + url_options: { + body_content_type: '', + body_form: null, + body_graphql_query: '', + body_graphql_variables: '', + body_type: '', + data: '', + headers: null, + method: '', + params: null, }, - "parser": "uql", - "query_mode": "", - "refId": "A", - "root_selector": "", - "seriesCount": 0, - "source": "inline", - "sqlite_query": "", - "summarizeBy": "", - "summarizeExpression": "", - "type": "xml", - "uql": "parse-json", - "url": "", - "url_options": { - "body_content_type": "", - "body_form": null, - "body_graphql_query": "", - "body_graphql_variables": "", - "body_type": "", - "data": "", - "headers": null, - "method": "", - "params": null - } }, - "responseCodeFromServer": 0 + responseCodeFromServer: 0, }, - "executedQueryString": "This feature is not available for this type of query yet" + executedQueryString: 'This feature is not available for this type of query yet', }, - "fields": [] + fields: [], + }, + data: { + values: [], }, - "data": { - "values": [] - } - } - } - } -} + }, + }, + }, +}; diff --git a/src/app/InfinityProvider.ts b/src/app/InfinityProvider.ts index dea786cc4..4d1c571a8 100644 --- a/src/app/InfinityProvider.ts +++ b/src/app/InfinityProvider.ts @@ -4,7 +4,10 @@ import { CSVParser, HTMLParser, JSONParser, XMLParser } from './parsers'; import type { InfinityDataQuery } from './../types'; export class InfinityProvider { - constructor(private target: InfinityDataQuery, private datasource: Datasource) {} + constructor( + private target: InfinityDataQuery, + private datasource: Datasource + ) {} async formatResults(res: any) { const query = this.target; query.root_selector = getTemplateSrv().replace(query.root_selector); diff --git a/src/datasource.spec.ts b/src/datasource.spec.ts index 926685ea9..a7661aa88 100644 --- a/src/datasource.spec.ts +++ b/src/datasource.spec.ts @@ -74,7 +74,7 @@ describe('metricFindQuery', () => { }); describe('testDatasource', () => { - beforeEach(() => jest.spyOn(DataSourceWithBackend.prototype, 'testDatasource').mockResolvedValue({ message: 'OK' })); + beforeEach(() => jest.spyOn(DataSourceWithBackend.prototype, 'testDatasource').mockResolvedValue({ message: 'OK', status: 'success' })); it('should pass with the default settings', async () => { const ds = new Datasource({ ...DummyDatasource }); const result = await ds.testDatasource(); diff --git a/src/editors/config.editor.tsx b/src/editors/config.editor.tsx index 9342bcaa6..d28ad3e7f 100644 --- a/src/editors/config.editor.tsx +++ b/src/editors/config.editor.tsx @@ -81,7 +81,7 @@ export const HeadersEditor = (props: DataSourcePluginOptionsEditorProps - + ); diff --git a/src/editors/config/Auth.tsx b/src/editors/config/Auth.tsx index 35057cd7d..d0bdd9fbe 100644 --- a/src/editors/config/Auth.tsx +++ b/src/editors/config/Auth.tsx @@ -31,10 +31,10 @@ export const AuthEditor = (props: DataSourcePluginOptionsEditorProps { )} - {config.featureToggles['secureSocksDSProxyEnabled' as keyof FeatureToggles] && - gte(config.buildInfo.version, '10.0.0') && ( - <> - - Enable proxying the datasource connection through the secure socks proxy to a - different network. - See{' '} - - Configure a datasource connection proxy. - - - } - > -
- { - onOptionsChange({ - ...options, - jsonData: { - ...options.jsonData, - enableSecureSocksProxy: e.currentTarget.checked - }, - }); - }} - /> -
-
- - )} + {config.featureToggles['secureSocksDSProxyEnabled' as keyof FeatureToggles] && gte(config.buildInfo.version, '10.0.0') && ( + <> + + Enable proxying the datasource connection through the secure socks proxy to a different network. See{' '} + + Configure a datasource connection proxy. + + + } + > +
+ { + onOptionsChange({ + ...options, + jsonData: { + ...options.jsonData, + enableSecureSocksProxy: e.currentTarget.checked, + }, + }); + }} + /> +
+
+ + )} ); }; diff --git a/src/editors/config/QueryParamEditor.tsx b/src/editors/config/QueryParamEditor.tsx index 3eb44f80f..6a5813df9 100644 --- a/src/editors/config/QueryParamEditor.tsx +++ b/src/editors/config/QueryParamEditor.tsx @@ -10,10 +10,7 @@ export const QueryParamEditor = (props: DataSourcePluginOptionsEditorProps
Encode query parameters with %20 - onOptionsChange({ ...options, jsonData: { ...jsonData, pathEncodedUrlsEnabled: e.currentTarget.checked } })} - /> + onOptionsChange({ ...options, jsonData: { ...jsonData, pathEncodedUrlsEnabled: e.currentTarget.checked } })} />
); diff --git a/src/editors/query/query.columns.editor.tsx b/src/editors/query/query.columns.editor.tsx index 9088d6f0c..bf312eb16 100644 --- a/src/editors/query/query.columns.editor.tsx +++ b/src/editors/query/query.columns.editor.tsx @@ -34,8 +34,8 @@ export const QueryColumnsEditor = (props: { query: InfinityQuery; onChange: (val (query.type === 'json' || query.type === 'graphql' || query.type === 'csv' || query.type === 'tsv' || query.type === 'xml') && query.parser === 'uql' ? 'UQL' : (query.type === 'json' || query.type === 'graphql' || query.type === 'csv' || query.type === 'tsv') && query.parser === 'groq' - ? 'GROQ' - : 'Parsing options & Result fields' + ? 'GROQ' + : 'Parsing options & Result fields' } collapsible={true} collapsed={false} diff --git a/src/editors/query/query.url.tsx b/src/editors/query/query.url.tsx index 71d77876e..d93c4a384 100644 --- a/src/editors/query/query.url.tsx +++ b/src/editors/query/query.url.tsx @@ -254,14 +254,14 @@ const Body = ({ query, onChange, onRunQuery }: { query: InfinityQuery; onChange: query.url_options?.body_content_type === 'application/json' ? 'json' : query.url_options?.body_content_type === 'application/xml' - ? 'xml' - : query.url_options?.body_content_type === 'text/html' - ? 'html' - : query.url_options?.body_content_type === 'application/javascript' - ? 'javascript' - : query.url_options?.body_content_type === 'text/plain' - ? 'text' - : 'text' + ? 'xml' + : query.url_options?.body_content_type === 'text/html' + ? 'html' + : query.url_options?.body_content_type === 'application/javascript' + ? 'javascript' + : query.url_options?.body_content_type === 'text/plain' + ? 'text' + : 'text' } height={'200px'} value={query.url_options?.data || ''} diff --git a/src/utils/analytics.ts b/src/utils/analytics.ts index d4c891361..577e58d16 100644 --- a/src/utils/analytics.ts +++ b/src/utils/analytics.ts @@ -1,5 +1,5 @@ -import { CoreApp, DataSourcePluginMeta } from '@grafana/data'; -import { reportInteraction, config, HealthCheckResult } from '@grafana/runtime'; +import { CoreApp, DataSourcePluginMeta, TestDataSourceResponse } from '@grafana/data'; +import { reportInteraction, config } from '@grafana/runtime'; import { isBackendQuery } from './../app/utils'; import { InfinityInstanceSettings, InfinityQuery } from './../types'; @@ -31,7 +31,7 @@ const reportActivity = (action: Report_Action, data: Record = {}, i } }; -export const reportHealthCheck = (o?: Omit, instance_settings?: InfinityInstanceSettings, plugin_meta?: DataSourcePluginMeta) => { +export const reportHealthCheck = (o?: Omit, instance_settings?: InfinityInstanceSettings, plugin_meta?: DataSourcePluginMeta) => { let meta: Record = { plugin_healthcheck_status: o?.status || 'unknown', plugin_healthcheck_message: o?.message || 'unknown', diff --git a/webpack.config.ts b/webpack.config.ts index f1384eef2..4db0d473b 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -5,10 +5,10 @@ import grafanaConfig from './.config/webpack/webpack.config'; const config = async (env: any): Promise => { const baseConfig = await grafanaConfig(env); const customConfig = { - plugins:[ + plugins: [ new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'], - }), + }), ], module: { rules: [