-
Notifications
You must be signed in to change notification settings - Fork 0
fix(params): apply a parameter widget's configured Default value (#1421) #1478
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| import { test, expect, ALICE, createTestDashboard } from "./fixtures"; | ||
|
|
||
| /** | ||
| * #1421 — a parameter widget's **Default value** was never applied, because | ||
| * `extractParamDefaults` had zero production callers. Every dashboard relying | ||
| * on defaults rendered empty on arrival: the seeded Chart Playground (8 pages, | ||
| * 21 configured defaults) showed "Waiting for parameters…" on every chart until | ||
| * the user set each knob by hand. | ||
| * | ||
| * Built as a fixture rather than driving the seeded Playground, which is a demo | ||
| * showcase and is not present in the E2E database. | ||
| */ | ||
| test.describe("Parameter defaults are applied on load (#1421)", () => { | ||
| test.beforeEach(async ({ authPage }) => { | ||
| await authPage.login(ALICE.email, ALICE.password); | ||
| }); | ||
|
|
||
| test("a configured default renders the chart instead of 'Waiting for parameters'", async ({ | ||
| page, | ||
| }) => { | ||
| test.setTimeout(90_000); | ||
|
|
||
| const { id, cleanup } = await createTestDashboard( | ||
| page.request, | ||
| `Param defaults ${Date.now()}`, | ||
| ); | ||
|
|
||
| try { | ||
| await page.request.put(`/api/dashboards/${id}`, { | ||
| data: { | ||
| layoutJson: { | ||
| version: 2, | ||
| pages: [ | ||
| { | ||
| id: "p1", | ||
| title: "Page 1", | ||
| widgets: [ | ||
| { | ||
| id: "sel", | ||
| chartType: "parameter-select", | ||
| connectionId: "conn-neo4j-001", | ||
| query: "", | ||
| settings: { | ||
| title: "Title filter", | ||
| chartOptions: { | ||
| parameterName: "title_filter", | ||
| parameterType: "text", | ||
| defaultValue: "The", | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| // Consumes the parameter. Neo4j binds `$param_` natively, | ||
| // so this is a real bound parameter, not string splicing. | ||
| id: "tbl", | ||
| chartType: "table", | ||
| connectionId: "conn-neo4j-001", | ||
| query: | ||
| "MATCH (m:Movie) WHERE m.title CONTAINS $param_title_filter RETURN m.title AS title LIMIT 3", | ||
| settings: { title: "Filtered movies" }, | ||
| }, | ||
| ], | ||
| gridLayout: [ | ||
| { i: "sel", x: 0, y: 0, w: 4, h: 3 }, | ||
| { i: "tbl", x: 4, y: 0, w: 8, h: 4 }, | ||
| ], | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| await page.goto(`/${id}`); | ||
|
|
||
| // The symptom: the consuming widget stalls, naming the token it lacks. | ||
| await expect(page.getByText(/Waiting for parameters/)).toHaveCount(0, { | ||
| timeout: 20_000, | ||
| }); | ||
| await expect(page.getByText("$param_title_filter")).toHaveCount(0); | ||
|
|
||
| // And the chart actually renders, which only happens once the parameter | ||
| // resolves and the query runs. | ||
| await expect(page.locator("table").first()).toBeVisible({ | ||
| timeout: 20_000, | ||
| }); | ||
| } finally { | ||
| await cleanup(); | ||
| } | ||
| }); | ||
| }); |
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.