diff --git a/frontend/src/component/application/ApplicationList/ApplicationList.tsx b/frontend/src/component/application/ApplicationList/ApplicationList.tsx
deleted file mode 100644
index 96f9df3928..0000000000
--- a/frontend/src/component/application/ApplicationList/ApplicationList.tsx
+++ /dev/null
@@ -1,201 +0,0 @@
-import { useMemo } from 'react';
-import { Avatar, CircularProgress, Icon, Link } from '@mui/material';
-import Warning from '@mui/icons-material/Warning';
-import { styles as themeStyles } from 'component/common';
-import { PageContent } from 'component/common/PageContent/PageContent';
-import { PageHeader } from 'component/common/PageHeader/PageHeader';
-import useApplications from 'hooks/api/getters/useApplications/useApplications';
-import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
-import { Search } from 'component/common/Search/Search';
-import { SearchHighlightProvider } from 'component/common/Table/SearchHighlightContext/SearchHighlightContext';
-import {
- SortableTableHeader,
- Table,
- TableBody,
- TableCell,
- TableRow,
-} from 'component/common/Table';
-import { useGlobalFilter, useSortBy, useTable } from 'react-table';
-import { sortTypes } from 'utils/sortTypes';
-import { IconCell } from 'component/common/Table/cells/IconCell/IconCell';
-import { LinkCell } from 'component/common/Table/cells/LinkCell/LinkCell';
-import { ApplicationUsageCell } from './ApplicationUsageCell/ApplicationUsageCell';
-import { ApplicationSchema } from 'openapi';
-
-export const ApplicationList = () => {
- const { applications: data, loading } = useApplications();
-
- const renderNoApplications = () => (
- <>
-
-
-
- Oh snap, it does not seem like you have connected any
- applications. To connect your application to Unleash you will
- require a Client SDK.
-
-
- You can read more about how to use Unleash in your application
- in the{' '}
-
- documentation.
-
-
- >
- );
-
- const initialState = useMemo(
- () => ({
- sortBy: [{ id: 'name', desc: false }],
- hiddenColumns: ['description', 'sortOrder'],
- }),
- [],
- );
-
- const columns = useMemo(
- () => [
- {
- id: 'Icon',
- Cell: ({
- row: {
- original: { icon },
- },
- }: any) => (
-
- {icon || 'apps'}
-
- }
- />
- ),
- disableGlobalFilter: true,
- },
- {
- Header: 'Name',
- accessor: 'appName',
- width: '50%',
- Cell: ({
- row: {
- original: { appName, description },
- },
- }: any) => (
-
- ),
- sortType: 'alphanumeric',
- },
- {
- Header: 'Project(environment)',
- accessor: 'usage',
- width: '50%',
- Cell: ({
- row: { original },
- }: {
- row: { original: ApplicationSchema };
- }) => ,
- sortType: 'alphanumeric',
- },
- {
- accessor: 'description',
- disableSortBy: true,
- },
- {
- accessor: 'sortOrder',
- disableGlobalFilter: true,
- sortType: 'number',
- },
- ],
- [],
- );
-
- const {
- getTableProps,
- getTableBodyProps,
- headerGroups,
- rows,
- prepareRow,
- state: { globalFilter },
- setGlobalFilter,
- } = useTable(
- {
- columns: columns as any[], // TODO: fix after `react-table` v8 update
- data,
- initialState,
- sortTypes,
- autoResetGlobalFilter: false,
- autoResetSortBy: false,
- disableSortRemove: true,
- },
- useGlobalFilter,
- useSortBy,
- );
-
- if (!data) {
- return ;
- }
-
- return (
- <>
-
- }
- />
- }
- >
-
-
0}
- show={
-
-
-
-
- {rows.map((row) => {
- prepareRow(row);
- return (
-
- {row.cells.map((cell) => (
-
- {cell.render(
- 'Cell',
- )}
-
- ))}
-
- );
- })}
-
-
-
- }
- elseShow={
- ...loading }
- elseShow={renderNoApplications()}
- />
- }
- />
-
-
- >
- );
-};
diff --git a/frontend/src/component/application/ApplicationList/PaginatedApplicationList.test.tsx b/frontend/src/component/application/ApplicationList/PaginatedApplicationList.test.tsx
index 86ad377c8f..9c510815da 100644
--- a/frontend/src/component/application/ApplicationList/PaginatedApplicationList.test.tsx
+++ b/frontend/src/component/application/ApplicationList/PaginatedApplicationList.test.tsx
@@ -28,9 +28,9 @@ test('Display applications list', async () => {
);
});
-test('Display no applications', async () => {
+test('Display no applications connected', async () => {
setupApi([]);
render();
- await screen.findByText('Warning');
+ await screen.findByText(/To connect your application to Unleash/);
});
diff --git a/frontend/src/component/application/ApplicationList/PaginatedApplicationList.tsx b/frontend/src/component/application/ApplicationList/PaginatedApplicationList.tsx
index 4d09feb72e..e71e845046 100644
--- a/frontend/src/component/application/ApplicationList/PaginatedApplicationList.tsx
+++ b/frontend/src/component/application/ApplicationList/PaginatedApplicationList.tsx
@@ -1,6 +1,5 @@
import { useMemo } from 'react';
-import { Avatar, Icon, Link } from '@mui/material';
-import Warning from '@mui/icons-material/Warning';
+import { Avatar, Icon, Link, styled } from '@mui/material';
import { styles as themeStyles } from 'component/common';
import { PageContent } from 'component/common/PageContent/PageContent';
import { PageHeader } from 'component/common/PageHeader/PageHeader';
@@ -26,23 +25,34 @@ import { withTableState } from 'utils/withTableState';
import useLoading from 'hooks/useLoading';
import mapValues from 'lodash.mapvalues';
-const renderNoApplications = () => (
- <>
-
-
-
- Oh snap, it does not seem like you have connected any applications.
- To connect your application to Unleash you will require a Client
- SDK.
-
+const InfoMessage = styled('div')(({ theme }) => ({
+ textAlign: 'center',
+ padding: theme.spacing(9, 0, 9, 0),
+ minHeight: '150px',
+}));
+
+const renderNoResults = (query: string | null | undefined) => {
+ if (typeof query === 'string' && query.length > 0) {
+ return renderNoMatchingSearch(query);
+ }
+ return (
+
+ You don't have have any connected applications. To connect your
+ application to Unleash you will require a{' '}
+ Client SDK
+ .
You can read more about how to use Unleash in your application in
the{' '}
documentation.
-
- >
+
+ );
+};
+
+const renderNoMatchingSearch = (query: string) => (
+ No application found matching "{query}"
);
const columnHelper = createColumnHelper();
@@ -125,8 +135,6 @@ export const PaginatedApplicationList = () => {
}),
);
- const rows = table.getRowModel().rows;
-
const { offset, limit, query, sortBy, sortOrder, ...filterState } =
tableState;
@@ -165,7 +173,7 @@ export const PaginatedApplicationList = () => {
}
- elseShow={renderNoApplications()}
+ elseShow={renderNoResults(query)}
/>