diff --git a/.changeset/dirty-buckets-flow.md b/.changeset/dirty-buckets-flow.md index c0f0f030e2..b76ab5d35c 100644 --- a/.changeset/dirty-buckets-flow.md +++ b/.changeset/dirty-buckets-flow.md @@ -2,4 +2,5 @@ '@backstage/plugin-catalog-import': patch --- -Omits the entity namespace from a generated entity when it has not be explicitly defined in the analyze-location result. +This updates the `catalog-import` plugin to omit the default metadata namespace +field and also use the short form entity reference format for selected group owners. diff --git a/plugins/catalog-import/src/components/ImportStepper/defaults.tsx b/plugins/catalog-import/src/components/ImportStepper/defaults.tsx index f2dd1d62f4..5252b0aeae 100644 --- a/plugins/catalog-import/src/components/ImportStepper/defaults.tsx +++ b/plugins/catalog-import/src/components/ImportStepper/defaults.tsx @@ -230,7 +230,7 @@ export function defaultGenerateStepper( errorHelperText="required value" textFieldProps={{ label: 'Entity Owner', - placeholder: 'Group:default/my-group', + placeholder: 'my-group', }} rules={{ required: true }} required diff --git a/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.test.tsx b/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.test.tsx index 0f8df04968..606f9ff88e 100644 --- a/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.test.tsx +++ b/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.test.tsx @@ -286,7 +286,7 @@ spec: renderFormFieldsFn.mock.calls[ renderFormFieldsFn.mock.calls.length - 1 ][0], - ).toMatchObject({ groups: ['Group:my-group'], groupsLoading: false }); + ).toMatchObject({ groups: ['my-group'], groupsLoading: false }); }); describe('generateEntities', () => { diff --git a/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.tsx b/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.tsx index 0d08e27681..333df76026 100644 --- a/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.tsx +++ b/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.tsx @@ -14,9 +14,12 @@ * limitations under the License. */ -import { Entity, serializeEntityRef } from '@backstage/catalog-model'; +import { Entity } from '@backstage/catalog-model'; import { useApi } from '@backstage/core'; -import { catalogApiRef } from '@backstage/plugin-catalog-react'; +import { + catalogApiRef, + formatEntityRefTitle, +} from '@backstage/plugin-catalog-react'; import { Box, FormHelperText, Grid, Typography } from '@material-ui/core'; import { makeStyles } from '@material-ui/core/styles'; import React, { useCallback, useState } from 'react'; @@ -106,8 +109,9 @@ export const StepPrepareCreatePullRequest = ({ filter: { kind: 'group' }, }); - // TODO: defaultKind (=group), defaultNamespace (=same as entity) - return groupEntities.items.map(e => serializeEntityRef(e) as string).sort(); + return groupEntities.items + .map(e => formatEntityRefTitle(e, { defaultKind: 'group' })) + .sort(); }); const handleResult = useCallback(