Skip to content

Commit

Permalink
[Maps][Visualize][Graph][Dashboard] Fixes the listingLimit settings u…
Browse files Browse the repository at this point in the history
…rl (#129701)

* [Maps][Visualize][Graph][Dashboard] Fixes the listingLimit settings url

* Check if user has permissions to alter the advanced setting

* Use the uiSettings service instead of the deprecated savedObjects one

* Address review comments - maps

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
stratoula and kibanamachine authored Apr 12, 2022
1 parent eaf6c84 commit b0591a4
Show file tree
Hide file tree
Showing 12 changed files with 308 additions and 54 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ import { getDashboardListItemLink } from './get_dashboard_list_item_link';
import { DASHBOARD_PANELS_UNSAVED_ID } from '../lib/dashboard_session_storage';
import { useExecutionContext } from '../../../../kibana_react/public';

const SAVED_OBJECTS_LIMIT_SETTING = 'savedObjects:listingLimit';
const SAVED_OBJECTS_PER_PAGE_SETTING = 'savedObjects:perPage';

export interface DashboardListingProps {
kbnUrlStateStorage: IKbnUrlStateStorage;
redirectTo: DashboardRedirect;
Expand All @@ -54,7 +57,6 @@ export const DashboardListing = ({
services: {
core,
data,
savedObjects,
savedDashboards,
savedObjectsClient,
savedObjectsTagging,
Expand Down Expand Up @@ -105,7 +107,8 @@ export const DashboardListing = ({
}, [title, savedObjectsClient, redirectTo, data.query, kbnUrlStateStorage]);

const { showWriteControls } = dashboardCapabilities;
const listingLimit = savedObjects.settings.getListingLimit();
const listingLimit = core.uiSettings.get(SAVED_OBJECTS_LIMIT_SETTING);
const initialPageSize = core.uiSettings.get(SAVED_OBJECTS_PER_PAGE_SETTING);
const defaultFilter = title ? `"${title}"` : '';

const tableColumns = useMemo(
Expand Down Expand Up @@ -286,7 +289,7 @@ export const DashboardListing = ({
<TableListView
createItem={!showWriteControls ? undefined : createItem}
deleteItems={!showWriteControls ? undefined : deleteItems}
initialPageSize={savedObjects.settings.getPerPage()}
initialPageSize={initialPageSize}
editItem={!showWriteControls ? undefined : editItem}
initialFilter={initialFilter ?? defaultFilter}
toastNotifications={core.notifications.toasts}
Expand All @@ -304,6 +307,7 @@ export const DashboardListing = ({
tableColumns,
}}
theme={core.theme}
application={core.application}
>
<DashboardUnsavedListing
redirectTo={redirectTo}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { EuiEmptyPrompt } from '@elastic/eui';
import { shallowWithIntl } from '@kbn/test-jest-helpers';
import { ToastsStart } from 'kibana/public';
import React from 'react';
import { themeServiceMock } from '../../../../../src/core/public/mocks';
import { themeServiceMock, applicationServiceMock } from '../../../../../src/core/public/mocks';
import { TableListView } from './table_list_view';

const requiredProps = {
Expand All @@ -26,6 +26,7 @@ const requiredProps = {
toastNotifications: {} as ToastsStart,
findItems: jest.fn(() => Promise.resolve({ total: 0, hits: [] })),
theme: themeServiceMock.createStartContract(),
application: applicationServiceMock.createStartContract(),
};

describe('TableListView', () => {
Expand Down
Loading

0 comments on commit b0591a4

Please sign in to comment.