From eee9b5ac8947f4918b7818fb0402f9f31dade4e6 Mon Sep 17 00:00:00 2001 From: djamaile Date: Thu, 20 Oct 2022 10:18:44 +0200 Subject: [PATCH] chore: drop initialGroup prop Signed-off-by: djamaile --- plugins/org-react/README.md | 3 +- .../GroupListPicker/GroupListPicker.test.tsx | 16 -------- .../GroupListPicker/GroupListPicker.tsx | 5 +-- plugins/org-react/src/index.ts | 2 +- plugins/org-react/src/plugin.test.ts | 22 ----------- plugins/org-react/src/plugin.ts | 39 ------------------- 6 files changed, 4 insertions(+), 83 deletions(-) delete mode 100644 plugins/org-react/src/plugin.test.ts delete mode 100644 plugins/org-react/src/plugin.ts diff --git a/plugins/org-react/README.md b/plugins/org-react/README.md index 134a26d03c..832e41bddd 100644 --- a/plugins/org-react/README.md +++ b/plugins/org-react/README.md @@ -18,7 +18,7 @@ To use the `GroupListPicker` component you'll need to import it and add it to yo -+ ++ ``` @@ -26,6 +26,5 @@ To use the `GroupListPicker` component you'll need to import it and add it to yo The `GroupListPicker` comes with three optional props: - `groupTypes`: gives the user the option which group types the component should load. If no value is provided all group types will be loaded in; -- `initialGroup`: which group by default should be selected. For example, a group of the logged in user; - `placeholder`: the placeholder that the select box in the component should display. This might be helpful in informing your users what the functionality of the component is. - `onChange`: a prop to help the user to give access to the selected group diff --git a/plugins/org-react/src/components/GroupListPicker/GroupListPicker.test.tsx b/plugins/org-react/src/components/GroupListPicker/GroupListPicker.test.tsx index 06d06d3b85..a011e35333 100644 --- a/plugins/org-react/src/components/GroupListPicker/GroupListPicker.test.tsx +++ b/plugins/org-react/src/components/GroupListPicker/GroupListPicker.test.tsx @@ -63,28 +63,12 @@ const mockCatalogApi = { const apis = TestApiRegistry.from([catalogApiRef, mockCatalogApi]); describe('', () => { - it('renders group list picker', () => { - const { queryByText } = render( - - {}} - /> - , - ); - - expect(queryByText('test')).toBeInTheDocument(); - }); - it('can choose a group', async () => { const { getByText, queryByText, getByTestId } = render( {}} /> , diff --git a/plugins/org-react/src/components/GroupListPicker/GroupListPicker.tsx b/plugins/org-react/src/components/GroupListPicker/GroupListPicker.tsx index f0d0efb454..f08565fbfa 100644 --- a/plugins/org-react/src/components/GroupListPicker/GroupListPicker.tsx +++ b/plugins/org-react/src/components/GroupListPicker/GroupListPicker.tsx @@ -36,7 +36,6 @@ import { GroupListPickerButton } from './GroupListPickerButton'; export type GroupListPickerProps = { placeholder?: string; groupTypes?: Array; - initialGroup?: string | undefined; onChange: (value: GroupEntity | undefined) => void; }; @@ -44,7 +43,7 @@ export type GroupListPickerProps = { export const GroupListPicker = (props: GroupListPickerProps) => { const catalogApi = useApi(catalogApiRef); - const { onChange, groupTypes, initialGroup, placeholder = '' } = props; + const { onChange, groupTypes, placeholder = '' } = props; const [anchorEl, setAnchorEl] = React.useState(null); const [inputValue, setInputValue] = React.useState(''); @@ -116,7 +115,7 @@ export const GroupListPicker = (props: GroupListPickerProps) => { )} /> - + ); }; diff --git a/plugins/org-react/src/index.ts b/plugins/org-react/src/index.ts index 731702c80c..c3393bee48 100644 --- a/plugins/org-react/src/index.ts +++ b/plugins/org-react/src/index.ts @@ -13,5 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export { GroupListPicker } from './plugin'; +export { GroupListPicker } from './components/GroupListPicker'; export type { GroupListPickerProps } from './components/GroupListPicker'; diff --git a/plugins/org-react/src/plugin.test.ts b/plugins/org-react/src/plugin.test.ts deleted file mode 100644 index 4a9d976a89..0000000000 --- a/plugins/org-react/src/plugin.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2022 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { orgReactPlugin } from './plugin'; - -describe('org-react', () => { - it('should export plugin', () => { - expect(orgReactPlugin).toBeDefined(); - }); -}); diff --git a/plugins/org-react/src/plugin.ts b/plugins/org-react/src/plugin.ts deleted file mode 100644 index 8be5c11a4f..0000000000 --- a/plugins/org-react/src/plugin.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2022 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { - createComponentExtension, - createPlugin, -} from '@backstage/core-plugin-api'; - -import { rootRouteRef } from './routes'; - -export const orgReactPlugin = createPlugin({ - id: 'org-react', - routes: { - root: rootRouteRef, - }, -}); - -/** @public */ -export const GroupListPicker = orgReactPlugin.provide( - createComponentExtension({ - name: 'GroupListPicker', - component: { - lazy: () => - import('./components/GroupListPicker').then(m => m.GroupListPicker), - }, - }), -);