Skip to content
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

Add customizable adhoc SQL query for select adhoc values #655

Merged
merged 29 commits into from
Nov 22, 2024
Merged

Conversation

lunaticusgreen
Copy link
Collaborator

fix #330 , can be merged after #654

@Slach
Copy link
Collaborator

Slach commented Nov 4, 2024

This is just not works
I tried to open any exists data source and got following error

Details
TypeError: Cannot read properties of undefined (reading 'split')
    at ConfigEditor (webpack-internal:///./views/ConfigEditor/ConfigEditor.tsx:79:13)
    at div
    at Et (http://localhost:3000/public/build/Connections.e0eda96e0598ac758584.js:48:2644)

@alon-cheq
Copy link

Hi 654 was merged, any update on this fix?

@Slach Slach added this to the 3.3.0 milestone Nov 6, 2024
@Slach
Copy link
Collaborator

Slach commented Nov 11, 2024

When open or create new Datasource i expected SQL query in adhoc field
image

@Slach
Copy link
Collaborator

Slach commented Nov 11, 2024

image

@Slach
Copy link
Collaborator

Slach commented Nov 11, 2024

Details
Error: Minified React error #310; visit https://reactjs.org/docs/error-decoder.html?invariant=310 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

    at QueryEditor (webpack-internal:///./views/QueryEditor/QueryEditor.tsx:81:13)

but QueryEditor.tsx contains only 77 lines, this is really weird

https://github.com/Altinity/clickhouse-grafana/blob/issue-330/src/views/QueryEditor/QueryEditor.tsx#L77

i run

npm run dev
npm run server

@Slach
Copy link
Collaborator

Slach commented Nov 11, 2024

@antip00 instead of create tests for already tested macros, better will create test which cover works with adhoc macros and cover new functionality

@Slach Slach changed the title Add customizable adhoc values request Add customizable adhoc SQL query for select adhoc values Nov 13, 2024
@Slach
Copy link
Collaborator

Slach commented Nov 13, 2024

@@ -413,7 +416,7 @@ export
createQuery(options: any, target: any) {
const queryModel = new SqlQuery(target, this.templateSrv, options);
// @ts-ignore
const adhocFilters = this.templateSrv?.getAdhocFilters(this.adHocFilter?.datasource?.name || 'clickhouse') || []
const adhocFilters = getAdhocFilters(this.adHocFilter?.datasource?.name || 'clickhouse',this.uid )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong fix
we don't have default data source name
remove clickhouse here

@Slach
Copy link
Collaborator

Slach commented Nov 20, 2024

@lunaticusgreen e2e test failed

just add new dashboard -> add new visualization (default clickhouse-direct datasource)

got following error

An unexpected error happened
Details
TypeError: Cannot read properties of undefined (reading 'uid')

    at QueryEditor (webpack-internal:///./views/QueryEditor/QueryEditor.tsx:82:13)

image

@antip00
Copy link
Collaborator

antip00 commented Nov 22, 2024

If you change adhoc variable in panel, it do not changes in reformatted query
Screencast from 2024-11-22 15-46-12.webm

@lunaticusgreen
Copy link
Collaborator Author

@antip00 Hey, I think it's a bug with scenes, I've created bugreport, let's wait for grafanas response

@lunaticusgreen
Copy link
Collaborator Author

We probably will disable scenes for some time

@Slach
Copy link
Collaborator

Slach commented Nov 22, 2024

@lunaticusgreen
it tried GF_FEATURE_TOGGLES_PUBLICDASHBOARDSSCENE: false in environment
and it reproduced
CLICKHOUSE_PLUGIN_VERSION=3.2.3 docker compose up -d grafana_external_install

http://localhost:3001/d/Bnh59Trnk/24-adhoc-2b-24-variable3a-text-formatting?editPanel=2

all works fine changing in adhoc control changed in Generated SQL
image

looks like we broke it in 2.3.4
CLICKHOUSE_PLUGIN_VERSION=3.2.4 docker compose up -d grafana_external_install

the same URL
http://localhost:3001/d/Bnh59Trnk/24-adhoc-2b-24-variable3a-text-formatting?editPanel=2

image

issue-330 branch little bit different behavior

git checkout issue-330
git pull origin issue-330
npm run dev
npm run server

panel in 3000 port
http://localhost:3000/d/Bnh59Trnk/24-adhoc-2b-24-variable3a-text-formatting?editPanel=2

image

GRAFANA_VERSION=10.4.3 docker compose up -d grafana
http://localhost:3000/d/Bnh59Trnk/24-adhoc-2b-24-variable3a-text-formatting?editPanel=2

image

this is definitely bug and shall be fixed

@Slach Slach merged commit 8f27df0 into master Nov 22, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow setup adhoc queries in ConnectionSettings
4 participants