-
Notifications
You must be signed in to change notification settings - Fork 13.1k
P2P Filter: Add adhoc filter option toggle #110160
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
Conversation
|
Seems to work as expected! Here's dashboard JSON to make it easier to check
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 5,
"links": [],
"panels": [
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "bel243skzm3uoa"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "12.2.0-pre",
"targets": [
{
"csvContent": "user_id,name,email,signup_date,age,gender\n1,Alice,alice@email.com,2025-01-15,28,F\n2,Bob,bob@email.com,2025-02-20,35,M\n3,Charlie,charlie@email.com,2025-03-05,42,M\n4,Diana,diana@email.com,2025-04-12,30,F\n5,Eve,eve@email.com,2025-05-01,25,F\n6,Frank,frank@email.com,2025-05-15,33,M\n7,Grace,grace@email.com,2025-06-01,27,F\n8,Henry,henry@email.com,2025-06-10,39,M\n9,Ivy,ivy@email.com,2025-06-20,31,F\n10,Jack,jack@email.com,2025-07-01,26,M\n11,Kate,kate@email.com,2025-07-15,29,F\n12,Leo,leo@email.com,2025-07-30,37,M",
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "bel243skzm3uoa"
},
"refId": "A",
"scenarioId": "csv_content"
}
],
"title": "Source panel",
"type": "table"
},
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 7
},
"id": 2,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "12.2.0-pre",
"targets": [
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"panelId": 1,
"refId": "A",
"useAdHocFilters": true
}
],
"title": "Should filter panel",
"type": "table"
},
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 7
},
"id": 3,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "12.2.0-pre",
"targets": [
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"panelId": 1,
"refId": "A",
"useAdHocFilters": true
}
],
"title": "Should filter panel",
"type": "table"
},
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 15
},
"id": 4,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "12.2.0-pre",
"targets": [
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"panelId": 1,
"refId": "A",
"useAdHocFilters": true
}
],
"title": "Should not filter panel",
"type": "table"
}
],
"preload": false,
"schemaVersion": 41,
"tags": [],
"templating": {
"list": [
{
"baseFilters": [],
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"filters": [
{
"key": "name",
"nonApplicable": false,
"operator": "!=",
"value": "Bob"
},
{
"key": "name",
"operator": "!=",
"value": "Alice"
}
],
"name": "query0",
"type": "adhoc"
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "browser",
"title": "New dashboard",
"uid": "8e07dedb-13c5-45b7-a0e9-77bfb54ca292",
"version": 6
}
|
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.
The test dashboard provided in the issue PR description includes two panels with no obvious differentiation and one panel that is labeled to not be filtered, but the toggle is on, and it is filtered. Please double check testing dashboards to be sure they are straightforward and accurate to facilitate easier testing. Additionally, if your PR requires a feature flag to work, please include that information in the description. I edited your description to include it for future reference.
Other than that, the code looks good and functions well!
public/app/plugins/datasource/dashboard/DashboardQueryEditor.tsx
Outdated
Show resolved
Hide resolved
public/app/plugins/datasource/dashboard/DashboardQueryEditor.tsx
Outdated
Show resolved
Hide resolved
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.
|
@Develer Let me know if anything material changes after you resolve the |

What is this feature?
This PR adds a toggle that allows the user to enable/disable adhoc filters for that specific Dashboards DS. If the toggle is disabled, Dashbboard DS ad hoc filters in the dashboard should have no effect on the panel.
Which issue(s) does this PR fix?:
Fixes #109902
Special notes for your reviewer:
You need to enable the
dashboardDsAdHocFilteringfeature flag in order to test this.Here is a dashboard for testing:
adhoc toggle test-1756220242419.json
Please check that: