feat(catalog-import): make catalog import example paths customizable

Signed-off-by: Mikko Korhonen <mikko.korhonen@gmail.com>
This commit is contained in:
Mikko Korhonen
2022-01-13 11:07:43 +02:00
parent 581bed3512
commit 1bd29cd9ae
2 changed files with 14 additions and 7 deletions
@@ -20,7 +20,15 @@ import { Chip, Typography } from '@material-ui/core';
import React from 'react';
import { catalogImportApiRef } from '../../api';
export const ImportInfoCard = () => {
type Props = {
exampleLocationUrl?: string;
exampleRepositoryUrl?: string;
};
export const ImportInfoCard = ({
exampleLocationUrl = 'https://github.com/backstage/backstage/blob/master/catalog-info.yaml',
exampleRepositoryUrl = 'https://github.com/backstage/backstage',
}: Props) => {
const configApi = useApi(configApiRef);
const appTitle = configApi.getOptional('app.title') || 'Backstage';
const catalogImportApi = useApi(catalogImportApiRef);
@@ -45,10 +53,7 @@ export const ImportInfoCard = () => {
</Typography>
<Typography variant="h6">Link to an existing entity file</Typography>
<Typography variant="subtitle2" color="textSecondary" paragraph>
Example:{' '}
<code>
https://github.com/backstage/backstage/blob/master/catalog-info.yaml
</code>
Example: <code>{exampleLocationUrl}</code>
</Typography>
<Typography variant="body2" paragraph>
The wizard analyzes the file, previews the entities, and adds them to
@@ -61,7 +66,7 @@ export const ImportInfoCard = () => {
<Chip label="GitHub only" variant="outlined" size="small" />
</Typography>
<Typography variant="subtitle2" color="textSecondary" paragraph>
Example: <code>https://github.com/backstage/backstage</code>
Example: <code>{exampleRepositoryUrl}</code>
</Typography>
<Typography variant="body2" paragraph>
The wizard discovers all <code>{catalogFilename}</code> files in the
@@ -36,6 +36,7 @@ type Props = {
) => void;
disablePullRequest?: boolean;
analysisUrl?: string;
exampleLocationUrl?: string;
};
/**
@@ -49,6 +50,7 @@ export const StepInitAnalyzeUrl = ({
onAnalysis,
analysisUrl = '',
disablePullRequest = false,
exampleLocationUrl = 'https://github.com/backstage/backstage/blob/master/catalog-info.yaml',
}: Props) => {
const errorApi = useApi(errorApiRef);
const catalogImportApi = useApi(catalogImportApiRef);
@@ -138,7 +140,7 @@ export const StepInitAnalyzeUrl = ({
fullWidth
id="url"
label="Repository URL"
placeholder="https://github.com/backstage/backstage/blob/master/catalog-info.yaml"
placeholder={exampleLocationUrl}
helperText="Enter the full path to your entity file to start tracking your component"
margin="normal"
variant="outlined"