-
Notifications
You must be signed in to change notification settings - Fork 11.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Datasources: Propagate TestDataDB default selection to PanelModel #57703
Closed
Closed
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8280a70
send selection changed event to panel after query editor renders
mmandrus c21c04a
Merge branch 'main' into mmandrus/fix-testdatadb-default-selection
mmandrus 97f5615
do some things to fix e2e tests
mmandrus ef48f58
update e2e test to look for most recent 3 elements only
mmandrus 0ae3fc6
Merge branch 'main' into mmandrus/fix-testdatadb-default-selection
mmandrus b161aad
revert changes
mmandrus 031efb9
Revert "send selection changed event to panel after query editor rend…
mmandrus 0fffb65
use default query to try to make sure panel targets are well-formed
mmandrus 3120d24
add console warn if query is not well-formed
mmandrus beba157
another try - ensure default query without modifying the dashboard mo…
mmandrus File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,6 +4,7 @@ import { delay } from 'rxjs/operators'; | |||||||||||||||||||||||||||||||||||
import { | ||||||||||||||||||||||||||||||||||||
AnnotationEvent, | ||||||||||||||||||||||||||||||||||||
ArrayDataFrame, | ||||||||||||||||||||||||||||||||||||
CoreApp, | ||||||||||||||||||||||||||||||||||||
DataFrame, | ||||||||||||||||||||||||||||||||||||
DataQueryRequest, | ||||||||||||||||||||||||||||||||||||
DataQueryResponse, | ||||||||||||||||||||||||||||||||||||
|
@@ -18,6 +19,7 @@ import { | |||||||||||||||||||||||||||||||||||
import { DataSourceWithBackend, getBackendSrv, getGrafanaLiveSrv, getTemplateSrv, TemplateSrv } from '@grafana/runtime'; | ||||||||||||||||||||||||||||||||||||
import { getSearchFilterScopedVar } from 'app/features/variables/utils'; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
import { defaultQuery } from './constants'; | ||||||||||||||||||||||||||||||||||||
import { queryMetricTree } from './metricTree'; | ||||||||||||||||||||||||||||||||||||
import { generateRandomNodes, savedNodesResponse } from './nodeGraphUtils'; | ||||||||||||||||||||||||||||||||||||
import { runStream } from './runStreams'; | ||||||||||||||||||||||||||||||||||||
|
@@ -258,6 +260,21 @@ export class TestDataDataSource extends DataSourceWithBackend<TestDataQuery> { | |||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
return null; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
getDefaultQuery(app: CoreApp): TestDataQuery { | ||||||||||||||||||||||||||||||||||||
switch (app) { | ||||||||||||||||||||||||||||||||||||
// Ignore the app input for now, always use the same default query | ||||||||||||||||||||||||||||||||||||
case CoreApp.CloudAlerting: | ||||||||||||||||||||||||||||||||||||
case CoreApp.UnifiedAlerting: | ||||||||||||||||||||||||||||||||||||
case CoreApp.Dashboard: | ||||||||||||||||||||||||||||||||||||
case CoreApp.Explore: | ||||||||||||||||||||||||||||||||||||
case CoreApp.PanelEditor: | ||||||||||||||||||||||||||||||||||||
case CoreApp.PanelViewer: | ||||||||||||||||||||||||||||||||||||
case CoreApp.Unknown: | ||||||||||||||||||||||||||||||||||||
default: | ||||||||||||||||||||||||||||||||||||
return defaultQuery; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
Comment on lines
+264
to
+277
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
function runGrafanaAPI(target: TestDataQuery, req: DataQueryRequest<TestDataQuery>): Observable<DataQueryResponse> { | ||||||||||||||||||||||||||||||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is based on the combination of the above if statement, plus the
ensureQueryIds()
function. If the only two properties on the query are the ones we are hard-coding in, the query is not well-formed. If there is a better way of inferring this, let me know.