Skip to content

Commit

Permalink
Conditionally use full width for Maps listing page table (opensearch-…
Browse files Browse the repository at this point in the history
…project#655)

Signed-off-by: Junqiu Lei <junqiu@amazon.com>
  • Loading branch information
junqiu-lei committed Aug 16, 2024
1 parent 2e0d11e commit bf9d399
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 46 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Features
* Conditionally use the new Page Header variant on the Maps listing page [#653](https://github.com/opensearch-project/dashboards-maps/pull/653)
* Conditionally use the new Application Header variant on the Maps visualization page [#654](https://github.com/opensearch-project/dashboards-maps/pull/654)
* Conditionally use full width for Maps listing page table [#655](https://github.com/opensearch-project/dashboards-maps/pull/655)
### Enhancements
### Bug Fixes
### Infrastructure
Expand Down
86 changes: 40 additions & 46 deletions public/components/maps_list/maps_list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import { i18n } from '@osd/i18n';
import React, { useCallback, useEffect } from 'react';
import { I18nProvider } from '@osd/i18n/react';
import {
EuiPage,
EuiPageBody,
EuiPageContentBody,
EuiLink,
EuiSmallButton,
EuiPageHeader,
Expand Down Expand Up @@ -38,7 +35,7 @@ export const MapsList = () => {
},
} = useOpenSearchDashboards<MapServices>();

const showActionsInHeader = uiSettings.get('home:useNewHomePage');
const newHomePageEnabled = uiSettings.get('home:useNewHomePage');

useEffect(() => {
setBreadcrumbs(getMapsLandingBreadcrumbs(navigateToApp));
Expand Down Expand Up @@ -114,7 +111,7 @@ export const MapsList = () => {
pageTitle="Create your first map"
description="There is no map to display, let's create your first map."
rightSideItems={
showActionsInHeader ? [] : [
newHomePageEnabled ? [] : [
<EuiSmallButton
fill
onClick={navigateToCreateMapPage}
Expand All @@ -128,49 +125,46 @@ export const MapsList = () => {
);

return (
// @ts-ignore
<I18nProvider>
<>
<EuiPage restrictWidth="1000px">
<EuiPageBody component="main" data-test-subj="mapListingPage">
<EuiPageContentBody>
{showActionsInHeader &&
<HeaderControl
setMountPoint={application.setAppRightControls}
controls={[
{
id: 'Create map',
label: 'Create map',
iconType: 'plus',
fill: true,
href: `${MAPS_APP_ID}${APP_PATH.CREATE_MAP}`,
testId: 'createButton',
controlType: 'button',
},
]}
/>}
<TableListView
headingId="mapsListingHeading"
createItem= { showActionsInHeader ? undefined : navigateToCreateMapPage }
findItems={fetchMaps}
deleteItems={deleteMaps}
tableColumns={tableColumns}
listingLimit={10}
initialPageSize={10}
initialFilter={''}
noItemsFragment={noMapItem}
entityName={i18n.translate('maps.listing.table.entityName', {
defaultMessage: 'map',
})}
entityNamePlural={i18n.translate('maps.listing.table.entityNamePlural', {
defaultMessage: 'maps',
})}
tableListTitle={showActionsInHeader ? '' : i18n.translate('maps.listing.table.listTitle', {
defaultMessage: 'Maps'})}
toastNotifications={notifications.toasts}
/>
</EuiPageContentBody>
</EuiPageBody>
</EuiPage>
{newHomePageEnabled &&
// @ts-ignore
<HeaderControl
setMountPoint={application.setAppRightControls}
controls={[
{
id: 'Create map',
label: 'Create map',
iconType: 'plus',
fill: true,
href: `${MAPS_APP_ID}${APP_PATH.CREATE_MAP}`,
testId: 'createButton',
controlType: 'button',
},
]}
/>}
<TableListView
headingId="mapsListingHeading"
createItem= { newHomePageEnabled ? undefined : navigateToCreateMapPage }
findItems={fetchMaps}
deleteItems={deleteMaps}
tableColumns={tableColumns}
listingLimit={10}
initialPageSize={10}
initialFilter={''}
noItemsFragment={noMapItem}
entityName={i18n.translate('maps.listing.table.entityName', {
defaultMessage: 'map',
})}
entityNamePlural={i18n.translate('maps.listing.table.entityNamePlural', {
defaultMessage: 'maps',
})}
tableListTitle={newHomePageEnabled ? '' : i18n.translate('maps.listing.table.listTitle', {
defaultMessage: 'Maps'})}
toastNotifications={notifications.toasts}
restrictWidth={newHomePageEnabled ? false : true}
/>
</>
</I18nProvider>
);
Expand Down

0 comments on commit bf9d399

Please sign in to comment.