mirror of
https://github.com/grafana/grafana.git
synced 2026-09-05 04:40:13 -05:00
Glue: Validate target query in correlations page (#57245)
* feat: add draft version of validate button
* feat: add some styling and basics
* temp: intermediate result
* refactor: solve TODOs
* refactor: replace string in state
* refactor: replace error message style
* refactor: set validate state on change in ds
* refactor: add QueryRunner
* refactor: add QueryRunner
* temp: temporary status
* Emit PanelData to check if the query is valid
* refactor: clean up
* refactor: improve a11y of error message and adjust test
* Remove deprecated property call, change equality
* refactor: add changes from code review
* refactor: remove memory leak
* refactor: replace query runner
* refactor: adjust error handling
* refactor: move testing to related unit test
* refactor: clean up test for QueryEditorField
* refactor: clean up test for CorrelationsPage
* refactor: repair test
* refactor: clean up
* refactor: add refId in order avoid errors when running Loki queries
* refactor: replace buildQueryTransaction + set query to invalid if query is empty
* refactor: add empty query value to test cases
* refactor: end handleValidation after setIsValidQuery()
* refactor: refactor test
* refactor: fix last two tests
* refactor: modify validation
* refactor: add happy path
* refactor: clean up
* refactor: clean up tests (not final)
* refactor: further clean up
* refactor: add condition for failing
* refactor: finish clean up
* refactor: changes from code review
* refactor: add response state to condition
Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
* refactor: fix prettier issue
* refactor: remove unused return
* refactor: replace change in queryAnalytics.ts
* refactor: remove correlations from query analytics
* refactor: remove unnecessary test preparation
* refactor: revert changes from commit 4997327
Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
Co-authored-by: Kristina Durivage <kristina.durivage@grafana.com>
This commit is contained in:
co-authored by
Piotr Jamróz
Kristina Durivage
parent
321acca59f
commit
9400ccf478
@@ -138,11 +138,10 @@ describe('emitDataRequestEvent - from a dashboard panel', () => {
|
||||
datasourceName: datasource.name,
|
||||
datasourceId: datasource.id,
|
||||
datasourceUid: datasource.uid,
|
||||
datasourceType: datasource.type,
|
||||
source: 'dashboard',
|
||||
panelId: 2,
|
||||
dashboardId: 1,
|
||||
dashboardName: 'Test Dashboard',
|
||||
dashboardUid: 'test',
|
||||
folderName: 'Test Folder',
|
||||
dataSize: 0,
|
||||
duration: 1,
|
||||
totalQueries: 0,
|
||||
@@ -162,11 +161,10 @@ describe('emitDataRequestEvent - from a dashboard panel', () => {
|
||||
datasourceName: datasource.name,
|
||||
datasourceId: datasource.id,
|
||||
datasourceUid: datasource.uid,
|
||||
datasourceType: datasource.type,
|
||||
source: 'dashboard',
|
||||
panelId: 2,
|
||||
dashboardId: 1,
|
||||
dashboardName: 'Test Dashboard',
|
||||
dashboardUid: 'test',
|
||||
folderName: 'Test Folder',
|
||||
dataSize: 2,
|
||||
duration: 1,
|
||||
totalQueries: 2,
|
||||
@@ -186,11 +184,10 @@ describe('emitDataRequestEvent - from a dashboard panel', () => {
|
||||
datasourceName: datasource.name,
|
||||
datasourceId: datasource.id,
|
||||
datasourceUid: datasource.uid,
|
||||
datasourceType: datasource.type,
|
||||
source: 'dashboard',
|
||||
panelId: 2,
|
||||
dashboardId: 1,
|
||||
dashboardName: 'Test Dashboard',
|
||||
dashboardUid: 'test',
|
||||
folderName: 'Test Folder',
|
||||
dataSize: 2,
|
||||
duration: 1,
|
||||
totalQueries: 1,
|
||||
|
||||
@@ -31,8 +31,8 @@ export function emitDataRequestEvent(datasource: DataSourceApi) {
|
||||
duration: data.request.endTime! - data.request.startTime,
|
||||
};
|
||||
|
||||
if (data.request.app === CoreApp.Explore) {
|
||||
enrichWithExploreInfo(eventData, data);
|
||||
if (data.request.app === CoreApp.Explore || data.request.app === CoreApp.Correlations) {
|
||||
enrichWithInfo(eventData, data);
|
||||
} else {
|
||||
enrichWithDashboardInfo(eventData, data);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ export function emitDataRequestEvent(datasource: DataSourceApi) {
|
||||
done = true;
|
||||
};
|
||||
|
||||
function enrichWithExploreInfo(eventData: DataRequestEventPayload, data: PanelData) {
|
||||
function enrichWithInfo(eventData: DataRequestEventPayload, data: PanelData) {
|
||||
const totalQueries = Object.keys(data.series).length;
|
||||
eventData.totalQueries = totalQueries;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user