Skip to content

Commit

Permalink
Add empty state
Browse files Browse the repository at this point in the history
  • Loading branch information
jen-huang committed Mar 13, 2020
1 parent caabb1f commit 227ed69
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import {
EuiTitle,
// @ts-ignore
EuiSearchBar,
EuiText,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { Loading } from '../../../components';
import { PackageList } from '../../../types';
import { useLocalSearch, searchIdField } from '../hooks';
Expand Down Expand Up @@ -102,11 +104,24 @@ type GridColumnProps = {
function GridColumn({ list }: GridColumnProps) {
return (
<EuiFlexGrid gutterSize="l" columns={3}>
{list.map(item => (
<EuiFlexItem key={`${item.name}-${item.version}`}>
<PackageCard {...item} />
{list.length ? (
list.map(item => (
<EuiFlexItem key={`${item.name}-${item.version}`}>
<PackageCard {...item} />
</EuiFlexItem>
))
) : (
<EuiFlexItem>
<EuiText>
<p>
<FormattedMessage
id="xpack.ingestManager.epmList.noPackagesFoundPlaceholder"
defaultMessage="No packages found"
/>
</p>
</EuiText>
</EuiFlexItem>
))}
)}
</EuiFlexGrid>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function InstalledPackages() {
const { data: allPackages, isLoading: isLoadingPackages } = useGetPackages();
const [selectedCategory, setSelectedCategory] = useState('');
const packages =
allPackages && allPackages.response
allPackages && allPackages.response && selectedCategory === ''
? allPackages.response.filter(pkg => pkg.status === 'installed')
: [];

Expand All @@ -82,7 +82,7 @@ function InstalledPackages() {
title: i18n.translate('xpack.ingestManager.epmList.updatesAvailableFilterLinkText', {
defaultMessage: 'Updates available',
}),
count: 0,
count: 0, // TODO: Update with real count when available
},
];

Expand Down

0 comments on commit 227ed69

Please sign in to comment.