From 63339d2692b550035fa26b7e680a03d66987acc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Fri, 28 Aug 2020 14:50:41 +0200 Subject: [PATCH] chore(register-component): just a few little tweaks --- .../RegisterComponentForm.test.tsx | 6 +++--- .../RegisterComponentForm/RegisterComponentForm.tsx | 10 +++++----- plugins/register-component/src/util/validate.ts | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.test.tsx b/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.test.tsx index e1226bbf32..bb7faabc9d 100644 --- a/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.test.tsx +++ b/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.test.tsx @@ -14,10 +14,10 @@ * limitations under the License. */ +import { cleanup, fireEvent, render } from '@testing-library/react'; import React from 'react'; -import { render, fireEvent, cleanup } from '@testing-library/react'; -import RegisterComponentForm, { Props } from './RegisterComponentForm'; import { act } from 'react-dom/test-utils'; +import RegisterComponentForm, { Props } from './RegisterComponentForm'; const setup = (props?: Partial) => { return { @@ -37,7 +37,7 @@ describe('RegisterComponentForm', () => { const { rendered } = setup(); expect( await rendered.findByText( - 'Enter the full path to the component.yaml file in GitHub, GitLab, Bitbucket or Azure to start tracking your component. For private repo provide authentication information via config.', + 'Enter the full path to the component.yaml file in GitHub, GitLab, Bitbucket or Azure to start tracking your component.', ), ).toBeInTheDocument(); diff --git a/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx b/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx index de3c54610d..1b84b79234 100644 --- a/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx +++ b/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx @@ -14,17 +14,17 @@ * limitations under the License. */ -import React, { FC } from 'react'; +import { BackstageTheme } from '@backstage/theme'; import { Button, FormControl, FormHelperText, - TextField, LinearProgress, + TextField, } from '@material-ui/core'; -import { useForm } from 'react-hook-form'; import { makeStyles } from '@material-ui/core/styles'; -import { BackstageTheme } from '@backstage/theme'; +import React, { FC } from 'react'; +import { useForm } from 'react-hook-form'; import { ComponentIdValidators } from '../../util/validate'; const useStyles = makeStyles(theme => ({ @@ -71,7 +71,7 @@ const RegisterComponentForm: FC = ({ onSubmit, submitting }) => { name="componentLocation" required margin="normal" - helperText="Enter the full path to the component.yaml file in GitHub, GitLab, Bitbucket or Azure to start tracking your component. For private repo provide authentication information via config." + helperText="Enter the full path to the component.yaml file in GitHub, GitLab, Bitbucket or Azure to start tracking your component." inputRef={register({ required: true, validate: ComponentIdValidators, diff --git a/plugins/register-component/src/util/validate.ts b/plugins/register-component/src/util/validate.ts index 8552872015..9afb5ebd97 100644 --- a/plugins/register-component/src/util/validate.ts +++ b/plugins/register-component/src/util/validate.ts @@ -19,6 +19,6 @@ export const ComponentIdValidators = { (typeof value === 'string' && value.match(/^https:\/\//) !== null) || 'Must start with https://.', yamlValidator: (value: any) => - (typeof value === 'string' && value.match(/.yaml/) !== null) || + (typeof value === 'string' && value.match(/\.yaml/) !== null) || "Must contain '.yaml'.", };