* pushed to get help of a genius
* fix: error response is not json
* feat: make request on click
* refactor: remove print statement
* refactor: remove unnecessary code
* feat: convert grafana variables to value for API request
* use the parser to interpolate and recover the original query (#64591)
* Prettify query: use the parser to interpolate and recover the original query
* Fix typo
Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
* Fix typo
Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
* fix: reverse transformation not working
---------
Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
Co-authored-by: Gareth Dawson <gwdawson.work@gmail.com>
* fix: bugs created from merge
* refactor: move prettify code out of monaco editor
* fix: variables with the same value get converted back to the incorect variable
* refactor
* use consistent styling with bigquery
* fix: only allow text/plain and application/json
* fix: only make the request if the query is valid
* endpoint now returns application/json
* prettify from js
* WIP: not all cases are handles, code still needs cleaning up
* WIP
* large refactor, finished support for all pipeline expressions
* add tests for all format functions
* idk why these files changed
* add support for range aggregation expr & refactor
* add support for vector aggregation expressions
* add support for bin op expression
* add support for literal and vector expressions
* add tests and fix some bugs
* add support for distinct and decolorize
* feat: update variable replace and return
* fix: lezer throws an errow when using a range variable
* remove api implementation
* remove api implementation
* remove type assertions
* add feature flag
* update naming
* fix: bug incorrectly formatting unwrap with labelfilter
* support label replace expr
* remove duplicate code (after migration)
* add more tests
* validate query before formatting
* move tests to lezer repo
* add feature tracking
* populate feature tracking with some data
* upgrade lezer version to 0.1.7
* bump lezer to 0.1.8
* add tests
---------
Co-authored-by: Matias Chomicki <matyax@gmail.com>
Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
* fix: use correct validate funtion
* rename isValidQuery to isQueryWithError
* lets pretend i didnt break things again
* Loki validation: add missing comments and refactor validation function
* isValidQuery: add unit test
* Loki datasource: add tests for getQueryStats
* Remove isValidQuery function
* UnwrapParamEditor: interpolate query before testing validity
* Stats: trim queries when evaluating change
---------
Co-authored-by: Matias Chomicki <matyax@gmail.com>
* Query utils: refactor isQueryPipelineErrorFiltering and getLogQueryFromMetricsQuery
* Query utils: refactor isQueryWithRangeVariable and getHighlighterExpressionsFromQuery
* Get parser: return log expression even if no pipelineExpr is present
* Update tests
* Loki: Add functionality to revert to initial query
* Add tests and fix button in button
* Use usereven instead of fireEvent
* Shortern onClick
* Add feature tracking
* Use testid instead of title
* Always show revert button
* Remove unused imports
* Loki: Fix incorrect evaluation of real/extracted labels in context
* Add tests
* Improve caching and add more tests
* Use mockResolvedValue
* Flip logic for getInitContextFiltersFromLabels
* Update to logic to use fetchSeriesLabels for queries with more than 1 parser
* fix: dont call endpoint if invalid query
* fix: use latest lezer-logql
* refactor: use null instead of undefined
* test: returns null when query is invalid
* update
* fix logrowcontext scrolling behavior
* Loki: Update loki context ui menu
* Update
* Add test, update
* Use escapeLabelValueInSelector when displaying labels
* Update test for new appliedContextFilters
---------
Co-authored-by: Sven Grossmann <svennergr@gmail.com>
* update react 18 related deps
* fix some types
* make sure we're on react-router-dom >= 5.3.3
* Use new root API
* Remove StrictMode for now - react 18 double rendering causes issues
* fix + ignore some @grafana/ui types
* fix some more types
* use renderHook from @testing-library/react in almost all cases
* fix storybook types
* rewrite useDashboardSave to not use useEffect
* make props optional
* only render if props are provided
* add correct type for useCallback
* make resourcepicker tests more robust
* fix ModalManager rendering
* fix some more unit tests
* store the click coordinates in a ref as setState is NOT synchronous
* fix remaining e2e tests
* rewrite dashboardpage tests to avoid act warnings
* undo lint ignores
* fix ExpanderCell types
* set SymbolCell type correctly
* fix QueryAndExpressionsStep
* looks like the types were actually wrong instead :D
* undo this for now...
* remove spinner waits
* more robust tests
* rewrite errorboundary test to not explicitly count the number of renders
* make urlParam expect async
* increase timeout in waitFor
* revert ExplorePage test changes
* Update public/app/features/dashboard/containers/DashboardPage.test.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/features/dashboard/containers/PublicDashboardPage.test.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/features/dashboard/containers/PublicDashboardPage.test.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/features/dashboard/containers/PublicDashboardPage.test.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* skip fakeTimer test, ignore table types for now + other review comments
* update package peerDeps
* small tweak to resourcepicker test
* update lockfile...
* increase timeout in sharepublicdashboard tests
* ensure ExplorePaneContainer passes correct queries to initializeExplore
* fix LokiContextUI test
* fix unit tests
* make importDashboard flow more consistent
* wait for dashboard name before continuing
* more test fixes
* readd dashboard name to variable e2e tests
* wait for switches to be enabled before clicking
* fix modal rendering
* don't use @testing-library/dom directly
* quick fix for rendering of panels in firefox
* make PromQueryField test more robust
* don't wait for chartData - in react 18 this can happen before the wait code even gets executed
---------
Co-authored-by: kay delaney <kay@grafana.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Prometheus: Run query explicitly instead of onblur in panel edit, and highlight Run qqueries when query changed
* Update loki to do the same
* Cleanup unused prop
* Remove test
* fix: refresh query stats on timerange change
* partial fix: request stats update on type in code mode
* complete fix: request stats update on type in code mode
* fix: update failing tests and props
* refactor: pass only essential query string to getQueryStats
* refactor: remove unused variables
* test: fix datasource.getTimeRange is not a function
* refactor: use lodash debounce instead of setTimeout
* refactor: add suggestions from code review
* test: shouldUpdateStats and makeStatsRequest
* refactor: use more appropriate variable names
* refactor: make setQueryStats required instead of optional
* refactor: move setQueryStats into LokiQueryEditor
* fix: add missing props to LokiQueryField
* revert changes
* refactor: use inversion of control to request stats
* refactor: remove unnecessary code
* improved text
* prevent all labels removed
* use `structuredClone` instead of lodash
* update test
* get `structuredClone` in test?
* fix using structuredClone
* fix: add placeholder to loki query editor
* fix: use original placeholder
* refactor: extract set placeholder into seperate function
* fix: use correct monaco types
* revert: unwanted change from merge