Skip to content

Commit

Permalink
[Step 1] ui/persisted_state πŸ‘‰ src/plugins/visualizations (elastic#58324…
Browse files Browse the repository at this point in the history
…) (elastic#58698)

* ui/persisted_state πŸ‘‰ src/plugins/visualizations

Part of elastic#46926

* fix JEST

* remove sinon from tests

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
alexwizp and elasticmachine authored Feb 27, 2020
1 parent d2fcec4 commit 6d23892
Show file tree
Hide file tree
Showing 9 changed files with 311 additions and 440 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ import angular from 'angular';
import { EuiIcon } from '@elastic/eui';
// @ts-ignore
import { StateProvider } from 'ui/state_management/state';
// @ts-ignore
import { EventsProvider } from 'ui/events';
import { PersistedState } from 'ui/persisted_state';
import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular';
import { CoreStart, LegacyCoreStart, IUiSettingsClient } from 'kibana/public';
// @ts-ignore
Expand Down Expand Up @@ -119,7 +116,6 @@ export function initializeInnerAngularModule(
createLocalPromiseModule();
createLocalConfigModule(core.uiSettings);
createLocalKbnUrlModule();
createLocalPersistedStateModule();
createLocalTopNavModule(navigation);
createLocalGlobalStateModule();
createLocalAppStateModule();
Expand All @@ -140,7 +136,6 @@ export function initializeInnerAngularModule(
'discoverPrivate',
'discoverDocTable',
'discoverPagerFactory',
'discoverPersistedState',
])
.config(watchMultiDecorator)
.directive('icon', reactDirective => reactDirective(EuiIcon))
Expand All @@ -158,7 +153,6 @@ export function initializeInnerAngularModule(
'discoverConfig',
'discoverI18n',
'discoverPrivate',
'discoverPersistedState',
'discoverTopNav',
'discoverGlobalState',
'discoverAppState',
Expand Down Expand Up @@ -197,19 +191,6 @@ export function createLocalGlobalStateModule() {
});
}

function createLocalPersistedStateModule() {
angular
.module('discoverPersistedState', ['discoverPrivate', 'discoverPromise'])
.factory('PersistedState', (Private: IPrivate) => {
const Events = Private(EventsProvider);
return class AngularPersistedState extends PersistedState {
constructor(value: any, path: any) {
super(value, path, Events);
}
};
});
}

function createLocalKbnUrlModule() {
angular
.module('discoverKbnUrl', ['discoverPrivate', 'ngRoute'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular';
import { AppMountContext } from 'kibana/public';
import {
configureAppAngularModule,
EventsProvider,
GlobalStateProvider,
KbnUrlProvider,
RedirectWhenMissingProvider,
IPrivate,
PersistedState,
PrivateProvider,
PromiseServiceCreator,
StateManagementConfigProvider,
Expand Down Expand Up @@ -92,15 +90,13 @@ function createLocalAngularModule(core: AppMountContext['core'], navigation: Nav
createLocalConfigModule(core);
createLocalKbnUrlModule();
createLocalStateModule();
createLocalPersistedStateModule();
createLocalTopNavModule(navigation);

const visualizeAngularModule: IModule = angular.module(moduleName, [
...thirdPartyAngularDependencies,
'app/visualize/Config',
'app/visualize/I18n',
'app/visualize/Private',
'app/visualize/PersistedState',
'app/visualize/TopNav',
'app/visualize/State',
]);
Expand All @@ -114,26 +110,12 @@ function createLocalStateModule() {
'app/visualize/Config',
'app/visualize/KbnUrl',
'app/visualize/Promise',
'app/visualize/PersistedState',
])
.service('globalState', function(Private: IPrivate) {
return Private(GlobalStateProvider);
});
}

function createLocalPersistedStateModule() {
angular
.module('app/visualize/PersistedState', ['app/visualize/Private', 'app/visualize/Promise'])
.factory('PersistedState', (Private: IPrivate) => {
const Events = Private(EventsProvider);
return class AngularPersistedState extends PersistedState {
constructor(value: any, path: any) {
super(value, path, Events);
}
};
});
}

function createLocalKbnUrlModule() {
angular
.module('app/visualize/KbnUrl', ['app/visualize/Private', 'ngRoute'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { TimeRange, Query, Filter, DataPublicPluginStart } from 'src/plugins/data/public';
import { IEmbeddableStart } from 'src/plugins/embeddable/public';
import { LegacyCoreStart } from 'kibana/public';
import { VisState, Vis } from 'src/legacy/core_plugins/visualizations/public';
import { Vis } from 'src/legacy/core_plugins/visualizations/public';
import { VisSavedObject, PersistedState } from '../legacy_imports';

export type PureVisState = ReturnType<Vis['getCurrentState']>;
Expand Down
Loading

0 comments on commit 6d23892

Please sign in to comment.