Clean up Register plugin (#1291)

* Clean up Register plugin

* Fix test

* Update RegisterComponentPage.tsx
This commit is contained in:
Stefan Ålund
2020-06-16 09:53:44 +02:00
committed by GitHub
parent 2a3303a8fe
commit e1ea85cd93
3 changed files with 15 additions and 7 deletions
@@ -37,7 +37,7 @@ describe('RegisterComponentForm', () => {
const { rendered } = setup();
expect(
await rendered.findByText(
'Enter the full path to the service-info.yaml file in GitHub to start tracking your component. It must be in a public repo.',
'Enter the full path to the component.yaml file in GitHub to start tracking your component. It must be in a public repo.',
),
).toBeInTheDocument();
@@ -51,7 +51,7 @@ describe('RegisterComponentForm', () => {
await act(async () => {
// react-hook-form uses `input` event for changes
fireEvent.input(input, {
target: { value: 'https://example.com/blob/master/service.yaml' },
target: { value: 'https://example.com/blob/master/component.yaml' },
});
});
const submit = (await rendered.getByRole('button')) as HTMLButtonElement;
@@ -64,14 +64,14 @@ const RegisterComponentForm: FC<Props> = ({ onSubmit, submitting }) => {
<TextField
id="registerComponentInput"
variant="outlined"
label="Component service file URL"
label="Component file URL"
data-testid="componentLocationInput"
error={hasErrors}
placeholder="https://example.com/user/some-service/blob/master/service-info.yaml"
placeholder="https://example.com/user/some-service/blob/master/component.yaml"
name="componentLocation"
required
margin="normal"
helperText="Enter the full path to the service-info.yaml file in GitHub to start tracking your component. It must be in a public repo."
helperText="Enter the full path to the component.yaml file in GitHub to start tracking your component. It must be in a public repo."
inputRef={register({
required: true,
validate: ComponentIdValidators,
@@ -24,6 +24,8 @@ import {
useApi,
errorApiRef,
Header,
SupportButton,
ContentHeader,
} from '@backstage/core';
import RegisterComponentForm from '../RegisterComponentForm';
import { catalogApiRef } from '@backstage/plugin-catalog';
@@ -94,12 +96,18 @@ const RegisterComponentPage: FC<{}> = () => {
};
return (
<Page theme={pageTheme.tool}>
<Page theme={pageTheme.home}>
<Header title="Register existing component" />
<Content>
<ContentHeader title="Start tracking your component in Backstage">
<SupportButton>
Start tracking your component in Backstage. TODO: Add more
information about what this is.
</SupportButton>
</ContentHeader>
<Grid container spacing={3} direction="column">
<Grid item>
<InfoCard title="Start tracking your component in Backstage">
<InfoCard>
<RegisterComponentForm
onSubmit={handleSubmit}
submitting={formState === FormStates.Submitting}