Skip to content

Commit

Permalink
Adapt Visualize code
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed May 13, 2020
1 parent 785c3a5 commit 185d29c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { i18n } from '@kbn/i18n';

import { getServices } from '../../kibana_services';
import { syncQueryStateWithUrl } from '../../../../data/public';
import { LISTING_LIMIT_SETTING, PER_PAGE_SETTING } from '../../../../saved_objects/common';

export function initListingDirective(app, I18nContext) {
app.directive('visualizeListingTable', reactDirective =>
Expand All @@ -43,6 +42,7 @@ export function VisualizeListingController($scope, createNewVis, kbnUrlStateStor
toastNotifications,
visualizations,
core: { docLinks, savedObjects, uiSettings },
savedObjects: savedObjectsPublic,
} = getServices();

// syncs `_g` portion of url with query services
Expand Down Expand Up @@ -92,7 +92,7 @@ export function VisualizeListingController($scope, createNewVis, kbnUrlStateStor
this.fetchItems = filter => {
const isLabsEnabled = uiSettings.get('visualize:enableLabs');
return savedVisualizations
.findListItems(filter, uiSettings.get(LISTING_LIMIT_SETTING))
.findListItems(filter, savedObjectsPublic.settings.getListingLimit())
.then(result => {
this.totalItems = result.total;

Expand Down Expand Up @@ -125,8 +125,8 @@ export function VisualizeListingController($scope, createNewVis, kbnUrlStateStor
},
]);

this.listingLimit = uiSettings.get(LISTING_LIMIT_SETTING);
this.initialPageSize = uiSettings.get(PER_PAGE_SETTING);
this.listingLimit = savedObjectsPublic.settings.getListingLimit();
this.initialPageSize = savedObjectsPublic.settings.getPerPage();

addHelpMenuToAppChrome(chrome, docLinks);

Expand Down
2 changes: 2 additions & 0 deletions src/plugins/visualize/public/kibana_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { VisualizationsStart } from '../../visualizations/public';
import { SavedVisualizations } from './application/types';
import { KibanaLegacyStart } from '../../kibana_legacy/public';
import { DefaultEditorController } from '../../vis_default_editor/public';
import { SavedObjectsStart } from '../../saved_objects/public';

export interface VisualizeKibanaServices {
pluginInitializerContext: PluginInitializerContext;
Expand All @@ -54,6 +55,7 @@ export interface VisualizeKibanaServices {
setActiveUrl: (newUrl: string) => void;
DefaultVisualizationEditor: typeof DefaultEditorController;
createVisEmbeddableFromObject: VisualizationsStart['__LEGACY']['createVisEmbeddableFromObject'];
savedObjects: SavedObjectsStart;
}

let services: VisualizeKibanaServices | null = null;
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/visualize/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ import { VisualizeConstants } from './application/visualize_constants';
import { setServices, VisualizeKibanaServices } from './kibana_services';
import { FeatureCatalogueCategory, HomePublicPluginSetup } from '../../home/public';
import { DefaultEditorController } from '../../vis_default_editor/public';
import { SavedObjectsStart } from '../../saved_objects/public';

export interface VisualizePluginStartDependencies {
data: DataPublicPluginStart;
navigation: NavigationStart;
share?: SharePluginStart;
visualizations: VisualizationsStart;
savedObjects: SavedObjectsStart;
}

export interface VisualizePluginSetupDependencies {
Expand Down Expand Up @@ -120,6 +122,7 @@ export class VisualizePlugin
DefaultVisualizationEditor: DefaultEditorController,
createVisEmbeddableFromObject:
pluginsStart.visualizations.__LEGACY.createVisEmbeddableFromObject,
savedObjects: pluginsStart.savedObjects,
};
setServices(deps);

Expand Down

0 comments on commit 185d29c

Please sign in to comment.