Skip to content

Commit

Permalink
Implement review sugestions
Browse files Browse the repository at this point in the history
  • Loading branch information
machadoum committed Jul 5, 2023
1 parent d6e2435 commit 34ba502
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
TableListViewKibanaProvider,
} from '@kbn/content-management-table-list-view-table';
import { TableListView } from '@kbn/content-management-table-list-view';
import { TableListView } from '@kbn/content-management-table-list-view';

import { toMountPoint, useExecutionContext } from '@kbn/kibana-react-plugin/public';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { FormattedRelative, I18nProvider } from '@kbn/i18n-react';
import React from 'react';
import React, { useMemo } from 'react';

import {
type TableListViewKibanaDependencies,
Expand Down Expand Up @@ -41,7 +41,6 @@ export const DashboardListingTable = ({
overlays,
http,
savedObjectsTagging,

coreContext: { executionContext },
} = pluginServices.getServices();

Expand All @@ -63,24 +62,33 @@ export const DashboardListingTable = ({
initialFilter,
});

const savedObjectsTaggingFakePlugin = useMemo(
() =>
savedObjectsTagging.hasApi // TODO: clean up this logic once https://github.com/elastic/kibana/issues/140433 is resolved
? ({
ui: savedObjectsTagging,
} as TableListViewKibanaDependencies['savedObjectsTagging'])
: undefined,
[savedObjectsTagging]
);

const core = useMemo(
() => ({
application: application as TableListViewApplicationService,
notifications,
overlays,
http,
}),
[application, notifications, overlays, http]
);

return (
<I18nProvider>
<TableListViewKibanaProvider
{...{
core: {
application: application as TableListViewApplicationService,
notifications,
overlays,
http,
},
toMountPoint,
savedObjectsTagging: savedObjectsTagging.hasApi // TODO: clean up this logic once https://github.com/elastic/kibana/issues/140433 is resolved
? ({
ui: savedObjectsTagging,
} as TableListViewKibanaDependencies['savedObjectsTagging'])
: undefined,
FormattedRelative,
}}
core={core}
toMountPoint={toMountPoint}
savedObjectsTagging={savedObjectsTaggingFakePlugin}
FormattedRelative={FormattedRelative}
>
<>
<DashboardUnsavedListing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ const toTableListViewSavedObject = (hit: DashboardItem): DashboardSavedObjectUse
};
};

interface UseDashboardListingTableReturnType {
hasInitialFetchReturned: boolean;
pageDataTestSubject: string | undefined;
refreshUnsavedDashboards: () => void;
tableListViewTableProps: Omit<
TableListViewTableProps<DashboardSavedObjectUserContent>,
'tableCaption'
> & { title: string };
unsavedDashboardIds: string[];
}

export const useDashboardListingTable = ({
dashboardListingId = 'dashboard',
disableCreateDashboardButton,
Expand All @@ -76,7 +87,7 @@ export const useDashboardListingTable = ({
initialFilter?: string;
urlStateEnabled?: boolean;
useSessionStorageIntegration?: boolean;
}) => {
}): UseDashboardListingTableReturnType => {
const {
dashboardSessionStorage,
dashboardCapabilities: { showWriteControls },
Expand Down

0 comments on commit 34ba502

Please sign in to comment.