-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[Dashboard] [Controls] Fix new controls causing unsaved changes bug #132850
[Dashboard] [Controls] Fix new controls causing unsaved changes bug #132850
Conversation
65b3b7f
to
4ca5180
Compare
describe('Dashboard options list integration', () => { | ||
before(async () => { | ||
await common.navigateToApp('dashboard'); | ||
await dashboard.gotoDashboardLandingPage(); | ||
await dashboard.clickNewDashboard(); | ||
await timePicker.setDefaultDataRange(); | ||
await elasticChart.setNewChartUiDebugFlag(); | ||
await dashboard.saveDashboard(DASHBOARD_NAME, { exitFromEditMode: false }); |
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.
This bug was only present for existing dashboards, so need to save the dashboard before adding controls and testing to ensure that the unsaved changes
badge can be cleared.
4ca5180
to
d3859c9
Compare
💛 Build succeeded, but was flakyFailed CI StepsTest Failures
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: cc @Heenawter |
Pinging @elastic/kibana-presentation (Team:Presentation) |
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.
Really nice bugfix! Code only review and everything LGTM. Nice that it's mostly functional tests!
onTypeEditorChange({ | ||
fieldName: field.name, | ||
parentFieldName: fieldRegistry?.[field.name].parentFieldName, | ||
childFieldName: fieldRegistry?.[field.name].childFieldName, | ||
...(parentFieldName && { parentFieldName }), |
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.
💯
@@ -102,6 +106,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { | |||
validateRange('placeholder', secondId, '100', '1200'); | |||
// data views should be properly propagated from the control group to the dashboard | |||
expect(await filterBar.getIndexPatterns()).to.be('logstash-*,kibana_sample_data_flights'); | |||
await dashboard.clearUnsavedChanges(); |
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.
Nice addition to call this after each test.
⚪ Backport skippedThe pull request was not backported as there were no branches to backport to. If this is a mistake, please apply the desired version labels or run the backport tool manually. Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
…lastic#132850) * Prevent injection of undefined parent/field names * Add unsaved check to existing functional tests (cherry picked from commit f6086d9)
Closes #132841
Summary
Before this change, when a new field was selected via creating a new control, the optional
parentFieldName
andchildFieldName
properties were being injected asundefined
to thepanels
property of thecontrolGroupInput
via the following code incontrol_editor.tsx
:However, when the control group panels are saved as JSON, all keys that have
undefined
values are dropped. This means that, when the control group inputs were compared indiffDashboardState
, the old state would not haveparent/childFieldName
but they would both beundefined
in the new state.This PR prevents the initial injection by ensuring that both the
parentFieldName
andchildFieldName
have values before setting them. Therefore, we no longer have the issue of anundefined
value being different than the key simply not existing in an object, sodeepEqual
works as expected.Video
2022-05-24_ControlsUnsavedChangesCleared.mp4
Flaky Test Runner
Checklist
For maintainers