Skip to content

Commit

Permalink
[Visualize] Remove legacy appState in visualize (#57330) (#58105)
Browse files Browse the repository at this point in the history
* Remove legacy appState in visualize

* Read query and linked prop from scope

* Fix persisted state instance

* Fix functional tests

* Bound url updates with an editor

* Some improvements

* Fix comments
  • Loading branch information
sulemanof committed Feb 20, 2020
1 parent a1bf7d4 commit ef8c36f
Show file tree
Hide file tree
Showing 20 changed files with 400 additions and 168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers';
import { findTestSubject } from '@elastic/eui/lib/test';
import { getDepsMock, getIndexPatternMock } from '../../test_utils';
import { ControlsTab, ControlsTabUiProps } from './controls_tab';
import { Vis } from 'src/legacy/core_plugins/visualizations/public';

const indexPatternsMock = {
get: getIndexPatternMock,
Expand All @@ -32,7 +33,7 @@ let props: ControlsTabUiProps;
beforeEach(() => {
props = {
deps: getDepsMock(),
vis: {
vis: ({
API: {
indexPatterns: indexPatternsMock,
},
Expand All @@ -46,7 +47,7 @@ beforeEach(() => {
requiresSearch: false,
hidden: false,
},
},
} as unknown) as Vis,
stateParams: {
controls: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@
* directly where they are needed.
*/

// @ts-ignore
export { AppState, AppStateProvider } from 'ui/state_management/app_state';
export { State } from 'ui/state_management/state';
// @ts-ignore
export { GlobalStateProvider } from 'ui/state_management/global_state';
// @ts-ignore
export { StateManagementConfigProvider } from 'ui/state_management/config_provider';
export { stateMonitorFactory } from 'ui/state_management/state_monitor_factory';
export { PersistedState } from 'ui/persisted_state';

export { subscribeWithScope } from 'ui/utils/subscribe_with_scope';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular';

import { AppMountContext } from 'kibana/public';
import {
AppStateProvider,
AppState,
configureAppAngularModule,
createTopNavDirective,
createTopNavHelper,
Expand Down Expand Up @@ -116,12 +114,6 @@ function createLocalStateModule() {
'app/visualize/Promise',
'app/visualize/PersistedState',
])
.factory('AppState', function(Private: IPrivate) {
return Private(AppStateProvider);
})
.service('getAppState', function(Private: IPrivate) {
return Private<AppState>(AppStateProvider).getAppState;
})
.service('globalState', function(Private: IPrivate) {
return Private(GlobalStateProvider);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Linked search. -->
<div
ng-show="isVisible"
ng-if="vis.type.requiresSearch && state.linked"
ng-if="vis.type.requiresSearch && linked"
class="fullWidth visEditor__linkedMessage"
>
<div class="kuiVerticalRhythmSmall">
Expand Down Expand Up @@ -42,9 +42,9 @@
show-filter-bar="showFilterBar() && isVisible"
show-date-picker="showQueryBarTimePicker()"
show-auto-refresh-only="!showQueryBarTimePicker()"
query="state.query"
query="query"
saved-query="savedQuery"
screen-title="state.vis.title"
screen-title="vis.title"
on-query-submit="updateQueryAndFetch"
index-patterns="[indexPattern]"
filters="filters"
Expand Down Expand Up @@ -97,7 +97,9 @@
ui-state="uiState"
time-range="timeRange"
filters="filters"
query="query"/>
query="query"
app-state="appState"
/>

<h1
class="euiScreenReaderOnly"
Expand All @@ -117,6 +119,7 @@
filters="filters"
query="query"
class="visEditor__content"
app-state="appState"
/>

</visualize-app>
Loading

0 comments on commit ef8c36f

Please sign in to comment.