Renamed picker
Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
'@backstage/plugin-catalog-react': patch
|
||||
---
|
||||
|
||||
Added new `EntityAdvancedPicker` that will filter for entities with orphans and/or errors.
|
||||
Added new `EntityProcessingStatusPicker` that will filter for entities with orphans and/or errors.
|
||||
|
||||
If you are using the default Catalog page this picker will be added automatically. For those who have customized their Catalog page you'll need to add this manually by doing something like this:
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
EntityTypePicker,
|
||||
UserListPicker,
|
||||
EntityTagPicker
|
||||
+ EntityAdvancedPicker,
|
||||
+ EntityProcessingStatusPicker,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
...
|
||||
export const CustomCatalogPage = ({
|
||||
@@ -31,7 +31,7 @@ export const CustomCatalogPage = ({
|
||||
<EntityTypePicker />
|
||||
<UserListPicker initialFilter={initiallySelectedFilter} />
|
||||
<EntityTagPicker />
|
||||
+ <EntityAdvancedPicker />
|
||||
+ <EntityProcessingStatusPicker />
|
||||
<CatalogFilterLayout.Filters>
|
||||
<CatalogFilterLayout.Content>
|
||||
<CatalogTable columns={columns} actions={actions} />
|
||||
|
||||
@@ -78,18 +78,18 @@ export type CatalogReactComponentsNameToClassKey = {
|
||||
CatalogReactEntitySearchBar: CatalogReactEntitySearchBarClassKey;
|
||||
CatalogReactEntityTagPicker: CatalogReactEntityTagPickerClassKey;
|
||||
CatalogReactEntityOwnerPicker: CatalogReactEntityOwnerPickerClassKey;
|
||||
CatalogReactEntityAdvancedPicker: CatalogReactEntityAdvancedPickerClassKey;
|
||||
CatalogReactEntityProcessingStatusPicker: CatalogReactEntityProcessingStatusPickerClassKey;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type CatalogReactEntityAdvancedPickerClassKey = 'input';
|
||||
|
||||
// @public (undocumented)
|
||||
export type CatalogReactEntityLifecyclePickerClassKey = 'input';
|
||||
|
||||
// @public (undocumented)
|
||||
export type CatalogReactEntityOwnerPickerClassKey = 'input';
|
||||
|
||||
// @public (undocumented)
|
||||
export type CatalogReactEntityProcessingStatusPickerClassKey = 'input';
|
||||
|
||||
// @public (undocumented)
|
||||
export type CatalogReactEntitySearchBarClassKey = 'searchToolbar' | 'input';
|
||||
|
||||
@@ -145,9 +145,6 @@ export type DefaultEntityFilters = {
|
||||
error?: EntityErrorFilter;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export const EntityAdvancedPicker: () => JSX.Element;
|
||||
|
||||
// @public
|
||||
export class EntityErrorFilter implements EntityFilter {
|
||||
constructor(value: boolean);
|
||||
@@ -263,6 +260,9 @@ export class EntityOwnerFilter implements EntityFilter {
|
||||
// @public (undocumented)
|
||||
export const EntityOwnerPicker: () => JSX.Element | null;
|
||||
|
||||
// @public (undocumented)
|
||||
export const EntityProcessingStatusPicker: () => JSX.Element;
|
||||
|
||||
// @public
|
||||
export const EntityProvider: (props: EntityProviderProps) => JSX.Element;
|
||||
|
||||
|
||||
+14
-14
@@ -19,7 +19,7 @@ import { fireEvent, render } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { EntityErrorFilter, EntityOrphanFilter } from '../../filters';
|
||||
import { MockEntityListContextProvider } from '../../testUtils/providers';
|
||||
import { EntityAdvancedPicker } from './EntityAdvancedPicker';
|
||||
import { EntityProcessingStatusPicker } from './EntityProcessingStatusPicker';
|
||||
|
||||
const orphanAnnotation: Record<string, string> = {};
|
||||
orphanAnnotation['backstage.io/orphan'] = 'true';
|
||||
@@ -50,18 +50,18 @@ const sampleEntities: Entity[] = [
|
||||
},
|
||||
];
|
||||
|
||||
describe('<EntityAdvancedPicker/>', () => {
|
||||
it('renders all advanced options', () => {
|
||||
describe('<EntityProcessingStatusPicker/>', () => {
|
||||
it('renders all processing status options', () => {
|
||||
const rendered = render(
|
||||
<MockEntityListContextProvider
|
||||
value={{ entities: sampleEntities, backendEntities: sampleEntities }}
|
||||
>
|
||||
<EntityAdvancedPicker />
|
||||
<EntityProcessingStatusPicker />
|
||||
</MockEntityListContextProvider>,
|
||||
);
|
||||
expect(rendered.getByText('Advanced')).toBeInTheDocument();
|
||||
expect(rendered.getByText('Processing Status')).toBeInTheDocument();
|
||||
|
||||
fireEvent.click(rendered.getByTestId('advanced-picker-expand'));
|
||||
fireEvent.click(rendered.getByTestId('processing-status-picker-expand'));
|
||||
expect(rendered.getByText('Is Orphan')).toBeInTheDocument();
|
||||
expect(rendered.getByText('Has Error')).toBeInTheDocument();
|
||||
});
|
||||
@@ -76,11 +76,11 @@ describe('<EntityAdvancedPicker/>', () => {
|
||||
updateFilters,
|
||||
}}
|
||||
>
|
||||
<EntityAdvancedPicker />
|
||||
<EntityProcessingStatusPicker />
|
||||
</MockEntityListContextProvider>,
|
||||
);
|
||||
|
||||
fireEvent.click(rendered.getByTestId('advanced-picker-expand'));
|
||||
fireEvent.click(rendered.getByTestId('processing-status-picker-expand'));
|
||||
fireEvent.click(rendered.getByText('Is Orphan'));
|
||||
expect(updateFilters).toHaveBeenCalledWith({
|
||||
orphan: new EntityOrphanFilter(true),
|
||||
@@ -97,11 +97,11 @@ describe('<EntityAdvancedPicker/>', () => {
|
||||
updateFilters,
|
||||
}}
|
||||
>
|
||||
<EntityAdvancedPicker />
|
||||
<EntityProcessingStatusPicker />
|
||||
</MockEntityListContextProvider>,
|
||||
);
|
||||
|
||||
fireEvent.click(rendered.getByTestId('advanced-picker-expand'));
|
||||
fireEvent.click(rendered.getByTestId('processing-status-picker-expand'));
|
||||
fireEvent.click(rendered.getByText('Has Error'));
|
||||
expect(updateFilters).toHaveBeenCalledWith({
|
||||
error: new EntityErrorFilter(true),
|
||||
@@ -118,11 +118,11 @@ describe('<EntityAdvancedPicker/>', () => {
|
||||
updateFilters,
|
||||
}}
|
||||
>
|
||||
<EntityAdvancedPicker />
|
||||
<EntityProcessingStatusPicker />
|
||||
</MockEntityListContextProvider>,
|
||||
);
|
||||
|
||||
fireEvent.click(rendered.getByTestId('advanced-picker-expand'));
|
||||
fireEvent.click(rendered.getByTestId('processing-status-picker-expand'));
|
||||
fireEvent.click(rendered.getByText('Is Orphan'));
|
||||
expect(updateFilters).toHaveBeenCalledWith({
|
||||
orphan: undefined,
|
||||
@@ -139,11 +139,11 @@ describe('<EntityAdvancedPicker/>', () => {
|
||||
updateFilters,
|
||||
}}
|
||||
>
|
||||
<EntityAdvancedPicker />
|
||||
<EntityProcessingStatusPicker />
|
||||
</MockEntityListContextProvider>,
|
||||
);
|
||||
|
||||
fireEvent.click(rendered.getByTestId('advanced-picker-expand'));
|
||||
fireEvent.click(rendered.getByTestId('processing-status-picker-expand'));
|
||||
fireEvent.click(rendered.getByText('Has Error'));
|
||||
expect(updateFilters).toHaveBeenCalledWith({
|
||||
error: undefined,
|
||||
+7
-5
@@ -31,14 +31,14 @@ import { useEntityList } from '../../hooks';
|
||||
import { Autocomplete } from '@material-ui/lab';
|
||||
|
||||
/** @public */
|
||||
export type CatalogReactEntityAdvancedPickerClassKey = 'input';
|
||||
export type CatalogReactEntityProcessingStatusPickerClassKey = 'input';
|
||||
|
||||
const useStyles = makeStyles(
|
||||
{
|
||||
input: {},
|
||||
},
|
||||
{
|
||||
name: 'CatalogReactEntityAdvancedPicker',
|
||||
name: 'CatalogReactEntityProcessingStatusPickerPicker',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -46,7 +46,7 @@ const icon = <CheckBoxOutlineBlankIcon fontSize="small" />;
|
||||
const checkedIcon = <CheckBoxIcon fontSize="small" />;
|
||||
|
||||
/** @public */
|
||||
export const EntityAdvancedPicker = () => {
|
||||
export const EntityProcessingStatusPicker = () => {
|
||||
const classes = useStyles();
|
||||
const { updateFilters } = useEntityList();
|
||||
|
||||
@@ -71,7 +71,7 @@ export const EntityAdvancedPicker = () => {
|
||||
return (
|
||||
<Box pb={1} pt={1}>
|
||||
<Typography variant="button" component="label">
|
||||
Advanced
|
||||
Processing Status
|
||||
<Autocomplete
|
||||
multiple
|
||||
options={availableAdvancedItems}
|
||||
@@ -94,7 +94,9 @@ export const EntityAdvancedPicker = () => {
|
||||
/>
|
||||
)}
|
||||
size="small"
|
||||
popupIcon={<ExpandMoreIcon data-testid="advanced-picker-expand" />}
|
||||
popupIcon={
|
||||
<ExpandMoreIcon data-testid="processing-status-picker-expand" />
|
||||
}
|
||||
renderInput={params => (
|
||||
<TextField
|
||||
{...params}
|
||||
+2
-2
@@ -13,5 +13,5 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export { EntityAdvancedPicker } from './EntityAdvancedPicker';
|
||||
export type { CatalogReactEntityAdvancedPickerClassKey } from './EntityAdvancedPicker';
|
||||
export { EntityProcessingStatusPicker as EntityProcessingStatusPicker } from './EntityProcessingStatusPicker';
|
||||
export type { CatalogReactEntityProcessingStatusPickerClassKey } from './EntityProcessingStatusPicker';
|
||||
@@ -27,4 +27,4 @@ export * from './FavoriteEntity';
|
||||
export * from './InspectEntityDialog';
|
||||
export * from './UnregisterEntityDialog';
|
||||
export * from './UserListPicker';
|
||||
export * from './EntityAdvancedPicker';
|
||||
export * from './EntityProcessingStatusPicker';
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
CatalogReactEntitySearchBarClassKey,
|
||||
CatalogReactEntityTagPickerClassKey,
|
||||
CatalogReactEntityOwnerPickerClassKey,
|
||||
CatalogReactEntityAdvancedPickerClassKey,
|
||||
CatalogReactEntityProcessingStatusPickerClassKey,
|
||||
} from './components';
|
||||
|
||||
/** @public */
|
||||
@@ -32,7 +32,7 @@ export type CatalogReactComponentsNameToClassKey = {
|
||||
CatalogReactEntitySearchBar: CatalogReactEntitySearchBarClassKey;
|
||||
CatalogReactEntityTagPicker: CatalogReactEntityTagPickerClassKey;
|
||||
CatalogReactEntityOwnerPicker: CatalogReactEntityOwnerPickerClassKey;
|
||||
CatalogReactEntityAdvancedPicker: CatalogReactEntityAdvancedPickerClassKey;
|
||||
CatalogReactEntityProcessingStatusPicker: CatalogReactEntityProcessingStatusPickerClassKey;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
CatalogFilterLayout,
|
||||
EntityLifecyclePicker,
|
||||
EntityListProvider,
|
||||
EntityAdvancedPicker,
|
||||
EntityProcessingStatusPicker,
|
||||
EntityOwnerPicker,
|
||||
EntityTagPicker,
|
||||
EntityTypePicker,
|
||||
@@ -85,7 +85,7 @@ export function DefaultCatalogPage(props: DefaultCatalogPageProps) {
|
||||
<EntityOwnerPicker />
|
||||
<EntityLifecyclePicker />
|
||||
<EntityTagPicker />
|
||||
<EntityAdvancedPicker />
|
||||
<EntityProcessingStatusPicker />
|
||||
</CatalogFilterLayout.Filters>
|
||||
<CatalogFilterLayout.Content>
|
||||
<CatalogTable
|
||||
|
||||
Reference in New Issue
Block a user