[DRAFT] Drawer Filters

Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
This commit is contained in:
Philipp Hugenroth
2021-07-13 20:33:33 +02:00
parent 45b5fc3a83
commit 2934eb3a50
14 changed files with 269 additions and 164 deletions
@@ -14,29 +14,10 @@
* limitations under the License.
*/
import { TableColumn, TablePage } from '@backstage/core-components';
import { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';
import {
CatalogFilter,
CatalogTable,
CatalogTableRow,
} from '@backstage/plugin-catalog';
import {
EntityListProvider,
UserListFilterKind,
} from '@backstage/plugin-catalog-react';
import { TableColumn } from '@backstage/core-components';
import { CatalogTableRow } from '@backstage/plugin-catalog';
import { UserListFilterKind } from '@backstage/plugin-catalog-react';
import React from 'react';
import { createComponentRouteRef } from '../../routes';
const defaultColumns: TableColumn<CatalogTableRow>[] = [
CatalogTable.columns.createNameColumn({ defaultKind: 'API' }),
CatalogTable.columns.createSystemColumn(),
CatalogTable.columns.createOwnerColumn(),
CatalogTable.columns.createSpecTypeColumn(),
CatalogTable.columns.createSpecLifecycleColumn(),
CatalogTable.columns.createMetadataDescriptionColumn(),
CatalogTable.columns.createTagsColumn(),
];
interface IApiExplorerePageFilterProps {
initiallySelectedFilter?: UserListFilterKind;
@@ -46,36 +27,6 @@ export type ApiExplorerPageProps = IApiExplorerePageFilterProps & {
columns?: TableColumn<CatalogTableRow>[];
};
export const ApiExplorerPage = ({
initiallySelectedFilter = 'all',
columns,
}: ApiExplorerPageProps) => {
const createComponentLink = useRouteRef(createComponentRouteRef);
const configApi = useApi(configApiRef);
const generatedSubtitle = `${
configApi.getOptionalString('organization.name') ?? 'Backstage'
} API Explorer`;
return (
<EntityListProvider>
<TablePage
title="APIs"
subtitle={generatedSubtitle}
pageTitleOverride="APIs"
themeId="apis"
contentTitle=""
contentLink={createComponentLink ? createComponentLink() : ''}
contentLinkText="Register Existing API"
supportMessage="All your APIs"
filter={
<CatalogFilter
initialFilter="api"
initiallySelectedFilter={initiallySelectedFilter}
/>
}
>
<CatalogTable columns={columns || defaultColumns} />
</TablePage>
</EntityListProvider>
);
};
export const ApiExplorerPage = ({}: ApiExplorerPageProps) => (
<div>Please revert me...</div>
);