-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
cleanup visualizations api #59958
cleanup visualizations api #59958
Conversation
Pinging @elastic/kibana-app-arch (Team:AppArch) |
8f93b09
to
999ceeb
Compare
e4d16bf
to
8d0d452
Compare
...re_plugins/visualizations/public/np_ready/public/embeddable/visualize_embeddable_factory.tsx
Outdated
Show resolved
Hide resolved
a11b2da
to
4082665
Compare
const visState = stateContainer.getState().vis; | ||
const state = { | ||
type: visState.type, | ||
title: visState.title, | ||
params: visState.params, | ||
data: { | ||
aggs: visState.aggs, | ||
}, | ||
}; | ||
vis.setState(state); |
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.
Seems you skip this suggestion (at least didn't see an answer), but I think it will simplify code.
If you only need to extract aggs and put them into data, you could simplify this:
const { vis: { aggs, ...visState } }= stateContainer.getState();
vis.setState({ ...visState, data: { aggs } });
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.
Did a pass through to test the various vis types (Chrome macOS); from what I can tell everything seems to be working as expected.
visualizations
plugin changes LGTM overall, once we get the last conflicts fixed & a green build.
# Conflicts: # src/legacy/core_plugins/tile_map/public/tile_map_type.js # src/legacy/core_plugins/vis_default_editor/public/components/agg.test.tsx # src/legacy/core_plugins/vis_default_editor/public/components/agg_common_props.ts # src/legacy/core_plugins/vis_default_editor/public/components/agg_group.test.tsx # src/legacy/core_plugins/vis_default_editor/public/components/agg_param_props.ts # src/legacy/core_plugins/vis_default_editor/public/components/agg_params.test.tsx # src/legacy/core_plugins/vis_default_editor/public/components/agg_params_helper.test.ts # src/legacy/core_plugins/vis_default_editor/public/components/agg_params_helper.ts # src/legacy/core_plugins/vis_default_editor/public/components/controls/field.test.tsx # src/legacy/core_plugins/vis_default_editor/public/components/controls/percentiles.test.tsx # src/legacy/core_plugins/vis_default_editor/public/components/controls/test_utils.ts # src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar.tsx # src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/index.ts # src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/reducers.ts # src/legacy/core_plugins/vis_default_editor/public/vis_options_props.tsx # src/legacy/core_plugins/vis_type_tagcloud/public/tag_cloud_type.ts
@@ -703,6 +737,9 @@ function VisualizeAppController( | |||
searchSource.setField('index', currentIndex); | |||
searchSource.setParent(searchSourceGrandparent); | |||
|
|||
delete savedVis.savedSearchId; | |||
delete vis.data.savedSearchId; |
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.
We are handling the linked
state in url. Callinng stateContainer.transitions.unlinkSavedSearch
will set linked: false
, which will remove savedSearchId
from both savedVis
and vis.data
objects in handleLinkedSearch
, so there is no necessity to do it here.
} | ||
|
||
export function LinkedSearch({ savedSearch, vis }: LinkedSearchProps) { | ||
export function LinkedSearch({ vis, savedSearch, eventEmitter }: LinkedSearchProps) { |
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.
vis
is an extra prop in LinkedSearch
now
query, | ||
}); | ||
|
||
return () => {}; |
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.
Extra returning a function, which doesn't do anything, should be removed.
savedObj: VisSavedObject; | ||
vis: Vis; | ||
eventEmitter: EventEmitter; | ||
embeddableHandler: any; |
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.
AFAIK this should be VisualizeEmbeddable
type, shouldn't it?
@@ -27,7 +26,6 @@ export interface VisOptionsProps<VisParamType = unknown> { | |||
isTabSelected: boolean; | |||
stateParams: VisParamType; | |||
vis: Vis; | |||
uiState: PersistedState; |
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.
When you removed passing down the uiState
into vis options tab, we lost next functionality:
- create a gauge vis;
- change a color for a metric in the legend (in options tab you'll see the
Reset colors
button) - theuiState
should be preserved in the url; - reload the page - you'll lost the actual ui state (color is lost, button is not shown)
src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/point_series.tsx
Outdated
Show resolved
Hide resolved
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.
All of the specified issues were resolved!
Apart from that, didn't find anything else broken in visualize (was mostly focused on testing there)
Left some nits, but overall LGTM!
Great step over moving to NP!
@@ -54,18 +56,18 @@ export interface VisualizeAppStateTransitions { | |||
state: VisualizeAppState | |||
) => ({ query, parentFilters }: { query?: Query; parentFilters?: Filter[] }) => VisualizeAppState; | |||
updateVisState: (state: VisualizeAppState) => (vis: PureVisState) => VisualizeAppState; | |||
updateUiState: (state: VisualizeAppState) => (uiState: PersistedState) => VisualizeAppState; |
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.
Extra type
@@ -82,6 +82,7 @@ export function useVisualizeAppState({ stateDefaults, kbnUrlStateStorage }: Argu | |||
linked: false, | |||
}), | |||
updateVisState: state => newVisState => ({ ...state, vis: toObject(newVisState) }), | |||
updateUiState: state => newUiState => ({ ...state, uiState: newUiState }), |
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.
Extra method
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* master: (26 commits) [Alerting] Fixes flaky test in Alert Instances Details page (elastic#60893) cleanup visualizations api (elastic#59958) Inline timezoneProvider function, remove ui/vis/lib/timezone (elastic#60475) [SIEM] Adds 'Open one signal' Cypress test (elastic#60484) [UA] Upgrade assistant migration meta data can become stale (elastic#60789) [Metrics Alerts] Remove metric field from doc count on backend (elastic#60679) [Uptime] Skip failing location test temporarily (elastic#60938) [ML] Disabling datafeed editing when job is running (elastic#60751) Adding `authc.invalidateAPIKeyAsInternalUser` (elastic#60717) [SIEM] Add license check to ML Rule form (elastic#60691) Adding `authc.grantAPIKeyAsInternalUser` (elastic#60423) Support Histogram Data Type (elastic#59387) [Upgrade Assistant] Fix edge case where reindex op can falsely be seen as stale (elastic#60770) [SIEM] [Cases] Update case icons (elastic#60812) [TSVB] Fix percentiles band mode (elastic#60741) Fix formatter on range aggregation (elastic#58651) Goodbye, legacy data plugin 👋 (elastic#60449) [Metrics UI] Alerting for metrics explorer and inventory (elastic#58779) [Remote clustersadopt changes to remote info API (elastic#60795) Only run xpack siem cypress in PRs when there are siem changes (elastic#60661) ...
Summary
Checklist
Delete any items that are not applicable to this PR.
For maintainers