feat(dashboard): support per-target multi-datasource queries - #2238
Draft
jsers wants to merge 12 commits into
Draft
feat(dashboard): support per-target multi-datasource queries#2238jsers wants to merge 12 commits into
jsers wants to merge 12 commits into
Conversation
Allow each panel query target to carry its own datasource so a single panel can mix datasources. Mixed panels render via SingleTargetQueryEditor reusing each datasource's existing QueryBuilder; single-datasource panels keep the existing per-plugin builder path. - Add ITarget.datasource and a v4 migrator that normalizes legacy __mode__/expr targets to kind-based targets on dashboard load. - Introduce datasource registry/contract/service/requestState for the new /api/n9e/v2/query-batch rendering path with expression dependency resolution. - Unify expression detection on isExpressionTarget across plugin builders so migrated targets keep rendering after save/reload. - Omit field.key when spreading onto nested Form.Items to fix React duplicate-key warnings; add query.mixed_datasource i18n key.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Spread elasticsearch/opensearch query.values into one backend query per value, preserving the first value's RefID and allocating unique sub RefIDs for the rest. Normalize responses back to the originating target while letting an exact-match RefID win over a value-query prefix match. Also port each datasource's legacy isQueryReady short-circuit so unprepared targets are silently skipped without triggering validation.
… usage - migrate Menu.Item children to Menu items prop in DashboardLinks, Detail/Title, Renderer/Main - add hidden input child to hidden Form.Item in ES QueryPanel/Values, OrganizeFields, TransformationsEditorNG - reset fields before setFieldsValue in DataLinks FormModal - move setTableFields side effect from useMemo to useEffect in TableNG
…datasource-query # Conflicts: # src/pages/dashboard/Editor/index.tsx # src/pages/dashboard/Renderer/Renderer/Main.tsx # src/pages/dashboard/Renderer/Renderer/TableNG/index.tsx # src/pages/dashboard/Renderer/Renderer/Timeseries/index.tsx
Strip the `key` field before spreading Form.List field props onto Form.Item / Form.List to silence the React key-spread warning across the Elasticsearch query editor and plugin AdvancedSettings components.
Replace `any` across dashboard query/variable/renderer modules with JsonObject and typed series shapes, extract getDashboardQueryStep from the legacy prometheus executor, and add a `check:dashboard-types` script that enforces no-implicit-any on active dashboard code.
Set up jsdom + testing-library harness: jest.setup injects jest-dom matchers and jsdom-missing browser APIs; jest.config maps plus: virtual modules to a stub and proxies .less/.css to identity-obj-proxy; add renderWithProviders / resetGlobalState helpers and dashboardQuery fixtures. Cover the unified query contract validation, the useQuery hook (debounce, viewport deferral, stale-response drop, unmount safety), and the ExpressionPanel interactions. Also export setGlobalState from dashboard globalState for test resets, and memoize TableNG overrides key before passing to useEffect deps.
…rer types
- destroy G2/TsGraph instances in BarChart/Heatmap/Stat on unmount to
avoid leaked event listeners
- remove tooltip overlay DOM and mouseup listener in tooltipPlugin destroy
- null gridApiRef on grid pre-destroy; guard undefined field in cell renderer
- narrow cellOptions, DashboardSeries and TableCellValue types across
TableNG and normalizeData
- fix ITransformation.id literal type ('string' -> string)
…ling - Preserve user-saved field order in Organize editor; only append new columns - Clamp activeIndex to valid range and guard getFormattedRowData against undefined tableData - Snapshot/restore frame ids across transformation pipeline; keep columns and rows keys in sync - Fix MergeTransformation losing rows when tables share no common fields - Match organize fields by displayName with name fallback; preserve TableData extras - Configure Vite optimizeDeps define for react-draggable and add n9e-plus dev proxy - Add tests for Organize editor, normalizeData, getFormattedRowData, Merge, OrganizeFields
Tighten TypeScript across dashboard renderer, editor, variables and transformations: narrow per-panel `custom` JsonObject destructuring, widen IThresholds step value to number | null with downstream ?? 0 and type guards, unify getCalculatedValuesBySeries return via the new CalculatedSeriesValue interface, fix getBuiltInVariables call to match its (range, params?) signature, and add null safety in transformations. Also show a brief summary of configured maxDataPoints / time options next to the QueryOptions button, covered by a jest test.
…logs series metadata - Row edit modal keeps original row.name when input is cleared instead of overwriting with empty - Populate n9e_internal (id, refId, metric) for victorialogs base series so legend highlight and override matching work
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Allow each panel query target to carry its own datasource so a single panel can mix datasources. Mixed panels render via SingleTargetQueryEditor reusing each datasource's existing QueryBuilder; single-datasource panels keep the existing per-plugin builder path.