Skip to content

Commit

Permalink
ui/persisted_state 👉 src/plugins/visualizations
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwizp committed Feb 24, 2020
1 parent 98aa1d2 commit 9b75f81
Show file tree
Hide file tree
Showing 9 changed files with 310 additions and 439 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 @@ -25,12 +25,10 @@ import {
configureAppAngularModule,
createTopNavDirective,
createTopNavHelper,
EventsProvider,
GlobalStateProvider,
KbnUrlProvider,
RedirectWhenMissingProvider,
IPrivate,
PersistedState,
PrivateProvider,
PromiseServiceCreator,
StateManagementConfigProvider,
Expand Down Expand Up @@ -90,15 +88,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 @@ -112,26 +108,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 9b75f81

Please sign in to comment.