@backstage/plugin-catalog-import 0.10.6-next.3 → 0.10.7-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # @backstage/plugin-catalog-import
2
2
 
3
+ ## 0.10.7-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 75f686b: Fixed an issue generating a wrong entity link at the end of the import process
8
+ - Updated dependencies
9
+ - @backstage/errors@1.2.4-next.0
10
+ - @backstage/core-components@0.14.1-next.0
11
+ - @backstage/integration-react@1.1.25-next.0
12
+ - @backstage/plugin-catalog-react@1.10.1-next.0
13
+ - @backstage/catalog-client@1.6.1-next.0
14
+ - @backstage/catalog-model@1.4.5-next.0
15
+ - @backstage/config@1.1.2-next.0
16
+ - @backstage/core-plugin-api@1.9.1-next.0
17
+ - @backstage/integration@1.9.1-next.0
18
+ - @backstage/frontend-plugin-api@0.6.1-next.0
19
+ - @backstage/core-compat-api@0.2.1-next.0
20
+ - @backstage/plugin-catalog-common@1.0.22-next.0
21
+
22
+ ## 0.10.6
23
+
24
+ ### Patch Changes
25
+
26
+ - 916da47: Change default icon for unknown entities to nothing instead of the help icon.
27
+ - 9aac2b0: Use `--cwd` as the first `yarn` argument
28
+ - 8fe56a8: Widen `@types/react` dependency range to include version 18.
29
+ - 1cae748: Updated dependency `git-url-parse` to `^14.0.0`.
30
+ - Updated dependencies
31
+ - @backstage/frontend-plugin-api@0.6.0
32
+ - @backstage/core-compat-api@0.2.0
33
+ - @backstage/plugin-catalog-react@1.10.0
34
+ - @backstage/core-components@0.14.0
35
+ - @backstage/catalog-model@1.4.4
36
+ - @backstage/integration@1.9.0
37
+ - @backstage/core-plugin-api@1.9.0
38
+ - @backstage/catalog-client@1.6.0
39
+ - @backstage/config@1.1.1
40
+ - @backstage/errors@1.2.3
41
+ - @backstage/integration-react@1.1.24
42
+ - @backstage/plugin-catalog-common@1.0.21
43
+
3
44
  ## 0.10.6-next.3
4
45
 
5
46
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-import",
3
- "version": "0.10.6-next.3",
3
+ "version": "0.10.7-next.0",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
package/dist/alpha.esm.js CHANGED
@@ -3,7 +3,7 @@ import { convertLegacyRouteRef, compatWrapper } from '@backstage/core-compat-api
3
3
  import { createPageExtension, createApiExtension, createPlugin } from '@backstage/frontend-plugin-api';
4
4
  import { scmAuthApiRef, scmIntegrationsApiRef } from '@backstage/integration-react';
5
5
  import React from 'react';
6
- import { r as rootRouteRef, a as catalogImportApiRef, b as CatalogImportClient } from './esm/plugin-5ca30662.esm.js';
6
+ import { r as rootRouteRef, a as catalogImportApiRef, b as CatalogImportClient } from './esm/plugin-0e18f6e1.esm.js';
7
7
  import { catalogApiRef } from '@backstage/plugin-catalog-react';
8
8
  import '@octokit/rest';
9
9
  import 'js-base64';
@@ -12,7 +12,7 @@ import 'git-url-parse';
12
12
  const catalogImportPage = createPageExtension({
13
13
  defaultPath: "/catalog-import",
14
14
  routeRef: convertLegacyRouteRef(rootRouteRef),
15
- loader: () => import('./esm/index-6cc6851a.esm.js').then(
15
+ loader: () => import('./esm/index-28367cb8.esm.js').then(
16
16
  (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ImportPage, null))
17
17
  )
18
18
  });
@@ -2,7 +2,7 @@ import { InfoCard, LinkButton, Link, CodeSnippet, MarkdownContent, Page, Header,
2
2
  import { useApi, configApiRef, useApp, useRouteRef, errorApiRef, useAnalytics } from '@backstage/core-plugin-api';
3
3
  import { Typography, Chip, Button, CircularProgress, List, ListItem, ListItemIcon, ListItemText, ListItemSecondaryAction, IconButton, Collapse, Grid, TextField, FormHelperText, Card, CardHeader, CardContent, Box, Checkbox, StepLabel, FormControlLabel, Stepper, Step, StepContent, useTheme, useMediaQuery } from '@material-ui/core';
4
4
  import React, { useReducer, useState, useCallback, useEffect, useMemo } from 'react';
5
- import { g as getCatalogFilename, a as catalogImportApiRef, d as asInputRef } from './plugin-5ca30662.esm.js';
5
+ import { g as getCatalogFilename, a as catalogImportApiRef, d as asInputRef } from './plugin-0e18f6e1.esm.js';
6
6
  import '@octokit/rest';
7
7
  import 'js-base64';
8
8
  import 'git-url-parse';
@@ -12,13 +12,13 @@ import { humanizeEntityRef, EntityRefLink, entityRouteRef, catalogApiRef } from
12
12
  import ExpandLessIcon from '@material-ui/icons/ExpandLess';
13
13
  import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
14
14
  import partition from 'lodash/partition';
15
+ import { DEFAULT_NAMESPACE, stringifyEntityRef } from '@backstage/catalog-model';
15
16
  import { useForm, Controller, FormProvider } from 'react-hook-form';
16
17
  import { Autocomplete } from '@material-ui/lab';
17
18
  import YAML from 'yaml';
18
19
  import { trimEnd } from 'lodash';
19
20
  import { assertError } from '@backstage/errors';
20
21
  import useAsync from 'react-use/lib/useAsync';
21
- import { stringifyEntityRef } from '@backstage/catalog-model';
22
22
 
23
23
  function useCatalogFilename() {
24
24
  const config = useApi(configApiRef);
@@ -273,12 +273,17 @@ const EntityListComponent = (props) => {
273
273
  };
274
274
 
275
275
  const filterComponentEntity = (newLocations) => {
276
+ var _a, _b;
276
277
  for (const location of newLocations) {
277
278
  for (const entity of location.entities) {
278
279
  if (["component", "api", "resource"].includes(
279
280
  entity.kind.toLocaleLowerCase("en-US")
280
281
  )) {
281
- return entity;
282
+ return {
283
+ kind: entity.kind.toLocaleLowerCase("en-US"),
284
+ namespace: (_b = (_a = entity.namespace) == null ? void 0 : _a.toLocaleLowerCase("en-US")) != null ? _b : DEFAULT_NAMESPACE,
285
+ name: entity.name
286
+ };
282
287
  }
283
288
  }
284
289
  }
@@ -1072,4 +1077,4 @@ const DefaultImportPage = () => {
1072
1077
  };
1073
1078
 
1074
1079
  export { AutocompleteTextField as A, DefaultImportPage as D, EntityListComponent as E, ImportInfoCard as I, PreparePullRequestForm as P, StepInitAnalyzeUrl as S, ImportStepper as a, PreviewCatalogInfoComponent as b, PreviewPullRequestComponent as c, defaultGenerateStepper as d, StepPrepareCreatePullRequest as e };
1075
- //# sourceMappingURL=DefaultImportPage-3d0141a5.esm.js.map
1080
+ //# sourceMappingURL=DefaultImportPage-010b17d2.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultImportPage-010b17d2.esm.js","sources":["../../src/hooks/useCatalogFilename.ts","../../src/components/ImportInfoCard/ImportInfoCard.tsx","../../src/components/useImportState.ts","../../src/components/Buttons/index.tsx","../../src/components/EntityListComponent/EntityListComponent.tsx","../../src/components/StepFinishImportLocation/StepFinishImportLocation.tsx","../../src/components/StepInitAnalyzeUrl/StepInitAnalyzeUrl.tsx","../../src/components/StepPrepareCreatePullRequest/AutocompleteTextField.tsx","../../src/components/StepPrepareCreatePullRequest/PreparePullRequestForm.tsx","../../src/components/StepPrepareCreatePullRequest/PreviewCatalogInfoComponent.tsx","../../src/components/StepPrepareCreatePullRequest/PreviewPullRequestComponent.tsx","../../src/components/StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.tsx","../../src/components/StepPrepareSelectLocations/StepPrepareSelectLocations.tsx","../../src/components/StepReviewLocation/StepReviewLocation.tsx","../../src/components/ImportStepper/defaults.tsx","../../src/components/ImportStepper/ImportStepper.tsx","../../src/components/DefaultImportPage/DefaultImportPage.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi, configApiRef } from '@backstage/core-plugin-api';\nimport { getCatalogFilename } from '../components/helpers';\n\nexport function useCatalogFilename(): string {\n const config = useApi(configApiRef);\n\n return getCatalogFilename(config);\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InfoCard } from '@backstage/core-components';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { Chip, Typography } from '@material-ui/core';\nimport React from 'react';\nimport { catalogImportApiRef } from '../../api';\nimport { useCatalogFilename } from '../../hooks';\n\n/**\n * Props for {@link ImportInfoCard}.\n *\n * @public\n */\nexport interface ImportInfoCardProps {\n exampleLocationUrl?: string;\n exampleRepositoryUrl?: string;\n}\n\n/**\n * Shows information about the import process.\n *\n * @public\n */\nexport const ImportInfoCard = (props: ImportInfoCardProps) => {\n const {\n exampleLocationUrl = 'https://github.com/backstage/backstage/blob/master/catalog-info.yaml',\n exampleRepositoryUrl = 'https://github.com/backstage/backstage',\n } = props;\n\n const configApi = useApi(configApiRef);\n const appTitle = configApi.getOptionalString('app.title') || 'Backstage';\n const catalogImportApi = useApi(catalogImportApiRef);\n\n const hasGithubIntegration = configApi.has('integrations.github');\n\n const catalogFilename = useCatalogFilename();\n\n return (\n <InfoCard\n title=\"Register an existing component\"\n titleTypographyProps={{ component: 'h3' }}\n deepLink={{\n title: 'Learn more about the Software Catalog',\n link: 'https://backstage.io/docs/features/software-catalog/',\n }}\n >\n <Typography variant=\"body2\" paragraph>\n Enter the URL to your source code repository to add it to {appTitle}.\n </Typography>\n <Typography component=\"h4\" variant=\"h6\">\n Link to an existing entity file\n </Typography>\n <Typography variant=\"subtitle2\" color=\"textSecondary\" paragraph>\n Example: <code>{exampleLocationUrl}</code>\n </Typography>\n <Typography variant=\"body2\" paragraph>\n The wizard analyzes the file, previews the entities, and adds them to\n the {appTitle} catalog.\n </Typography>\n {hasGithubIntegration && (\n <>\n <Typography component=\"h4\" variant=\"h6\">\n Link to a repository{' '}\n <Chip label=\"GitHub only\" variant=\"outlined\" size=\"small\" />\n </Typography>\n <Typography variant=\"subtitle2\" color=\"textSecondary\" paragraph>\n Example: <code>{exampleRepositoryUrl}</code>\n </Typography>\n <Typography variant=\"body2\" paragraph>\n The wizard discovers all <code>{catalogFilename}</code> files in the\n repository, previews the entities, and adds them to the {appTitle}{' '}\n catalog.\n </Typography>\n {catalogImportApi.preparePullRequest && (\n <Typography variant=\"body2\" paragraph>\n If no entities are found, the wizard will prepare a Pull Request\n that adds an example <code>{catalogFilename}</code> and prepares\n the {appTitle} catalog to load all entities as soon as the Pull\n Request is merged.\n </Typography>\n )}\n </>\n )}\n </InfoCard>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity, CompoundEntityRef } from '@backstage/catalog-model';\nimport { useReducer } from 'react';\nimport { AnalyzeResult } from '../api';\n\n/**\n * The configuration of the stepper.\n *\n * @public\n */\nexport type ImportFlows =\n | 'unknown'\n | 'single-location'\n | 'multiple-locations'\n | 'no-location';\n\n// the available states of the stepper\ntype ImportStateTypes = 'analyze' | 'prepare' | 'review' | 'finish';\n\n/**\n * Result of the prepare state.\n *\n * @public\n */\nexport type PrepareResult =\n | {\n type: 'locations';\n locations: Array<{\n exists?: boolean;\n target: string;\n entities: CompoundEntityRef[];\n }>;\n }\n | {\n type: 'repository';\n url: string;\n integrationType: string;\n pullRequest: {\n url: string;\n };\n locations: Array<{\n target: string;\n entities: CompoundEntityRef[];\n }>;\n };\n\n// result of the review result\nexport type ReviewResult =\n | {\n type: 'locations';\n locations: Array<{\n target: string;\n entities: Entity[];\n }>;\n refreshed: Array<{ target: string }>;\n }\n | {\n type: 'repository';\n url: string;\n integrationType: string;\n pullRequest: {\n url: string;\n };\n locations: Array<{\n target: string;\n entities: Entity[];\n }>;\n };\n\n// function type for the 'analysis' -> 'prepare'/'review' transition\ntype onAnalysisFn = (\n flow: ImportFlows,\n url: string,\n result: AnalyzeResult,\n opts?: { prepareResult?: PrepareResult },\n) => void;\n\n// function type for the 'prepare' -> 'review' transition\ntype onPrepareFn = (\n result: PrepareResult,\n opts?: { notRepeatable?: boolean },\n) => void;\n\n// function type for the 'review' -> 'finish' transition\ntype onReviewFn = (result: ReviewResult) => void;\n\n// the type interfaces that are available in each state. every state provides\n// already known information and means to go to the next, or the previous step.\ntype State =\n | {\n activeState: 'analyze';\n onAnalysis: onAnalysisFn;\n }\n | {\n activeState: 'prepare';\n analyzeResult: AnalyzeResult;\n prepareResult?: PrepareResult;\n onPrepare: onPrepareFn;\n }\n | {\n activeState: 'review';\n analyzeResult: AnalyzeResult;\n prepareResult: PrepareResult;\n onReview: onReviewFn;\n }\n | {\n activeState: 'finish';\n analyzeResult: AnalyzeResult;\n prepareResult: PrepareResult;\n reviewResult: ReviewResult;\n };\n\nexport type ImportState = State & {\n activeFlow: ImportFlows;\n activeStepNumber: number;\n analysisUrl?: string;\n\n onGoBack?: () => void;\n onReset: () => void;\n};\n\ntype ReducerActions =\n | { type: 'onAnalysis'; args: Parameters<onAnalysisFn> }\n | { type: 'onPrepare'; args: Parameters<onPrepareFn> }\n | { type: 'onReview'; args: Parameters<onReviewFn> }\n | { type: 'onGoBack' }\n | { type: 'onReset'; initialUrl?: string };\n\ntype ReducerState = {\n activeFlow: ImportFlows;\n activeState: ImportStateTypes;\n analysisUrl?: string;\n analyzeResult?: AnalyzeResult;\n prepareResult?: PrepareResult;\n reviewResult?: ReviewResult;\n\n previousStates: ImportStateTypes[];\n};\n\nfunction init(initialUrl?: string): ReducerState {\n return {\n activeFlow: 'unknown',\n activeState: 'analyze',\n analysisUrl: initialUrl,\n previousStates: [],\n };\n}\n\nfunction reducer(state: ReducerState, action: ReducerActions): ReducerState {\n switch (action.type) {\n case 'onAnalysis': {\n if (state.activeState !== 'analyze') {\n return state;\n }\n\n const { activeState, previousStates } = state;\n const [activeFlow, analysisUrl, analyzeResult, opts] = action.args;\n\n return {\n ...state,\n analysisUrl,\n activeFlow,\n analyzeResult,\n prepareResult: opts?.prepareResult,\n\n activeState: opts?.prepareResult === undefined ? 'prepare' : 'review',\n previousStates: previousStates.concat(activeState),\n };\n }\n\n case 'onPrepare': {\n if (state.activeState !== 'prepare') {\n return state;\n }\n\n const { activeState, previousStates } = state;\n const [prepareResult, opts] = action.args;\n\n return {\n ...state,\n prepareResult,\n\n activeState: 'review',\n previousStates: opts?.notRepeatable\n ? []\n : previousStates.concat(activeState),\n };\n }\n\n case 'onReview': {\n if (state.activeState !== 'review') {\n return state;\n }\n\n const { activeState, previousStates } = state;\n const [reviewResult] = action.args;\n\n return {\n ...state,\n reviewResult,\n\n activeState: 'finish',\n previousStates: previousStates.concat(activeState),\n };\n }\n\n case 'onGoBack': {\n const { activeState, previousStates } = state;\n\n return {\n ...state,\n\n activeState:\n previousStates.length > 0\n ? previousStates[previousStates.length - 1]\n : activeState,\n previousStates: previousStates.slice(0, previousStates.length - 1),\n };\n }\n\n case 'onReset':\n return {\n ...init(action.initialUrl),\n\n // we keep the old prepareResult since the form is animated and an\n // undefined value might crash the last step.\n prepareResult: state.prepareResult,\n };\n\n default:\n throw new Error();\n }\n}\n\n/**\n * A hook that manages the state machine of the form. It handles different flows\n * which each can implement up to four states:\n * 1. analyze\n * 2. preview (skippable from analyze->review)\n * 3. review\n * 4. finish\n *\n * @param options - options\n */\nexport const useImportState = (options?: {\n initialUrl?: string;\n}): ImportState => {\n const [state, dispatch] = useReducer(reducer, options?.initialUrl, init);\n\n const { activeFlow, activeState, analysisUrl, previousStates } = state;\n\n return {\n activeFlow,\n activeState,\n activeStepNumber: ['analyze', 'prepare', 'review', 'finish'].indexOf(\n activeState,\n ),\n analysisUrl: analysisUrl,\n\n analyzeResult: state.analyzeResult!,\n prepareResult: state.prepareResult!,\n reviewResult: state.reviewResult!,\n\n onAnalysis: (flow, url, result, opts) =>\n dispatch({\n type: 'onAnalysis',\n args: [flow, url, result, opts],\n }),\n\n onPrepare: (result, opts) =>\n dispatch({\n type: 'onPrepare',\n args: [result, opts],\n }),\n\n onReview: result => dispatch({ type: 'onReview', args: [result] }),\n\n onGoBack:\n previousStates.length > 0\n ? () => dispatch({ type: 'onGoBack' })\n : undefined,\n\n onReset: () =>\n dispatch({ type: 'onReset', initialUrl: options?.initialUrl }),\n };\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LinkButton } from '@backstage/core-components';\nimport { Button, CircularProgress } from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { ComponentProps } from 'react';\n\nconst useStyles = makeStyles(theme => ({\n wrapper: {\n marginTop: theme.spacing(1),\n marginRight: theme.spacing(1),\n position: 'relative',\n },\n buttonProgress: {\n position: 'absolute',\n top: '50%',\n left: '50%',\n marginTop: -12,\n marginLeft: -12,\n },\n button: {\n marginTop: theme.spacing(1),\n marginRight: theme.spacing(1),\n },\n}));\n\nexport const NextButton = (\n props: ComponentProps<typeof Button> & { loading?: boolean },\n) => {\n const { loading, ...buttonProps } = props;\n const classes = useStyles();\n\n return (\n <div className={classes.wrapper}>\n <Button\n color=\"primary\"\n variant=\"contained\"\n {...buttonProps}\n disabled={props.disabled || props.loading}\n />\n {props.loading && (\n <CircularProgress size=\"1.5rem\" className={classes.buttonProgress} />\n )}\n {props.loading}\n </div>\n );\n};\n\nexport const BackButton = (props: ComponentProps<typeof Button>) => {\n const classes = useStyles();\n\n return (\n <Button variant=\"outlined\" className={classes.button} {...props}>\n {props.children || 'Back'}\n </Button>\n );\n};\n\nexport const ViewComponentButton = (\n props: ComponentProps<typeof LinkButton>,\n) => {\n const classes = useStyles();\n\n return (\n <LinkButton\n color=\"primary\"\n variant=\"contained\"\n className={classes.button}\n {...props}\n >\n {props.children}\n </LinkButton>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity, CompoundEntityRef } from '@backstage/catalog-model';\nimport { useApp } from '@backstage/core-plugin-api';\nimport {\n EntityRefLink,\n humanizeEntityRef,\n} from '@backstage/plugin-catalog-react';\nimport {\n Collapse,\n IconButton,\n List,\n ListItem,\n ListItemIcon,\n ListItemSecondaryAction,\n ListItemText,\n} from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ExpandLessIcon from '@material-ui/icons/ExpandLess';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport React, { useState } from 'react';\n\nconst useStyles = makeStyles(theme => ({\n nested: {\n paddingLeft: theme.spacing(4),\n },\n}));\n\nfunction sortEntities(entities: Array<CompoundEntityRef | Entity>) {\n return entities.sort((a, b) =>\n humanizeEntityRef(a).localeCompare(humanizeEntityRef(b)),\n );\n}\n\n/**\n * Props for {@link EntityListComponent}.\n *\n * @public\n */\nexport interface EntityListComponentProps {\n locations: Array<{\n target: string;\n entities: (Entity | CompoundEntityRef)[];\n }>;\n locationListItemIcon: (target: string) => React.ReactElement;\n collapsed?: boolean;\n firstListItem?: React.ReactElement;\n onItemClick?: (target: string) => void;\n withLinks?: boolean;\n}\n\n/**\n * Shows a result list of entities.\n *\n * @public\n */\nexport const EntityListComponent = (props: EntityListComponentProps) => {\n const {\n locations,\n collapsed = false,\n locationListItemIcon,\n onItemClick,\n firstListItem,\n withLinks = false,\n } = props;\n\n const app = useApp();\n const classes = useStyles();\n\n const [expandedUrls, setExpandedUrls] = useState<string[]>([]);\n\n const handleClick = (url: string) => {\n setExpandedUrls(urls =>\n urls.includes(url) ? urls.filter(u => u !== url) : urls.concat(url),\n );\n };\n\n return (\n <List>\n {firstListItem}\n {locations.map(r => (\n <React.Fragment key={r.target}>\n <ListItem\n dense\n button={Boolean(onItemClick) as any}\n onClick={() => onItemClick?.(r.target)}\n >\n <ListItemIcon>{locationListItemIcon(r.target)}</ListItemIcon>\n\n <ListItemText\n primary={r.target}\n secondary={`Entities: ${r.entities.length}`}\n />\n\n {collapsed && (\n <ListItemSecondaryAction>\n <IconButton edge=\"end\" onClick={() => handleClick(r.target)}>\n {expandedUrls.includes(r.target) ? (\n <ExpandLessIcon />\n ) : (\n <ExpandMoreIcon />\n )}\n </IconButton>\n </ListItemSecondaryAction>\n )}\n </ListItem>\n\n <Collapse\n in={!collapsed || expandedUrls.includes(r.target)}\n timeout=\"auto\"\n unmountOnExit\n >\n <List component=\"div\" disablePadding dense>\n {sortEntities(r.entities).map(entity => {\n const Icon = app.getSystemIcon(\n `kind:${entity.kind.toLocaleLowerCase('en-US')}`,\n );\n return (\n <ListItem\n key={humanizeEntityRef(entity)}\n className={classes.nested}\n {...(withLinks\n ? {\n component: EntityRefLink,\n entityRef: entity,\n button: withLinks as any,\n }\n : {})}\n >\n <ListItemIcon>{Icon && <Icon />}</ListItemIcon>\n <ListItemText primary={humanizeEntityRef(entity)} />\n </ListItem>\n );\n })}\n </List>\n </Collapse>\n </React.Fragment>\n ))}\n </List>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Grid, Typography } from '@material-ui/core';\nimport LocationOnIcon from '@material-ui/icons/LocationOn';\nimport React from 'react';\nimport { BackButton, ViewComponentButton } from '../Buttons';\nimport { EntityListComponent } from '../EntityListComponent';\nimport { PrepareResult } from '../useImportState';\nimport { Link } from '@backstage/core-components';\nimport partition from 'lodash/partition';\nimport { CompoundEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\ntype Props = {\n prepareResult: PrepareResult;\n onReset: () => void;\n};\n\n// Among the newly registered entities, return a software entity (e.g. Component, API, Resource)\nconst filterComponentEntity = (\n newLocations: Array<{\n exists?: boolean;\n target: string;\n entities: CompoundEntityRef[];\n }>,\n): CompoundEntityRef | null => {\n for (const location of newLocations) {\n for (const entity of location.entities) {\n if (\n ['component', 'api', 'resource'].includes(\n entity.kind.toLocaleLowerCase('en-US'),\n )\n ) {\n return {\n kind: entity.kind.toLocaleLowerCase('en-US'),\n namespace:\n entity.namespace?.toLocaleLowerCase('en-US') ?? DEFAULT_NAMESPACE,\n name: entity.name,\n };\n }\n }\n }\n\n return null;\n};\n\nexport const StepFinishImportLocation = ({ prepareResult, onReset }: Props) => {\n const entityRoute = useRouteRef(entityRouteRef);\n\n if (prepareResult.type === 'repository') {\n return (\n <>\n <Typography paragraph>\n The following Pull Request has been opened:{' '}\n <Link\n to={prepareResult.pullRequest.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {prepareResult.pullRequest.url}\n </Link>\n </Typography>\n <Typography paragraph>\n Your entities will be imported as soon as the Pull Request is merged.\n </Typography>\n <Grid container spacing={0}>\n <BackButton onClick={onReset}>Register another</BackButton>\n </Grid>\n ;\n </>\n );\n }\n\n const [existingLocations, newLocations] = partition(\n prepareResult.locations,\n l => l.exists,\n );\n const newComponentEntity = filterComponentEntity(newLocations);\n return (\n <>\n {newLocations.length > 0 && (\n <>\n <Typography>\n The following entities have been added to the catalog:\n </Typography>\n\n <EntityListComponent\n locations={newLocations}\n locationListItemIcon={() => <LocationOnIcon />}\n withLinks\n />\n </>\n )}\n {existingLocations.length > 0 && (\n <>\n <Typography>\n A refresh was triggered for the following locations:\n </Typography>\n\n <EntityListComponent\n locations={existingLocations}\n locationListItemIcon={() => <LocationOnIcon />}\n withLinks\n />\n </>\n )}\n <Grid container spacing={0}>\n {newComponentEntity && (\n <ViewComponentButton to={entityRoute(newComponentEntity)}>\n View Component\n </ViewComponentButton>\n )}\n <BackButton onClick={onReset}>Register another</BackButton>\n </Grid>\n </>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { FormHelperText, Grid, TextField } from '@material-ui/core';\nimport React, { useCallback, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { AnalyzeResult, catalogImportApiRef } from '../../api';\nimport { NextButton } from '../Buttons';\nimport { asInputRef } from '../helpers';\nimport { ImportFlows, PrepareResult } from '../useImportState';\n\ntype FormData = {\n url: string;\n};\n\n/**\n * Props for {@link StepInitAnalyzeUrl}.\n *\n * @public\n */\nexport interface StepInitAnalyzeUrlProps {\n onAnalysis: (\n flow: ImportFlows,\n url: string,\n result: AnalyzeResult,\n opts?: { prepareResult?: PrepareResult },\n ) => void;\n disablePullRequest?: boolean;\n analysisUrl?: string;\n exampleLocationUrl?: string;\n}\n\n/**\n * A form that lets the user input a url and analyze it for existing locations or potential entities.\n *\n * @param onAnalysis - is called when the analysis was successful\n * @param analysisUrl - a url that can be used as a default value\n * @param disablePullRequest - if true, repositories without entities will abort the wizard\n * @public\n */\nexport const StepInitAnalyzeUrl = (props: StepInitAnalyzeUrlProps) => {\n const {\n onAnalysis,\n analysisUrl = '',\n disablePullRequest = false,\n exampleLocationUrl = 'https://github.com/backstage/backstage/blob/master/catalog-info.yaml',\n } = props;\n\n const errorApi = useApi(errorApiRef);\n const catalogImportApi = useApi(catalogImportApiRef);\n\n const {\n register,\n handleSubmit,\n formState: { errors },\n watch,\n } = useForm<FormData>({\n mode: 'onTouched',\n defaultValues: {\n url: analysisUrl,\n },\n });\n\n const [submitted, setSubmitted] = useState(false);\n const [error, setError] = useState<string | undefined>(undefined);\n\n const handleResult = useCallback(\n async ({ url }: FormData) => {\n setSubmitted(true);\n\n try {\n const analysisResult = await catalogImportApi.analyzeUrl(url);\n\n switch (analysisResult.type) {\n case 'repository':\n if (\n !disablePullRequest &&\n analysisResult.generatedEntities.length > 0\n ) {\n onAnalysis('no-location', url, analysisResult);\n } else {\n setError(\"Couldn't generate entities for your repository\");\n setSubmitted(false);\n }\n break;\n\n case 'locations': {\n if (analysisResult.locations.length === 1) {\n onAnalysis('single-location', url, analysisResult, {\n prepareResult: analysisResult,\n });\n } else if (analysisResult.locations.length > 1) {\n onAnalysis('multiple-locations', url, analysisResult);\n } else {\n setError('There are no entities at this location');\n setSubmitted(false);\n }\n break;\n }\n\n default: {\n const err = `Received unknown analysis result of type ${\n (analysisResult as any).type\n }. Please contact the support team.`;\n setError(err);\n setSubmitted(false);\n\n errorApi.post(new Error(err));\n break;\n }\n }\n } catch (e: any) {\n setError(e?.data?.error?.message ?? e.message);\n setSubmitted(false);\n }\n },\n [catalogImportApi, disablePullRequest, errorApi, onAnalysis],\n );\n\n return (\n <form onSubmit={handleSubmit(handleResult)}>\n <TextField\n {...asInputRef(\n register('url', {\n required: true,\n validate: {\n httpsValidator: (value: any) =>\n (typeof value === 'string' &&\n value.match(/^http[s]?:\\/\\//) !== null) ||\n 'Must start with http:// or https://.',\n },\n }),\n )}\n fullWidth\n id=\"url\"\n label=\"URL\"\n placeholder={exampleLocationUrl}\n helperText=\"Enter the full path to your entity file to start tracking your component\"\n margin=\"normal\"\n variant=\"outlined\"\n error={Boolean(errors.url)}\n required\n />\n\n {errors.url && (\n <FormHelperText error>{errors.url.message}</FormHelperText>\n )}\n\n {error && <FormHelperText error>{error}</FormHelperText>}\n\n <Grid container spacing={0}>\n <NextButton\n disabled={Boolean(errors.url) || !watch('url')}\n loading={submitted}\n type=\"submit\"\n >\n Analyze\n </NextButton>\n </Grid>\n </form>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CircularProgress, TextField } from '@material-ui/core';\nimport { TextFieldProps } from '@material-ui/core/TextField/TextField';\nimport { Autocomplete } from '@material-ui/lab';\nimport React from 'react';\nimport { Controller, FieldErrors } from 'react-hook-form';\n\n/**\n * Props for {@link AutocompleteTextField}.\n *\n * @public\n */\nexport interface AutocompleteTextFieldProps<TFieldValue extends string> {\n name: TFieldValue;\n options: string[];\n required?: boolean;\n\n errors?: FieldErrors;\n rules?: React.ComponentProps<typeof Controller>['rules'];\n\n loading?: boolean;\n loadingText?: string;\n\n helperText?: React.ReactNode;\n errorHelperText?: string;\n\n textFieldProps?: Omit<TextFieldProps, 'required' | 'fullWidth'>;\n}\n\n/**\n * An autocompletion text field for the catalog import flows.\n *\n * @public\n */\nexport const AutocompleteTextField = <TFieldValue extends string>(\n props: AutocompleteTextFieldProps<TFieldValue>,\n) => {\n const {\n name,\n options,\n required,\n errors,\n rules,\n loading = false,\n loadingText,\n helperText,\n errorHelperText,\n textFieldProps = {},\n } = props;\n\n return (\n <Controller\n name={name}\n rules={rules}\n render={({ field: { onChange } }) => (\n <Autocomplete\n loading={loading}\n loadingText={loadingText}\n options={options || []}\n autoSelect\n freeSolo\n onChange={(_event: React.ChangeEvent<{}>, value: string | null) =>\n onChange(value)\n }\n renderInput={params => (\n <TextField\n {...params}\n helperText={(errors?.[name] && errorHelperText) || helperText}\n error={Boolean(errors?.[name])}\n margin=\"normal\"\n variant=\"outlined\"\n required={required}\n InputProps={{\n ...params.InputProps,\n endAdornment: (\n <React.Fragment>\n {loading ? (\n <CircularProgress color=\"inherit\" size=\"1em\" />\n ) : null}\n {params.InputProps.endAdornment}\n </React.Fragment>\n ),\n }}\n {...textFieldProps}\n />\n )}\n />\n )}\n />\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport {\n FormProvider,\n SubmitHandler,\n useForm,\n UseFormProps,\n UseFormReturn,\n} from 'react-hook-form';\n\n/**\n * Props for {@link PreparePullRequestForm}.\n *\n * @public\n */\nexport type PreparePullRequestFormProps<\n TFieldValues extends Record<string, any>,\n> = Pick<UseFormProps<TFieldValues>, 'defaultValues'> & {\n onSubmit: SubmitHandler<TFieldValues>;\n\n render: (\n props: Pick<\n UseFormReturn<TFieldValues>,\n 'formState' | 'register' | 'control' | 'setValue'\n > & {\n values: TFieldValues;\n },\n ) => React.ReactNode;\n};\n\n/**\n * A form wrapper that creates a form that is used to prepare a pull request. It\n * hosts the form logic.\n *\n * @param defaultValues - the default values of the form\n * @param onSubmit - a callback that is executed when the form is submitted\n * (initiated by a button of type=\"submit\")\n * @param render - render the form elements\n * @public\n */\nexport const PreparePullRequestForm = <\n TFieldValues extends Record<string, any>,\n>(\n props: PreparePullRequestFormProps<TFieldValues>,\n) => {\n const { defaultValues, onSubmit, render } = props;\n\n const methods = useForm<TFieldValues>({ mode: 'onTouched', defaultValues });\n const { handleSubmit, watch, control, register, formState, setValue } =\n methods;\n\n return (\n <FormProvider {...methods}>\n <form onSubmit={handleSubmit(onSubmit)}>\n {render({ values: watch(), formState, register, control, setValue })}\n </form>\n </FormProvider>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport { Card, CardContent, CardHeader } from '@material-ui/core';\nimport React from 'react';\nimport YAML from 'yaml';\nimport { CodeSnippet } from '@backstage/core-components';\nimport { trimEnd } from 'lodash';\nimport { useCatalogFilename } from '../../hooks';\n\n/**\n * Props for {@link PreviewCatalogInfoComponent}.\n *\n * @public\n */\nexport interface PreviewCatalogInfoComponentProps {\n repositoryUrl: string;\n entities: Entity[];\n classes?: { card?: string; cardContent?: string };\n}\n\n/**\n * Previews information about an entity to create.\n *\n * @public\n */\nexport const PreviewCatalogInfoComponent = (\n props: PreviewCatalogInfoComponentProps,\n) => {\n const { repositoryUrl, entities, classes } = props;\n const catalogFilename = useCatalogFilename();\n\n return (\n <Card variant=\"outlined\" className={classes?.card}>\n <CardHeader\n title={\n <code>{`${trimEnd(repositoryUrl, '/')}/${catalogFilename}`}</code>\n }\n />\n\n <CardContent className={classes?.cardContent}>\n <CodeSnippet\n text={entities\n .map(e => YAML.stringify(e))\n .join('---\\n')\n .trim()}\n language=\"yaml\"\n />\n </CardContent>\n </Card>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Card, CardContent, CardHeader } from '@material-ui/core';\nimport React from 'react';\nimport { MarkdownContent } from '@backstage/core-components';\n\n/**\n * Props for {@link PreviewPullRequestComponent}.\n *\n * @public\n */\nexport interface PreviewPullRequestComponentProps {\n title: string;\n description: string;\n classes?: { card?: string; cardContent?: string };\n}\n\n/**\n * Previews a pull request.\n *\n * @public\n */\nexport const PreviewPullRequestComponent = (\n props: PreviewPullRequestComponentProps,\n) => {\n const { title, description, classes } = props;\n return (\n <Card variant=\"outlined\" className={classes?.card}>\n <CardHeader title={title} subheader=\"Create a new Pull Request\" />\n <CardContent className={classes?.cardContent}>\n <MarkdownContent content={description} />\n </CardContent>\n </Card>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { assertError } from '@backstage/errors';\nimport {\n catalogApiRef,\n humanizeEntityRef,\n} from '@backstage/plugin-catalog-react';\nimport { Box, FormHelperText, Grid, Typography } from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport { UnpackNestedValue, UseFormReturn } from 'react-hook-form';\nimport useAsync from 'react-use/lib/useAsync';\nimport YAML from 'yaml';\nimport { AnalyzeResult, catalogImportApiRef } from '../../api';\nimport { useCatalogFilename } from '../../hooks';\nimport { PartialEntity } from '../../types';\nimport { BackButton, NextButton } from '../Buttons';\nimport { PrepareResult } from '../useImportState';\nimport { PreparePullRequestForm } from './PreparePullRequestForm';\nimport { PreviewCatalogInfoComponent } from './PreviewCatalogInfoComponent';\nimport { PreviewPullRequestComponent } from './PreviewPullRequestComponent';\n\nconst useStyles = makeStyles(theme => ({\n previewCard: {\n marginTop: theme.spacing(1),\n },\n previewCardContent: {\n paddingTop: 0,\n },\n}));\n\ntype FormData = {\n title: string;\n body: string;\n componentName: string;\n owner: string;\n useCodeowners: boolean;\n};\n\n/**\n * Props for {@link StepPrepareCreatePullRequest}.\n *\n * @public\n */\nexport interface StepPrepareCreatePullRequestProps {\n analyzeResult: Extract<AnalyzeResult, { type: 'repository' }>;\n onPrepare: (\n result: PrepareResult,\n opts?: { notRepeatable?: boolean },\n ) => void;\n onGoBack?: () => void;\n\n renderFormFields: (\n props: Pick<\n UseFormReturn<FormData>,\n 'register' | 'setValue' | 'formState'\n > & {\n values: UnpackNestedValue<FormData>;\n groups: string[];\n groupsLoading: boolean;\n },\n ) => React.ReactNode;\n}\n\nexport function generateEntities(\n entities: PartialEntity[],\n componentName: string,\n owner?: string,\n): Entity[] {\n return entities.map(e => ({\n ...e,\n apiVersion: e.apiVersion!,\n kind: e.kind!,\n metadata: {\n ...e.metadata,\n name: componentName,\n },\n spec: {\n ...e.spec,\n ...(owner ? { owner } : {}),\n },\n }));\n}\n\n/**\n * Prepares a pull request.\n *\n * @public\n */\nexport const StepPrepareCreatePullRequest = (\n props: StepPrepareCreatePullRequestProps,\n) => {\n const { analyzeResult, onPrepare, onGoBack, renderFormFields } = props;\n\n const classes = useStyles();\n const catalogApi = useApi(catalogApiRef);\n const catalogImportApi = useApi(catalogImportApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [submitted, setSubmitted] = useState(false);\n const [error, setError] = useState<string>();\n\n const catalogFilename = useCatalogFilename();\n\n const {\n loading: prDefaultsLoading,\n value: prDefaults,\n error: prDefaultsError,\n } = useAsync(\n () => catalogImportApi.preparePullRequest!(),\n [catalogImportApi.preparePullRequest],\n );\n\n useEffect(() => {\n if (prDefaultsError) {\n errorApi.post(prDefaultsError);\n }\n }, [prDefaultsError, errorApi]);\n\n const { loading: groupsLoading, value: groups } = useAsync(async () => {\n const groupEntities = await catalogApi.getEntities({\n filter: { kind: 'group' },\n });\n\n return groupEntities.items\n .map(e => humanizeEntityRef(e, { defaultKind: 'group' }))\n .sort();\n });\n\n const handleResult = useCallback(\n async (data: FormData) => {\n setSubmitted(true);\n\n try {\n const pr = await catalogImportApi.submitPullRequest({\n repositoryUrl: analyzeResult.url,\n title: data.title,\n body: data.body,\n fileContent: generateEntities(\n analyzeResult.generatedEntities,\n data.componentName,\n data.owner,\n )\n .map(e => YAML.stringify(e))\n .join('---\\n'),\n });\n\n onPrepare(\n {\n type: 'repository',\n url: analyzeResult.url,\n integrationType: analyzeResult.integrationType,\n pullRequest: {\n url: pr.link,\n },\n locations: [\n {\n target: pr.location,\n entities: generateEntities(\n analyzeResult.generatedEntities,\n data.componentName,\n data.owner,\n ).map(e => ({\n kind: e.kind,\n namespace: e.metadata.namespace!,\n name: e.metadata.name,\n })),\n },\n ],\n },\n { notRepeatable: true },\n );\n } catch (e) {\n assertError(e);\n setError(e.message);\n setSubmitted(false);\n }\n },\n [\n analyzeResult.generatedEntities,\n analyzeResult.integrationType,\n analyzeResult.url,\n catalogImportApi,\n onPrepare,\n ],\n );\n\n return (\n <>\n <Typography>\n You entered a link to a {analyzeResult.integrationType} repository but a{' '}\n <code>{catalogFilename}</code> could not be found. Use this form to open\n a Pull Request that creates one.\n </Typography>\n\n {!prDefaultsLoading && (\n <PreparePullRequestForm<FormData>\n onSubmit={handleResult}\n defaultValues={{\n title: prDefaults?.title ?? '',\n body: prDefaults?.body ?? '',\n owner:\n (analyzeResult.generatedEntities[0]?.spec?.owner as string) || '',\n componentName:\n analyzeResult.generatedEntities[0]?.metadata?.name || '',\n useCodeowners: false,\n }}\n render={({ values, formState, register, setValue }) => (\n <>\n {renderFormFields({\n values,\n formState,\n register,\n setValue,\n groups: groups ?? [],\n groupsLoading,\n })}\n\n <Box marginTop={2}>\n <Typography variant=\"h6\">Preview Pull Request</Typography>\n </Box>\n\n <PreviewPullRequestComponent\n title={values.title}\n description={values.body}\n classes={{\n card: classes.previewCard,\n cardContent: classes.previewCardContent,\n }}\n />\n\n <Box marginTop={2} marginBottom={1}>\n <Typography variant=\"h6\">Preview Entities</Typography>\n </Box>\n\n <PreviewCatalogInfoComponent\n entities={generateEntities(\n analyzeResult.generatedEntities,\n values.componentName,\n values.owner,\n )}\n repositoryUrl={analyzeResult.url}\n classes={{\n card: classes.previewCard,\n cardContent: classes.previewCardContent,\n }}\n />\n\n {error && <FormHelperText error>{error}</FormHelperText>}\n\n <Grid container spacing={0}>\n {onGoBack && (\n <BackButton onClick={onGoBack} disabled={submitted} />\n )}\n <NextButton\n type=\"submit\"\n disabled={Boolean(\n formState.errors.title ||\n formState.errors.body ||\n formState.errors.owner,\n )}\n loading={submitted}\n >\n Create PR\n </NextButton>\n </Grid>\n </>\n )}\n />\n )}\n </>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Checkbox,\n Grid,\n ListItem,\n ListItemIcon,\n ListItemText,\n Typography,\n} from '@material-ui/core';\nimport LocationOnIcon from '@material-ui/icons/LocationOn';\nimport React, { useCallback, useState } from 'react';\nimport { AnalyzeResult } from '../../api';\nimport { BackButton, NextButton } from '../Buttons';\nimport { EntityListComponent } from '../EntityListComponent';\nimport { PrepareResult } from '../useImportState';\nimport partition from 'lodash/partition';\n\ntype Props = {\n analyzeResult: Extract<AnalyzeResult, { type: 'locations' }>;\n prepareResult?: PrepareResult;\n onPrepare: (result: PrepareResult) => void;\n onGoBack?: () => void;\n};\n\n/**\n * A form that lets a user select one of a list of locations to import\n *\n * @param analyzeResult - the result of the analysis\n * @param prepareResult - the selectected locations from a previous step\n * @param onPrepare - called after the selection\n * @param onGoBack - called to go back to the previous step\n */\nexport const StepPrepareSelectLocations = ({\n analyzeResult,\n prepareResult,\n onPrepare,\n onGoBack,\n}: Props) => {\n const [selectedUrls, setSelectedUrls] = useState<string[]>(\n prepareResult?.locations.map(l => l.target) || [],\n );\n\n const [existingLocations, locations] = partition(\n analyzeResult?.locations,\n l => l.exists,\n );\n\n const handleResult = useCallback(async () => {\n onPrepare({\n type: 'locations',\n locations: locations.filter((l: any) => selectedUrls.includes(l.target)),\n });\n }, [locations, onPrepare, selectedUrls]);\n\n const onItemClick = (url: string) => {\n setSelectedUrls(urls =>\n urls.includes(url) ? urls.filter(u => u !== url) : urls.concat(url),\n );\n };\n\n const onSelectAll = () => {\n setSelectedUrls(urls =>\n urls.length < locations.length ? locations.map(l => l.target) : [],\n );\n };\n\n return (\n <>\n {locations.length > 0 && (\n <>\n <Typography>\n Select one or more locations that are present in your git\n repository:\n </Typography>\n <EntityListComponent\n firstListItem={\n <ListItem dense button onClick={onSelectAll}>\n <ListItemIcon>\n <Checkbox\n edge=\"start\"\n checked={selectedUrls.length === locations.length}\n indeterminate={\n selectedUrls.length > 0 &&\n selectedUrls.length < locations.length\n }\n tabIndex={-1}\n disableRipple\n />\n </ListItemIcon>\n <ListItemText primary=\"Select All\" />\n </ListItem>\n }\n onItemClick={onItemClick}\n locations={locations}\n locationListItemIcon={target => (\n <Checkbox\n edge=\"start\"\n checked={selectedUrls.includes(target)}\n tabIndex={-1}\n disableRipple\n />\n )}\n collapsed\n />\n </>\n )}\n\n {existingLocations.length > 0 && (\n <>\n <Typography>These locations already exist in the catalog:</Typography>\n <EntityListComponent\n locations={existingLocations}\n locationListItemIcon={() => <LocationOnIcon />}\n withLinks\n collapsed\n />\n </>\n )}\n\n <Grid container spacing={0}>\n {onGoBack && <BackButton onClick={onGoBack} />}\n <NextButton disabled={selectedUrls.length === 0} onClick={handleResult}>\n Review\n </NextButton>\n </Grid>\n </>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { FormHelperText, Grid, Typography } from '@material-ui/core';\nimport LocationOnIcon from '@material-ui/icons/LocationOn';\nimport React, { useCallback, useState } from 'react';\nimport { BackButton, NextButton } from '../Buttons';\nimport { EntityListComponent } from '../EntityListComponent';\nimport { PrepareResult, ReviewResult } from '../useImportState';\n\nimport { configApiRef, useAnalytics, useApi } from '@backstage/core-plugin-api';\nimport { Link } from '@backstage/core-components';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { assertError } from '@backstage/errors';\n\ntype Props = {\n prepareResult: PrepareResult;\n onReview: (result: ReviewResult) => void;\n onGoBack?: () => void;\n};\n\nexport const StepReviewLocation = ({\n prepareResult,\n onReview,\n onGoBack,\n}: Props) => {\n const catalogApi = useApi(catalogApiRef);\n const configApi = useApi(configApiRef);\n const analytics = useAnalytics();\n\n const appTitle = configApi.getOptionalString('app.title') || 'Backstage';\n\n const [submitted, setSubmitted] = useState(false);\n const [error, setError] = useState<string>();\n const exists =\n prepareResult.type === 'locations' &&\n prepareResult.locations.some(l => l.exists)\n ? true\n : false;\n const handleClick = useCallback(async () => {\n setSubmitted(true);\n analytics.captureEvent('click', 'import entity');\n try {\n let refreshed = new Array<{ target: string }>();\n if (prepareResult.type === 'locations') {\n refreshed = await Promise.all(\n prepareResult.locations\n .filter(l => l.exists)\n .map(async l => {\n const ref = stringifyEntityRef(l.entities[0] ?? l);\n await catalogApi.refreshEntity(ref);\n return { target: l.target };\n }),\n );\n }\n\n const locations = await Promise.all(\n prepareResult.locations\n .filter((l: unknown) => !(l as { exists?: boolean }).exists)\n .map(async l => {\n const result = await catalogApi.addLocation({\n type: 'url',\n target: l.target,\n });\n return {\n target: result.location.target,\n entities: result.entities,\n };\n }),\n );\n\n onReview({\n ...prepareResult,\n ...{ refreshed },\n locations,\n });\n } catch (e) {\n assertError(e);\n // TODO: this error should be handled differently. We add it as 'optional' and\n // it is not uncommon that a PR has not been merged yet.\n if (\n prepareResult.type === 'repository' &&\n e.message.startsWith(\n 'Location was added but has no entities specified yet',\n )\n ) {\n onReview({\n ...prepareResult,\n locations: prepareResult.locations.map(l => ({\n target: l.target,\n entities: [],\n })),\n });\n } else {\n setError(e.message);\n setSubmitted(false);\n }\n }\n }, [prepareResult, onReview, catalogApi, analytics]);\n\n return (\n <>\n {prepareResult.type === 'repository' && (\n <>\n <Typography paragraph>\n The following Pull Request has been opened:{' '}\n <Link\n to={prepareResult.pullRequest.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {prepareResult.pullRequest.url}\n </Link>\n </Typography>\n\n <Typography paragraph>\n You can already import the location and {appTitle} will fetch the\n entities as soon as the Pull Request is merged.\n </Typography>\n </>\n )}\n\n <Typography>\n {exists\n ? 'The following locations already exist in the catalog:'\n : 'The following entities will be added to the catalog:'}\n </Typography>\n\n <EntityListComponent\n locations={prepareResult.locations}\n locationListItemIcon={() => <LocationOnIcon />}\n />\n\n {error && <FormHelperText error>{error}</FormHelperText>}\n\n <Grid container spacing={0}>\n {onGoBack && <BackButton onClick={onGoBack} disabled={submitted} />}\n <NextButton\n disabled={submitted}\n loading={submitted}\n onClick={() => handleClick()}\n >\n {exists ? 'Refresh' : 'Import'}\n </NextButton>\n </Grid>\n </>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Box,\n Checkbox,\n FormControlLabel,\n FormHelperText,\n StepLabel,\n TextField,\n Typography,\n} from '@material-ui/core';\nimport React from 'react';\nimport { BackButton } from '../Buttons';\nimport { asInputRef } from '../helpers';\nimport { StepFinishImportLocation } from '../StepFinishImportLocation';\nimport { StepInitAnalyzeUrl } from '../StepInitAnalyzeUrl';\nimport {\n AutocompleteTextField,\n StepPrepareCreatePullRequest,\n} from '../StepPrepareCreatePullRequest';\nimport { StepPrepareSelectLocations } from '../StepPrepareSelectLocations';\nimport { StepReviewLocation } from '../StepReviewLocation';\nimport { StepperApis } from '../types';\nimport { ImportFlows, ImportState } from '../useImportState';\n\nexport type StepConfiguration = {\n stepLabel: React.ReactElement;\n content: React.ReactElement;\n};\n\n/**\n * Defines the details of the stepper.\n *\n * @public\n */\nexport interface StepperProvider {\n analyze: (\n s: Extract<ImportState, { activeState: 'analyze' }>,\n opts: { apis: StepperApis },\n ) => StepConfiguration;\n prepare: (\n s: Extract<ImportState, { activeState: 'prepare' }>,\n opts: { apis: StepperApis },\n ) => StepConfiguration;\n review: (\n s: Extract<ImportState, { activeState: 'review' }>,\n opts: { apis: StepperApis },\n ) => StepConfiguration;\n finish: (\n s: Extract<ImportState, { activeState: 'finish' }>,\n opts: { apis: StepperApis },\n ) => StepConfiguration;\n}\n\n/**\n * The default stepper generation function.\n *\n * Override this function to customize the import flow. Each flow should at\n * least override the prepare operation.\n *\n * @param flow - the name of the active flow\n * @param defaults - the default steps\n * @public\n */\nexport function defaultGenerateStepper(\n flow: ImportFlows,\n defaults: StepperProvider,\n): StepperProvider {\n switch (flow) {\n // the prepare step is skipped but the label of the step is updated\n case 'single-location':\n return {\n ...defaults,\n prepare: () => ({\n stepLabel: (\n <StepLabel\n optional={\n <Typography variant=\"caption\">\n Discovered Locations: 1\n </Typography>\n }\n >\n Select Locations\n </StepLabel>\n ),\n content: <></>,\n }),\n };\n\n // let the user select one or more of the discovered locations in the prepare step\n case 'multiple-locations':\n return {\n ...defaults,\n prepare: (state, opts) => {\n if (state.analyzeResult.type !== 'locations') {\n return defaults.prepare(state, opts);\n }\n\n return {\n stepLabel: (\n <StepLabel\n optional={\n <Typography variant=\"caption\">\n Discovered Locations: {state.analyzeResult.locations.length}\n </Typography>\n }\n >\n Select Locations\n </StepLabel>\n ),\n content: (\n <StepPrepareSelectLocations\n analyzeResult={state.analyzeResult}\n prepareResult={state.prepareResult}\n onPrepare={state.onPrepare}\n onGoBack={state.onGoBack}\n />\n ),\n };\n },\n };\n\n case 'no-location':\n return {\n ...defaults,\n prepare: (state, opts) => {\n if (state.analyzeResult.type !== 'repository') {\n return defaults.prepare(state, opts);\n }\n\n return {\n stepLabel: <StepLabel>Create Pull Request</StepLabel>,\n content: (\n <StepPrepareCreatePullRequest\n analyzeResult={state.analyzeResult}\n onPrepare={state.onPrepare}\n onGoBack={state.onGoBack}\n renderFormFields={({\n values,\n setValue,\n formState,\n groupsLoading,\n groups,\n register,\n }) => (\n <>\n <Box marginTop={2}>\n <Typography variant=\"h6\">Pull Request Details</Typography>\n </Box>\n\n <TextField\n {...asInputRef(\n register('title', {\n required: true,\n }),\n )}\n label=\"Pull Request Title\"\n placeholder=\"Add Backstage catalog entity descriptor files\"\n margin=\"normal\"\n variant=\"outlined\"\n fullWidth\n error={Boolean(formState.errors.title)}\n required\n />\n\n <TextField\n {...asInputRef(\n register('body', {\n required: true,\n }),\n )}\n label=\"Pull Request Body\"\n placeholder=\"A describing text with Markdown support\"\n margin=\"normal\"\n variant=\"outlined\"\n fullWidth\n error={Boolean(formState.errors.body)}\n multiline\n required\n />\n\n <Box marginTop={2}>\n <Typography variant=\"h6\">Entity Configuration</Typography>\n </Box>\n\n <TextField\n {...asInputRef(\n register('componentName', { required: true }),\n )}\n label=\"Name of the created component\"\n placeholder=\"my-component\"\n margin=\"normal\"\n variant=\"outlined\"\n fullWidth\n error={Boolean(formState.errors.componentName)}\n required\n />\n\n {!values.useCodeowners && (\n <AutocompleteTextField\n name=\"owner\"\n errors={formState.errors}\n options={groups || []}\n loading={groupsLoading}\n loadingText=\"Loading groups…\"\n helperText=\"Select an owner from the list or enter a reference to a Group or a User\"\n errorHelperText=\"required value\"\n textFieldProps={{\n label: 'Entity Owner',\n placeholder: 'my-group',\n }}\n rules={{ required: true }}\n required\n />\n )}\n\n <FormControlLabel\n control={\n <Checkbox\n {...asInputRef(register('useCodeowners'))}\n onChange={(_, value) => {\n if (value) {\n setValue('owner', '');\n }\n }}\n />\n }\n label={\n <>\n Use <em>CODEOWNERS</em> file as Entity Owner\n </>\n }\n />\n <FormHelperText>\n WARNING: This may fail if no CODEOWNERS file is found at\n the target location.\n </FormHelperText>\n </>\n )}\n />\n ),\n };\n },\n };\n\n default:\n return defaults;\n }\n}\n\nexport const defaultStepper: StepperProvider = {\n analyze: (state, { apis }) => ({\n stepLabel: <StepLabel>Select URL</StepLabel>,\n content: (\n <StepInitAnalyzeUrl\n key=\"analyze\"\n analysisUrl={state.analysisUrl}\n onAnalysis={state.onAnalysis}\n disablePullRequest={!apis.catalogImportApi.preparePullRequest}\n />\n ),\n }),\n\n prepare: state => ({\n stepLabel: (\n <StepLabel optional={<Typography variant=\"caption\">Optional</Typography>}>\n Import Actions\n </StepLabel>\n ),\n content: <BackButton onClick={state.onGoBack} />,\n }),\n\n review: state => ({\n stepLabel: <StepLabel>Review</StepLabel>,\n content: (\n <StepReviewLocation\n prepareResult={state.prepareResult}\n onReview={state.onReview}\n onGoBack={state.onGoBack}\n />\n ),\n }),\n\n finish: state => ({\n stepLabel: <StepLabel>Finish</StepLabel>,\n content: (\n <StepFinishImportLocation\n prepareResult={state.prepareResult}\n onReset={state.onReset}\n />\n ),\n }),\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InfoCard, InfoCardVariants } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Step, StepContent, Stepper } from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { useMemo } from 'react';\nimport { catalogImportApiRef } from '../../api';\nimport { ImportFlows, ImportState, useImportState } from '../useImportState';\nimport {\n defaultGenerateStepper,\n defaultStepper,\n StepConfiguration,\n StepperProvider,\n} from './defaults';\n\nconst useStyles = makeStyles(() => ({\n stepperRoot: {\n padding: 0,\n },\n}));\n\n/**\n * Props for {@link ImportStepper}.\n *\n * @public\n */\nexport interface ImportStepperProps {\n initialUrl?: string;\n generateStepper?: (\n flow: ImportFlows,\n defaults: StepperProvider,\n ) => StepperProvider;\n variant?: InfoCardVariants;\n}\n\n/**\n * The stepper that holds the different import stages.\n *\n * @public\n */\nexport const ImportStepper = (props: ImportStepperProps) => {\n const {\n initialUrl,\n generateStepper = defaultGenerateStepper,\n variant,\n } = props;\n\n const catalogImportApi = useApi(catalogImportApiRef);\n const classes = useStyles();\n const state = useImportState({ initialUrl });\n\n const states = useMemo<StepperProvider>(\n () => generateStepper(state.activeFlow, defaultStepper),\n [generateStepper, state.activeFlow],\n );\n\n const render = (step: StepConfiguration) => {\n return (\n <Step>\n {step.stepLabel}\n <StepContent>{step.content}</StepContent>\n </Step>\n );\n };\n\n return (\n <InfoCard variant={variant}>\n <Stepper\n classes={{ root: classes.stepperRoot }}\n activeStep={state.activeStepNumber}\n orientation=\"vertical\"\n >\n {render(\n states.analyze(\n state as Extract<ImportState, { activeState: 'analyze' }>,\n { apis: { catalogImportApi } },\n ),\n )}\n {render(\n states.prepare(\n state as Extract<ImportState, { activeState: 'prepare' }>,\n { apis: { catalogImportApi } },\n ),\n )}\n {render(\n states.review(\n state as Extract<ImportState, { activeState: 'review' }>,\n { apis: { catalogImportApi } },\n ),\n )}\n {render(\n states.finish(\n state as Extract<ImportState, { activeState: 'finish' }>,\n { apis: { catalogImportApi } },\n ),\n )}\n </Stepper>\n </InfoCard>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Content,\n ContentHeader,\n Header,\n Page,\n SupportButton,\n} from '@backstage/core-components';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { Grid, useMediaQuery, useTheme } from '@material-ui/core';\nimport React from 'react';\nimport { ImportInfoCard } from '../ImportInfoCard';\nimport { ImportStepper } from '../ImportStepper';\n\n/**\n * The default catalog import page.\n *\n * @public\n */\nexport const DefaultImportPage = () => {\n const theme = useTheme();\n const configApi = useApi(configApiRef);\n const isMobile = useMediaQuery(theme.breakpoints.down('sm'));\n const appTitle = configApi.getOptionalString('app.title') || 'Backstage';\n\n const contentItems = [\n <Grid key={0} item xs={12} md={4} lg={6} xl={8}>\n <ImportInfoCard />\n </Grid>,\n\n <Grid key={1} item xs={12} md={8} lg={6} xl={4}>\n <ImportStepper />\n </Grid>,\n ];\n\n return (\n <Page themeId=\"home\">\n <Header title=\"Register an existing component\" />\n <Content>\n <ContentHeader title={`Start tracking your component in ${appTitle}`}>\n <SupportButton>\n Start tracking your component in {appTitle} by adding it to the\n software catalog.\n </SupportButton>\n </ContentHeader>\n\n <Grid container spacing={2}>\n {isMobile ? contentItems : contentItems.reverse()}\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmBO,SAAS,kBAA6B,GAAA;AAC3C,EAAM,MAAA,MAAA,GAAS,OAAO,YAAY,CAAA,CAAA;AAElC,EAAA,OAAO,mBAAmB,MAAM,CAAA,CAAA;AAClC;;ACea,MAAA,cAAA,GAAiB,CAAC,KAA+B,KAAA;AAC5D,EAAM,MAAA;AAAA,IACJ,kB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EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,oBAAe,CAClB,CAAA;AAAA,wCAEC,IAAK,EAAA,EAAA,GAAA,EAAK,CAAG,EAAA,IAAA,EAAI,MAAC,EAAI,EAAA,EAAA,EAAI,EAAI,EAAA,CAAA,EAAG,IAAI,CAAG,EAAA,EAAA,EAAI,CAC3C,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,mBAAc,CACjB,CAAA;AAAA,GACF,CAAA;AAEA,EAAA,2CACG,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAO,KAAM,EAAA,gCAAA,EAAiC,CAC/C,kBAAA,KAAA,CAAA,aAAA,CAAC,+BACE,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,KAAO,EAAA,CAAA,iCAAA,EAAoC,QAAQ,CAChE,CAAA,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,IAAA,EAAA,mCAAA,EACqB,UAAS,wCAE7C,CACF,CAEA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,SAAS,EAAA,IAAA,EAAC,OAAS,EAAA,CAAA,EAAA,EACtB,WAAW,YAAe,GAAA,YAAA,CAAa,OAAQ,EAClD,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { useOutlet } from 'react-router-dom';
3
- import { D as DefaultImportPage } from './DefaultImportPage-3d0141a5.esm.js';
3
+ import { D as DefaultImportPage } from './DefaultImportPage-010b17d2.esm.js';
4
4
  import '@backstage/core-components';
5
5
  import '@backstage/core-plugin-api';
6
6
  import '@material-ui/core';
7
- import './plugin-5ca30662.esm.js';
7
+ import './plugin-0e18f6e1.esm.js';
8
8
  import '@backstage/integration-react';
9
9
  import '@backstage/plugin-catalog-react';
10
10
  import '@octokit/rest';
@@ -15,13 +15,13 @@ import '@material-ui/icons/LocationOn';
15
15
  import '@material-ui/icons/ExpandLess';
16
16
  import '@material-ui/icons/ExpandMore';
17
17
  import 'lodash/partition';
18
+ import '@backstage/catalog-model';
18
19
  import 'react-hook-form';
19
20
  import '@material-ui/lab';
20
21
  import 'yaml';
21
22
  import 'lodash';
22
23
  import '@backstage/errors';
23
24
  import 'react-use/lib/useAsync';
24
- import '@backstage/catalog-model';
25
25
 
26
26
  const ImportPage = () => {
27
27
  const outlet = useOutlet();
@@ -29,4 +29,4 @@ const ImportPage = () => {
29
29
  };
30
30
 
31
31
  export { ImportPage };
32
- //# sourceMappingURL=index-6cc6851a.esm.js.map
32
+ //# sourceMappingURL=index-28367cb8.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-6cc6851a.esm.js","sources":["../../src/components/ImportPage/ImportPage.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { useOutlet } from 'react-router-dom';\nimport { DefaultImportPage } from '../DefaultImportPage';\n\n/**\n * The whole catalog import page.\n *\n * @public\n */\nexport const ImportPage = () => {\n const outlet = useOutlet();\n\n return outlet || <DefaultImportPage />;\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,MAAM,aAAa,MAAM;AAC9B,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AAEzB,EAAO,OAAA,MAAA,wCAAW,iBAAkB,EAAA,IAAA,CAAA,CAAA;AACtC;;;;"}
1
+ {"version":3,"file":"index-28367cb8.esm.js","sources":["../../src/components/ImportPage/ImportPage.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { useOutlet } from 'react-router-dom';\nimport { DefaultImportPage } from '../DefaultImportPage';\n\n/**\n * The whole catalog import page.\n *\n * @public\n */\nexport const ImportPage = () => {\n const outlet = useOutlet();\n\n return outlet || <DefaultImportPage />;\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,MAAM,aAAa,MAAM;AAC9B,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AAEzB,EAAO,OAAA,MAAA,wCAAW,iBAAkB,EAAA,IAAA,CAAA,CAAA;AACtC;;;;"}
@@ -325,10 +325,10 @@ const catalogImportPlugin = createPlugin({
325
325
  const CatalogImportPage = catalogImportPlugin.provide(
326
326
  createRoutableExtension({
327
327
  name: "CatalogImportPage",
328
- component: () => import('./index-6cc6851a.esm.js').then((m) => m.ImportPage),
328
+ component: () => import('./index-28367cb8.esm.js').then((m) => m.ImportPage),
329
329
  mountPoint: rootRouteRef
330
330
  })
331
331
  );
332
332
 
333
333
  export { CatalogImportPage as C, catalogImportApiRef as a, CatalogImportClient as b, catalogImportPlugin as c, asInputRef as d, getCatalogFilename as g, rootRouteRef as r };
334
- //# sourceMappingURL=plugin-5ca30662.esm.js.map
334
+ //# sourceMappingURL=plugin-0e18f6e1.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-5ca30662.esm.js","sources":["../../src/api/CatalogImportApi.ts","../../src/api/GitHub.ts","../../src/components/helpers.ts","../../src/api/CatalogImportClient.ts","../../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport { PartialEntity } from '../types';\n\n/**\n * Utility API reference for the {@link CatalogImportApi}.\n *\n * @public\n */\nexport const catalogImportApiRef = createApiRef<CatalogImportApi>({\n id: 'plugin.catalog-import.service',\n});\n\n/**\n * Result of the analysis.\n *\n * @public\n */\nexport type AnalyzeResult =\n | {\n type: 'locations';\n locations: Array<{\n target: string;\n exists?: boolean;\n entities: CompoundEntityRef[];\n }>;\n }\n | {\n type: 'repository';\n url: string;\n integrationType: string;\n generatedEntities: PartialEntity[];\n };\n\n/**\n * API for driving catalog imports.\n *\n * @public\n */\nexport interface CatalogImportApi {\n analyzeUrl(url: string): Promise<AnalyzeResult>;\n\n preparePullRequest?(): Promise<{\n title: string;\n body: string;\n }>;\n\n submitPullRequest(options: {\n repositoryUrl: string;\n fileContent: string;\n title: string;\n body: string;\n }): Promise<{ link: string; location: string }>;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport parseGitUrl from 'git-url-parse';\n\nexport const getGithubIntegrationConfig = (\n scmIntegrationsApi: ScmIntegrationRegistry,\n location: string,\n) => {\n const integration = scmIntegrationsApi.github.byUrl(location);\n if (!integration) {\n return undefined;\n }\n\n const { name: repo, owner } = parseGitUrl(location);\n return {\n repo,\n owner,\n githubIntegrationConfig: integration.config,\n };\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Config } from '@backstage/config';\nimport { UseFormRegisterReturn } from 'react-hook-form';\n\n/**\n * A helper that converts the result of a render('name', opts) to make it compatible with material-ui.\n *\n * See also https://github.com/react-hook-form/react-hook-form/issues/4629#issuecomment-815840872\n * TODO: remove when updating to material-ui v5 (https://github.com/mui-org/material-ui/pull/23174)\n *\n * @param renderResult - the result of a render('name', opts)\n */\nexport function asInputRef(renderResult: UseFormRegisterReturn) {\n const { ref, ...rest } = renderResult;\n return {\n inputRef: ref,\n ...rest,\n };\n}\n\nexport function getCatalogFilename(config: Config): string {\n return (\n config.getOptionalString('catalog.import.entityFilename') ??\n 'catalog-info.yaml'\n );\n}\n\nexport function getBranchName(config: Config): string {\n return (\n config.getOptionalString('catalog.import.pullRequestBranchName') ??\n 'backstage-integration'\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CatalogApi } from '@backstage/catalog-client';\nimport {\n ConfigApi,\n DiscoveryApi,\n IdentityApi,\n} from '@backstage/core-plugin-api';\nimport {\n GithubIntegrationConfig,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport { ScmAuthApi } from '@backstage/integration-react';\nimport { Octokit } from '@octokit/rest';\nimport { Base64 } from 'js-base64';\nimport { AnalyzeResult, CatalogImportApi } from './CatalogImportApi';\nimport { getGithubIntegrationConfig } from './GitHub';\nimport { getBranchName, getCatalogFilename } from '../components/helpers';\nimport { AnalyzeLocationResponse } from '@backstage/plugin-catalog-common';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\n\n/**\n * The default implementation of the {@link CatalogImportApi}.\n *\n * @public\n */\nexport class CatalogImportClient implements CatalogImportApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly identityApi: IdentityApi;\n private readonly scmAuthApi: ScmAuthApi;\n private readonly scmIntegrationsApi: ScmIntegrationRegistry;\n private readonly catalogApi: CatalogApi;\n private readonly configApi: ConfigApi;\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n scmAuthApi: ScmAuthApi;\n identityApi: IdentityApi;\n scmIntegrationsApi: ScmIntegrationRegistry;\n catalogApi: CatalogApi;\n configApi: ConfigApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.scmAuthApi = options.scmAuthApi;\n this.identityApi = options.identityApi;\n this.scmIntegrationsApi = options.scmIntegrationsApi;\n this.catalogApi = options.catalogApi;\n this.configApi = options.configApi;\n }\n\n async analyzeUrl(url: string): Promise<AnalyzeResult> {\n if (\n new URL(url).pathname.match(/\\.ya?ml$/) ||\n new URL(url).searchParams.get('path')?.match(/.ya?ml$/)\n ) {\n const location = await this.catalogApi.addLocation({\n type: 'url',\n target: url,\n dryRun: true,\n });\n\n return {\n type: 'locations',\n locations: [\n {\n exists: location.exists,\n target: location.location.target,\n entities: location.entities.map(e => ({\n kind: e.kind,\n namespace: e.metadata.namespace ?? 'default',\n name: e.metadata.name,\n })),\n },\n ],\n };\n }\n\n const ghConfig = getGithubIntegrationConfig(this.scmIntegrationsApi, url);\n if (!ghConfig) {\n const other = this.scmIntegrationsApi.byUrl(url);\n const catalogFilename = getCatalogFilename(this.configApi);\n\n if (other) {\n throw new Error(\n `The ${other.title} integration only supports full URLs to ${catalogFilename} files. Did you try to pass in the URL of a directory instead?`,\n );\n }\n throw new Error(\n `This URL was not recognized as a valid GitHub URL because there was no configured integration that matched the given host name. You could try to paste the full URL to a ${catalogFilename} file instead.`,\n );\n }\n\n const analyzation = await this.analyzeLocation({\n repo: url,\n });\n\n if (analyzation.existingEntityFiles.length > 0) {\n const locations = analyzation.existingEntityFiles.reduce<\n Record<\n string,\n {\n target: string;\n exists?: boolean;\n entities: CompoundEntityRef[];\n }\n >\n >((state, curr) => {\n state[curr.location.target] = {\n target: curr.location.target,\n exists: curr.isRegistered,\n entities: [\n ...(curr.location.target in state\n ? state[curr.location.target].entities\n : []),\n {\n name: curr.entity.metadata.name,\n namespace: curr.entity.metadata.namespace ?? 'default',\n kind: curr.entity.kind,\n },\n ],\n };\n return state;\n }, {});\n return {\n type: 'locations',\n locations: Object.values(locations),\n };\n }\n\n return {\n type: 'repository',\n integrationType: 'github',\n url: url,\n generatedEntities: analyzation.generateEntities.map(x => x.entity),\n };\n }\n\n async preparePullRequest(): Promise<{\n title: string;\n body: string;\n }> {\n const appTitle =\n this.configApi.getOptionalString('app.title') ?? 'Backstage';\n const appBaseUrl = this.configApi.getString('app.baseUrl');\n const catalogFilename = getCatalogFilename(this.configApi);\n\n return {\n title: `Add ${catalogFilename} config file`,\n body: `This pull request adds a **Backstage entity metadata file** \\\nto this repository so that the component can be added to the \\\n[${appTitle} software catalog](${appBaseUrl}).\\n\\nAfter this pull request is merged, \\\nthe component will become available.\\n\\nFor more information, read an \\\n[overview of the Backstage software catalog](https://backstage.io/docs/features/software-catalog/).`,\n };\n }\n\n async submitPullRequest(options: {\n repositoryUrl: string;\n fileContent: string;\n title: string;\n body: string;\n }): Promise<{ link: string; location: string }> {\n const { repositoryUrl, fileContent, title, body } = options;\n\n const ghConfig = getGithubIntegrationConfig(\n this.scmIntegrationsApi,\n repositoryUrl,\n );\n\n if (ghConfig) {\n return await this.submitGitHubPrToRepo({\n ...ghConfig,\n repositoryUrl,\n fileContent,\n title,\n body,\n });\n }\n\n throw new Error('unimplemented!');\n }\n\n // TODO: this could be part of the catalog api\n private async analyzeLocation(options: {\n repo: string;\n }): Promise<AnalyzeLocationResponse> {\n const { token } = await this.identityApi.getCredentials();\n const response = await fetch(\n `${await this.discoveryApi.getBaseUrl('catalog')}/analyze-location`,\n {\n headers: {\n 'Content-Type': 'application/json',\n ...(token && { Authorization: `Bearer ${token}` }),\n },\n method: 'POST',\n body: JSON.stringify({\n location: { type: 'url', target: options.repo },\n ...(this.configApi.getOptionalString(\n 'catalog.import.entityFilename',\n ) && {\n catalogFilename: this.configApi.getOptionalString(\n 'catalog.import.entityFilename',\n ),\n }),\n }),\n },\n ).catch(e => {\n throw new Error(`Failed to generate entity definitions, ${e.message}`);\n });\n if (!response.ok) {\n throw new Error(\n `Failed to generate entity definitions. Received http response ${response.status}: ${response.statusText}`,\n );\n }\n\n const payload = await response.json();\n return payload;\n }\n\n // TODO: extract this function and implement for non-github\n private async submitGitHubPrToRepo(options: {\n owner: string;\n repo: string;\n title: string;\n body: string;\n fileContent: string;\n repositoryUrl: string;\n githubIntegrationConfig: GithubIntegrationConfig;\n }): Promise<{ link: string; location: string }> {\n const {\n owner,\n repo,\n title,\n body,\n fileContent,\n repositoryUrl,\n githubIntegrationConfig,\n } = options;\n\n const { token } = await this.scmAuthApi.getCredentials({\n url: repositoryUrl,\n additionalScope: {\n repoWrite: true,\n },\n });\n\n const octo = new Octokit({\n auth: token,\n baseUrl: githubIntegrationConfig.apiBaseUrl,\n });\n\n const branchName = getBranchName(this.configApi);\n const fileName = getCatalogFilename(this.configApi);\n\n const repoData = await octo.repos\n .get({\n owner,\n repo,\n })\n .catch(e => {\n throw new Error(formatHttpErrorMessage(\"Couldn't fetch repo data\", e));\n });\n\n const parentRef = await octo.git\n .getRef({\n owner,\n repo,\n ref: `heads/${repoData.data.default_branch}`,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\"Couldn't fetch default branch data\", e),\n );\n });\n\n await octo.git\n .createRef({\n owner,\n repo,\n ref: `refs/heads/${branchName}`,\n sha: parentRef.data.object.sha,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\n `Couldn't create a new branch with name '${branchName}'`,\n e,\n ),\n );\n });\n\n await octo.repos\n .createOrUpdateFileContents({\n owner,\n repo,\n path: fileName,\n message: title,\n content: Base64.encode(fileContent),\n branch: branchName,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\n `Couldn't create a commit with ${fileName} file added`,\n e,\n ),\n );\n });\n\n const pullRequestResponse = await octo.pulls\n .create({\n owner,\n repo,\n title,\n head: branchName,\n body,\n base: repoData.data.default_branch,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\n `Couldn't create a pull request for ${branchName} branch`,\n e,\n ),\n );\n });\n\n return {\n link: pullRequestResponse.data.html_url,\n location: `https://${githubIntegrationConfig.host}/${owner}/${repo}/blob/${repoData.data.default_branch}/${fileName}`,\n };\n }\n}\n\nfunction formatHttpErrorMessage(\n message: string,\n error: { status: number; message: string },\n) {\n return `${message}, received http response status code ${error.status}: ${error.message}`;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n configApiRef,\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n createRouteRef,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n scmAuthApiRef,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { catalogImportApiRef, CatalogImportClient } from './api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'catalog-import',\n});\n\n/**\n * A plugin that helps the user in importing projects and YAML files into the\n * catalog.\n *\n * @public\n */\nexport const catalogImportPlugin = createPlugin({\n id: 'catalog-import',\n apis: [\n createApiFactory({\n api: catalogImportApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n scmAuthApi: scmAuthApiRef,\n identityApi: identityApiRef,\n scmIntegrationsApi: scmIntegrationsApiRef,\n catalogApi: catalogApiRef,\n configApi: configApiRef,\n },\n factory: ({\n discoveryApi,\n scmAuthApi,\n identityApi,\n scmIntegrationsApi,\n catalogApi,\n configApi,\n }) =>\n new CatalogImportClient({\n discoveryApi,\n scmAuthApi,\n scmIntegrationsApi,\n identityApi,\n catalogApi,\n configApi,\n }),\n }),\n ],\n routes: {\n importPage: rootRouteRef,\n },\n});\n\n/**\n * The page for importing projects and YAML files into the catalog.\n *\n * @public\n */\nexport const CatalogImportPage = catalogImportPlugin.provide(\n createRoutableExtension({\n name: 'CatalogImportPage',\n component: () => import('./components/ImportPage').then(m => m.ImportPage),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":["_a"],"mappings":";;;;;;;AAyBO,MAAM,sBAAsB,YAA+B,CAAA;AAAA,EAChE,EAAI,EAAA,+BAAA;AACN,CAAC;;ACRY,MAAA,0BAAA,GAA6B,CACxC,kBAAA,EACA,QACG,KAAA;AACH,EAAA,MAAM,WAAc,GAAA,kBAAA,CAAmB,MAAO,CAAA,KAAA,CAAM,QAAQ,CAAA,CAAA;AAC5D,EAAA,IAAI,CAAC,WAAa,EAAA;AAChB,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AAEA,EAAA,MAAM,EAAE,IAAM,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Ae,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA,gBAAA;AACN,CAAC,EAAA;AAQM,MAAM,sBAAsB,YAAa,CAAA;AAAA,EAC9C,EAAI,EAAA,gBAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,mBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,UAAY,EAAA,aAAA;AAAA,QACZ,WAAa,EAAA,cAAA;AAAA,QACb,kBAAoB,EAAA,qBAAA;AAAA,QACpB,UAAY,EAAA,aAAA;AAAA,QACZ,SAAW,EAAA,YAAA;AAAA,OACb;AAAA,MACA,SAAS,CAAC;AAAA,QACR,YAAA;AAAA,QACA,UAAA;AAAA,QACA,WAAA;AAAA,QACA,kBAAA;AAAA,QACA,UAAA;AAAA,QACA,SAAA;AAAA,OACF,KACE,IAAI,mBAAoB,CAAA;AAAA,QACtB,YAAA;AAAA,QACA,UAAA;AAAA,QACA,kBAAA;AAAA,QACA,WAAA;AAAA,QACA,UAAA;AAAA,QACA,SAAA;AAAA,OACD,CAAA;AAAA,KACJ,CAAA;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,UAAY,EAAA,YAAA;AAAA,GACd;AACF,CAAC,EAAA;AAOM,MAAM,oBAAoB,mBAAoB,CAAA,OAAA;AAAA,EACnD,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,mBAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,yBAAyB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,UAAU,CAAA;AAAA,IACzE,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"plugin-0e18f6e1.esm.js","sources":["../../src/api/CatalogImportApi.ts","../../src/api/GitHub.ts","../../src/components/helpers.ts","../../src/api/CatalogImportClient.ts","../../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport { PartialEntity } from '../types';\n\n/**\n * Utility API reference for the {@link CatalogImportApi}.\n *\n * @public\n */\nexport const catalogImportApiRef = createApiRef<CatalogImportApi>({\n id: 'plugin.catalog-import.service',\n});\n\n/**\n * Result of the analysis.\n *\n * @public\n */\nexport type AnalyzeResult =\n | {\n type: 'locations';\n locations: Array<{\n target: string;\n exists?: boolean;\n entities: CompoundEntityRef[];\n }>;\n }\n | {\n type: 'repository';\n url: string;\n integrationType: string;\n generatedEntities: PartialEntity[];\n };\n\n/**\n * API for driving catalog imports.\n *\n * @public\n */\nexport interface CatalogImportApi {\n analyzeUrl(url: string): Promise<AnalyzeResult>;\n\n preparePullRequest?(): Promise<{\n title: string;\n body: string;\n }>;\n\n submitPullRequest(options: {\n repositoryUrl: string;\n fileContent: string;\n title: string;\n body: string;\n }): Promise<{ link: string; location: string }>;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport parseGitUrl from 'git-url-parse';\n\nexport const getGithubIntegrationConfig = (\n scmIntegrationsApi: ScmIntegrationRegistry,\n location: string,\n) => {\n const integration = scmIntegrationsApi.github.byUrl(location);\n if (!integration) {\n return undefined;\n }\n\n const { name: repo, owner } = parseGitUrl(location);\n return {\n repo,\n owner,\n githubIntegrationConfig: integration.config,\n };\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Config } from '@backstage/config';\nimport { UseFormRegisterReturn } from 'react-hook-form';\n\n/**\n * A helper that converts the result of a render('name', opts) to make it compatible with material-ui.\n *\n * See also https://github.com/react-hook-form/react-hook-form/issues/4629#issuecomment-815840872\n * TODO: remove when updating to material-ui v5 (https://github.com/mui-org/material-ui/pull/23174)\n *\n * @param renderResult - the result of a render('name', opts)\n */\nexport function asInputRef(renderResult: UseFormRegisterReturn) {\n const { ref, ...rest } = renderResult;\n return {\n inputRef: ref,\n ...rest,\n };\n}\n\nexport function getCatalogFilename(config: Config): string {\n return (\n config.getOptionalString('catalog.import.entityFilename') ??\n 'catalog-info.yaml'\n );\n}\n\nexport function getBranchName(config: Config): string {\n return (\n config.getOptionalString('catalog.import.pullRequestBranchName') ??\n 'backstage-integration'\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CatalogApi } from '@backstage/catalog-client';\nimport {\n ConfigApi,\n DiscoveryApi,\n IdentityApi,\n} from '@backstage/core-plugin-api';\nimport {\n GithubIntegrationConfig,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport { ScmAuthApi } from '@backstage/integration-react';\nimport { Octokit } from '@octokit/rest';\nimport { Base64 } from 'js-base64';\nimport { AnalyzeResult, CatalogImportApi } from './CatalogImportApi';\nimport { getGithubIntegrationConfig } from './GitHub';\nimport { getBranchName, getCatalogFilename } from '../components/helpers';\nimport { AnalyzeLocationResponse } from '@backstage/plugin-catalog-common';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\n\n/**\n * The default implementation of the {@link CatalogImportApi}.\n *\n * @public\n */\nexport class CatalogImportClient implements CatalogImportApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly identityApi: IdentityApi;\n private readonly scmAuthApi: ScmAuthApi;\n private readonly scmIntegrationsApi: ScmIntegrationRegistry;\n private readonly catalogApi: CatalogApi;\n private readonly configApi: ConfigApi;\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n scmAuthApi: ScmAuthApi;\n identityApi: IdentityApi;\n scmIntegrationsApi: ScmIntegrationRegistry;\n catalogApi: CatalogApi;\n configApi: ConfigApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.scmAuthApi = options.scmAuthApi;\n this.identityApi = options.identityApi;\n this.scmIntegrationsApi = options.scmIntegrationsApi;\n this.catalogApi = options.catalogApi;\n this.configApi = options.configApi;\n }\n\n async analyzeUrl(url: string): Promise<AnalyzeResult> {\n if (\n new URL(url).pathname.match(/\\.ya?ml$/) ||\n new URL(url).searchParams.get('path')?.match(/.ya?ml$/)\n ) {\n const location = await this.catalogApi.addLocation({\n type: 'url',\n target: url,\n dryRun: true,\n });\n\n return {\n type: 'locations',\n locations: [\n {\n exists: location.exists,\n target: location.location.target,\n entities: location.entities.map(e => ({\n kind: e.kind,\n namespace: e.metadata.namespace ?? 'default',\n name: e.metadata.name,\n })),\n },\n ],\n };\n }\n\n const ghConfig = getGithubIntegrationConfig(this.scmIntegrationsApi, url);\n if (!ghConfig) {\n const other = this.scmIntegrationsApi.byUrl(url);\n const catalogFilename = getCatalogFilename(this.configApi);\n\n if (other) {\n throw new Error(\n `The ${other.title} integration only supports full URLs to ${catalogFilename} files. Did you try to pass in the URL of a directory instead?`,\n );\n }\n throw new Error(\n `This URL was not recognized as a valid GitHub URL because there was no configured integration that matched the given host name. You could try to paste the full URL to a ${catalogFilename} file instead.`,\n );\n }\n\n const analyzation = await this.analyzeLocation({\n repo: url,\n });\n\n if (analyzation.existingEntityFiles.length > 0) {\n const locations = analyzation.existingEntityFiles.reduce<\n Record<\n string,\n {\n target: string;\n exists?: boolean;\n entities: CompoundEntityRef[];\n }\n >\n >((state, curr) => {\n state[curr.location.target] = {\n target: curr.location.target,\n exists: curr.isRegistered,\n entities: [\n ...(curr.location.target in state\n ? state[curr.location.target].entities\n : []),\n {\n name: curr.entity.metadata.name,\n namespace: curr.entity.metadata.namespace ?? 'default',\n kind: curr.entity.kind,\n },\n ],\n };\n return state;\n }, {});\n return {\n type: 'locations',\n locations: Object.values(locations),\n };\n }\n\n return {\n type: 'repository',\n integrationType: 'github',\n url: url,\n generatedEntities: analyzation.generateEntities.map(x => x.entity),\n };\n }\n\n async preparePullRequest(): Promise<{\n title: string;\n body: string;\n }> {\n const appTitle =\n this.configApi.getOptionalString('app.title') ?? 'Backstage';\n const appBaseUrl = this.configApi.getString('app.baseUrl');\n const catalogFilename = getCatalogFilename(this.configApi);\n\n return {\n title: `Add ${catalogFilename} config file`,\n body: `This pull request adds a **Backstage entity metadata file** \\\nto this repository so that the component can be added to the \\\n[${appTitle} software catalog](${appBaseUrl}).\\n\\nAfter this pull request is merged, \\\nthe component will become available.\\n\\nFor more information, read an \\\n[overview of the Backstage software catalog](https://backstage.io/docs/features/software-catalog/).`,\n };\n }\n\n async submitPullRequest(options: {\n repositoryUrl: string;\n fileContent: string;\n title: string;\n body: string;\n }): Promise<{ link: string; location: string }> {\n const { repositoryUrl, fileContent, title, body } = options;\n\n const ghConfig = getGithubIntegrationConfig(\n this.scmIntegrationsApi,\n repositoryUrl,\n );\n\n if (ghConfig) {\n return await this.submitGitHubPrToRepo({\n ...ghConfig,\n repositoryUrl,\n fileContent,\n title,\n body,\n });\n }\n\n throw new Error('unimplemented!');\n }\n\n // TODO: this could be part of the catalog api\n private async analyzeLocation(options: {\n repo: string;\n }): Promise<AnalyzeLocationResponse> {\n const { token } = await this.identityApi.getCredentials();\n const response = await fetch(\n `${await this.discoveryApi.getBaseUrl('catalog')}/analyze-location`,\n {\n headers: {\n 'Content-Type': 'application/json',\n ...(token && { Authorization: `Bearer ${token}` }),\n },\n method: 'POST',\n body: JSON.stringify({\n location: { type: 'url', target: options.repo },\n ...(this.configApi.getOptionalString(\n 'catalog.import.entityFilename',\n ) && {\n catalogFilename: this.configApi.getOptionalString(\n 'catalog.import.entityFilename',\n ),\n }),\n }),\n },\n ).catch(e => {\n throw new Error(`Failed to generate entity definitions, ${e.message}`);\n });\n if (!response.ok) {\n throw new Error(\n `Failed to generate entity definitions. Received http response ${response.status}: ${response.statusText}`,\n );\n }\n\n const payload = await response.json();\n return payload;\n }\n\n // TODO: extract this function and implement for non-github\n private async submitGitHubPrToRepo(options: {\n owner: string;\n repo: string;\n title: string;\n body: string;\n fileContent: string;\n repositoryUrl: string;\n githubIntegrationConfig: GithubIntegrationConfig;\n }): Promise<{ link: string; location: string }> {\n const {\n owner,\n repo,\n title,\n body,\n fileContent,\n repositoryUrl,\n githubIntegrationConfig,\n } = options;\n\n const { token } = await this.scmAuthApi.getCredentials({\n url: repositoryUrl,\n additionalScope: {\n repoWrite: true,\n },\n });\n\n const octo = new Octokit({\n auth: token,\n baseUrl: githubIntegrationConfig.apiBaseUrl,\n });\n\n const branchName = getBranchName(this.configApi);\n const fileName = getCatalogFilename(this.configApi);\n\n const repoData = await octo.repos\n .get({\n owner,\n repo,\n })\n .catch(e => {\n throw new Error(formatHttpErrorMessage(\"Couldn't fetch repo data\", e));\n });\n\n const parentRef = await octo.git\n .getRef({\n owner,\n repo,\n ref: `heads/${repoData.data.default_branch}`,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\"Couldn't fetch default branch data\", e),\n );\n });\n\n await octo.git\n .createRef({\n owner,\n repo,\n ref: `refs/heads/${branchName}`,\n sha: parentRef.data.object.sha,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\n `Couldn't create a new branch with name '${branchName}'`,\n e,\n ),\n );\n });\n\n await octo.repos\n .createOrUpdateFileContents({\n owner,\n repo,\n path: fileName,\n message: title,\n content: Base64.encode(fileContent),\n branch: branchName,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\n `Couldn't create a commit with ${fileName} file added`,\n e,\n ),\n );\n });\n\n const pullRequestResponse = await octo.pulls\n .create({\n owner,\n repo,\n title,\n head: branchName,\n body,\n base: repoData.data.default_branch,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\n `Couldn't create a pull request for ${branchName} branch`,\n e,\n ),\n );\n });\n\n return {\n link: pullRequestResponse.data.html_url,\n location: `https://${githubIntegrationConfig.host}/${owner}/${repo}/blob/${repoData.data.default_branch}/${fileName}`,\n };\n }\n}\n\nfunction formatHttpErrorMessage(\n message: string,\n error: { status: number; message: string },\n) {\n return `${message}, received http response status code ${error.status}: ${error.message}`;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n configApiRef,\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n createRouteRef,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n scmAuthApiRef,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { catalogImportApiRef, CatalogImportClient } from './api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'catalog-import',\n});\n\n/**\n * A plugin that helps the user in importing projects and YAML files into the\n * catalog.\n *\n * @public\n */\nexport const catalogImportPlugin = createPlugin({\n id: 'catalog-import',\n apis: [\n createApiFactory({\n api: catalogImportApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n scmAuthApi: scmAuthApiRef,\n identityApi: identityApiRef,\n scmIntegrationsApi: scmIntegrationsApiRef,\n catalogApi: catalogApiRef,\n configApi: configApiRef,\n },\n factory: ({\n discoveryApi,\n scmAuthApi,\n identityApi,\n scmIntegrationsApi,\n catalogApi,\n configApi,\n }) =>\n new CatalogImportClient({\n discoveryApi,\n scmAuthApi,\n scmIntegrationsApi,\n identityApi,\n catalogApi,\n configApi,\n }),\n }),\n ],\n routes: {\n importPage: rootRouteRef,\n },\n});\n\n/**\n * The page for importing projects and YAML files into the catalog.\n *\n * @public\n */\nexport const CatalogImportPage = catalogImportPlugin.provide(\n createRoutableExtension({\n name: 'CatalogImportPage',\n component: () => import('./components/ImportPage').then(m => m.ImportPage),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":["_a"],"mappings":";;;;;;;AAyBO,MAAM,sBAAsB,YAA+B,CAAA;AAAA,EAChE,EAAI,EAAA,+BAAA;AACN,CAAC;;ACRY,MAAA,0BAAA,GAA6B,CACxC,kBAAA,EACA,QACG,KAAA;AACH,EAAA,MAAM,WAAc,GAAA,kBAAA,CAAmB,MAAO,CAAA,KAAA,CAAM,QAAQ,CAAA,CAAA;AAC5D,EAAA,IAAI,CAAC,WAAa,EAAA;AAChB,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AAEA,EAAA,MAAM,EAA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MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA,gBAAA;AACN,CAAC,EAAA;AAQM,MAAM,sBAAsB,YAAa,CAAA;AAAA,EAC9C,EAAI,EAAA,gBAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,mBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,UAAY,EAAA,aAAA;AAAA,QACZ,WAAa,EAAA,cAAA;AAAA,QACb,kBAAoB,EAAA,qBAAA;AAAA,QACpB,UAAY,EAAA,aAAA;AAAA,QACZ,SAAW,EAAA,YAAA;AAAA,OACb;AAAA,MACA,SAAS,CAAC;AAAA,QACR,YAAA;AAAA,QACA,UAAA;AAAA,QACA,WAAA;AAAA,QACA,kBAAA;AAAA,QACA,UAAA;AAAA,QACA,SAAA;AAAA,OACF,KACE,IAAI,mBAAoB,CAAA;AAAA,QACtB,YAAA;AAAA,QACA,UAAA;AAAA,QACA,kBAAA;AAAA,QACA,WAAA;AAAA,QACA,UAAA;AAAA,QACA,SAAA;AAAA,OACD,CAAA;AAAA,KACJ,CAAA;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,UAAY,EAAA,YAAA;AAAA,GACd;AACF,CAAC,EAAA;AAOM,MAAM,oBAAoB,mBAAoB,CAAA,OAAA;AAAA,EACnD,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,mBAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,yBAAyB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,UAAU,CAAA;AAAA,IACzE,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;AACH;;;;"}
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
- export { b as CatalogImportClient, C as CatalogImportPage, a as catalogImportApiRef, c as catalogImportPlugin, c as plugin } from './esm/plugin-5ca30662.esm.js';
2
- export { A as AutocompleteTextField, D as DefaultImportPage, E as EntityListComponent, I as ImportInfoCard, a as ImportStepper, P as PreparePullRequestForm, b as PreviewCatalogInfoComponent, c as PreviewPullRequestComponent, S as StepInitAnalyzeUrl, e as StepPrepareCreatePullRequest, d as defaultGenerateStepper } from './esm/DefaultImportPage-3d0141a5.esm.js';
1
+ export { b as CatalogImportClient, C as CatalogImportPage, a as catalogImportApiRef, c as catalogImportPlugin, c as plugin } from './esm/plugin-0e18f6e1.esm.js';
2
+ export { A as AutocompleteTextField, D as DefaultImportPage, E as EntityListComponent, I as ImportInfoCard, a as ImportStepper, P as PreparePullRequestForm, b as PreviewCatalogInfoComponent, c as PreviewPullRequestComponent, S as StepInitAnalyzeUrl, e as StepPrepareCreatePullRequest, d as defaultGenerateStepper } from './esm/DefaultImportPage-010b17d2.esm.js';
3
3
  import '@backstage/core-plugin-api';
4
4
  import '@backstage/integration-react';
5
5
  import '@backstage/plugin-catalog-react';
@@ -14,11 +14,11 @@ import '@material-ui/icons/LocationOn';
14
14
  import '@material-ui/icons/ExpandLess';
15
15
  import '@material-ui/icons/ExpandMore';
16
16
  import 'lodash/partition';
17
+ import '@backstage/catalog-model';
17
18
  import 'react-hook-form';
18
19
  import '@material-ui/lab';
19
20
  import 'yaml';
20
21
  import 'lodash';
21
22
  import '@backstage/errors';
22
23
  import 'react-use/lib/useAsync';
23
- import '@backstage/catalog-model';
24
24
  //# sourceMappingURL=index.esm.js.map
package/package.json CHANGED
@@ -1,13 +1,24 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-import",
3
+ "version": "0.10.7-next.0",
3
4
  "description": "A Backstage plugin the helps you import entities into your catalog",
4
- "version": "0.10.6-next.3",
5
- "main": "./dist/index.esm.js",
6
- "types": "./dist/index.d.ts",
7
- "license": "Apache-2.0",
5
+ "backstage": {
6
+ "role": "frontend-plugin"
7
+ },
8
8
  "publishConfig": {
9
9
  "access": "public"
10
10
  },
11
+ "keywords": [
12
+ "backstage"
13
+ ],
14
+ "homepage": "https://backstage.io",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/backstage/backstage",
18
+ "directory": "plugins/catalog-import"
19
+ },
20
+ "license": "Apache-2.0",
21
+ "sideEffects": false,
11
22
  "exports": {
12
23
  ".": {
13
24
  "import": "./dist/index.esm.js",
@@ -21,41 +32,35 @@
21
32
  },
22
33
  "./package.json": "./package.json"
23
34
  },
24
- "backstage": {
25
- "role": "frontend-plugin"
26
- },
27
- "homepage": "https://backstage.io",
28
- "repository": {
29
- "type": "git",
30
- "url": "https://github.com/backstage/backstage",
31
- "directory": "plugins/catalog-import"
32
- },
33
- "keywords": [
34
- "backstage"
35
+ "main": "./dist/index.esm.js",
36
+ "types": "./dist/index.d.ts",
37
+ "files": [
38
+ "dist",
39
+ "config.d.ts",
40
+ "alpha"
35
41
  ],
36
- "sideEffects": false,
37
42
  "scripts": {
38
43
  "build": "backstage-cli package build",
39
- "start": "backstage-cli package start",
44
+ "clean": "backstage-cli package clean",
40
45
  "lint": "backstage-cli package lint",
41
- "test": "backstage-cli package test",
42
46
  "prepack": "backstage-cli package prepack",
43
47
  "postpack": "backstage-cli package postpack",
44
- "clean": "backstage-cli package clean"
48
+ "start": "backstage-cli package start",
49
+ "test": "backstage-cli package test"
45
50
  },
46
51
  "dependencies": {
47
- "@backstage/catalog-client": "^1.6.0-next.1",
48
- "@backstage/catalog-model": "^1.4.4-next.0",
49
- "@backstage/config": "^1.1.1",
50
- "@backstage/core-compat-api": "^0.2.0-next.3",
51
- "@backstage/core-components": "^0.14.0-next.2",
52
- "@backstage/core-plugin-api": "^1.9.0-next.1",
53
- "@backstage/errors": "^1.2.3",
54
- "@backstage/frontend-plugin-api": "^0.6.0-next.3",
55
- "@backstage/integration": "^1.9.0-next.1",
56
- "@backstage/integration-react": "^1.1.24-next.2",
57
- "@backstage/plugin-catalog-common": "^1.0.21-next.0",
58
- "@backstage/plugin-catalog-react": "^1.10.0-next.3",
52
+ "@backstage/catalog-client": "^1.6.1-next.0",
53
+ "@backstage/catalog-model": "^1.4.5-next.0",
54
+ "@backstage/config": "^1.1.2-next.0",
55
+ "@backstage/core-compat-api": "^0.2.1-next.0",
56
+ "@backstage/core-components": "^0.14.1-next.0",
57
+ "@backstage/core-plugin-api": "^1.9.1-next.0",
58
+ "@backstage/errors": "^1.2.4-next.0",
59
+ "@backstage/frontend-plugin-api": "^0.6.1-next.0",
60
+ "@backstage/integration": "^1.9.1-next.0",
61
+ "@backstage/integration-react": "^1.1.25-next.0",
62
+ "@backstage/plugin-catalog-common": "^1.0.22-next.0",
63
+ "@backstage/plugin-catalog-react": "^1.10.1-next.0",
59
64
  "@material-ui/core": "^4.12.2",
60
65
  "@material-ui/icons": "^4.9.1",
61
66
  "@material-ui/lab": "4.0.0-alpha.61",
@@ -68,27 +73,22 @@
68
73
  "react-use": "^17.2.4",
69
74
  "yaml": "^2.0.0"
70
75
  },
71
- "peerDependencies": {
72
- "react": "^16.13.1 || ^17.0.0 || ^18.0.0",
73
- "react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
74
- "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
75
- },
76
76
  "devDependencies": {
77
- "@backstage/cli": "^0.25.2-next.3",
78
- "@backstage/core-app-api": "^1.12.0-next.1",
79
- "@backstage/dev-utils": "^1.0.27-next.3",
80
- "@backstage/test-utils": "^1.5.0-next.3",
77
+ "@backstage/cli": "^0.25.3-next.0",
78
+ "@backstage/core-app-api": "^1.12.1-next.0",
79
+ "@backstage/dev-utils": "^1.0.28-next.0",
80
+ "@backstage/test-utils": "^1.5.1-next.0",
81
81
  "@testing-library/dom": "^9.0.0",
82
82
  "@testing-library/jest-dom": "^6.0.0",
83
83
  "@testing-library/react": "^14.0.0",
84
84
  "@testing-library/user-event": "^14.0.0",
85
85
  "msw": "^1.0.0"
86
86
  },
87
- "files": [
88
- "dist",
89
- "config.d.ts",
90
- "alpha"
91
- ],
87
+ "peerDependencies": {
88
+ "react": "^16.13.1 || ^17.0.0 || ^18.0.0",
89
+ "react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
90
+ "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
91
+ },
92
92
  "configSchema": "config.d.ts",
93
93
  "module": "./dist/index.esm.js"
94
94
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"DefaultImportPage-3d0141a5.esm.js","sources":["../../src/hooks/useCatalogFilename.ts","../../src/components/ImportInfoCard/ImportInfoCard.tsx","../../src/components/useImportState.ts","../../src/components/Buttons/index.tsx","../../src/components/EntityListComponent/EntityListComponent.tsx","../../src/components/StepFinishImportLocation/StepFinishImportLocation.tsx","../../src/components/StepInitAnalyzeUrl/StepInitAnalyzeUrl.tsx","../../src/components/StepPrepareCreatePullRequest/AutocompleteTextField.tsx","../../src/components/StepPrepareCreatePullRequest/PreparePullRequestForm.tsx","../../src/components/StepPrepareCreatePullRequest/PreviewCatalogInfoComponent.tsx","../../src/components/StepPrepareCreatePullRequest/PreviewPullRequestComponent.tsx","../../src/components/StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.tsx","../../src/components/StepPrepareSelectLocations/StepPrepareSelectLocations.tsx","../../src/components/StepReviewLocation/StepReviewLocation.tsx","../../src/components/ImportStepper/defaults.tsx","../../src/components/ImportStepper/ImportStepper.tsx","../../src/components/DefaultImportPage/DefaultImportPage.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi, configApiRef } from '@backstage/core-plugin-api';\nimport { getCatalogFilename } from '../components/helpers';\n\nexport function useCatalogFilename(): string {\n const config = useApi(configApiRef);\n\n return getCatalogFilename(config);\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InfoCard } from '@backstage/core-components';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { Chip, Typography } from '@material-ui/core';\nimport React from 'react';\nimport { catalogImportApiRef } from '../../api';\nimport { useCatalogFilename } from '../../hooks';\n\n/**\n * Props for {@link ImportInfoCard}.\n *\n * @public\n */\nexport interface ImportInfoCardProps {\n exampleLocationUrl?: string;\n exampleRepositoryUrl?: string;\n}\n\n/**\n * Shows information about the import process.\n *\n * @public\n */\nexport const ImportInfoCard = (props: ImportInfoCardProps) => {\n const {\n exampleLocationUrl = 'https://github.com/backstage/backstage/blob/master/catalog-info.yaml',\n exampleRepositoryUrl = 'https://github.com/backstage/backstage',\n } = props;\n\n const configApi = useApi(configApiRef);\n const appTitle = configApi.getOptionalString('app.title') || 'Backstage';\n const catalogImportApi = useApi(catalogImportApiRef);\n\n const hasGithubIntegration = configApi.has('integrations.github');\n\n const catalogFilename = useCatalogFilename();\n\n return (\n <InfoCard\n title=\"Register an existing component\"\n titleTypographyProps={{ component: 'h3' }}\n deepLink={{\n title: 'Learn more about the Software Catalog',\n link: 'https://backstage.io/docs/features/software-catalog/',\n }}\n >\n <Typography variant=\"body2\" paragraph>\n Enter the URL to your source code repository to add it to {appTitle}.\n </Typography>\n <Typography component=\"h4\" variant=\"h6\">\n Link to an existing entity file\n </Typography>\n <Typography variant=\"subtitle2\" color=\"textSecondary\" paragraph>\n Example: <code>{exampleLocationUrl}</code>\n </Typography>\n <Typography variant=\"body2\" paragraph>\n The wizard analyzes the file, previews the entities, and adds them to\n the {appTitle} catalog.\n </Typography>\n {hasGithubIntegration && (\n <>\n <Typography component=\"h4\" variant=\"h6\">\n Link to a repository{' '}\n <Chip label=\"GitHub only\" variant=\"outlined\" size=\"small\" />\n </Typography>\n <Typography variant=\"subtitle2\" color=\"textSecondary\" paragraph>\n Example: <code>{exampleRepositoryUrl}</code>\n </Typography>\n <Typography variant=\"body2\" paragraph>\n The wizard discovers all <code>{catalogFilename}</code> files in the\n repository, previews the entities, and adds them to the {appTitle}{' '}\n catalog.\n </Typography>\n {catalogImportApi.preparePullRequest && (\n <Typography variant=\"body2\" paragraph>\n If no entities are found, the wizard will prepare a Pull Request\n that adds an example <code>{catalogFilename}</code> and prepares\n the {appTitle} catalog to load all entities as soon as the Pull\n Request is merged.\n </Typography>\n )}\n </>\n )}\n </InfoCard>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity, CompoundEntityRef } from '@backstage/catalog-model';\nimport { useReducer } from 'react';\nimport { AnalyzeResult } from '../api';\n\n/**\n * The configuration of the stepper.\n *\n * @public\n */\nexport type ImportFlows =\n | 'unknown'\n | 'single-location'\n | 'multiple-locations'\n | 'no-location';\n\n// the available states of the stepper\ntype ImportStateTypes = 'analyze' | 'prepare' | 'review' | 'finish';\n\n/**\n * Result of the prepare state.\n *\n * @public\n */\nexport type PrepareResult =\n | {\n type: 'locations';\n locations: Array<{\n exists?: boolean;\n target: string;\n entities: CompoundEntityRef[];\n }>;\n }\n | {\n type: 'repository';\n url: string;\n integrationType: string;\n pullRequest: {\n url: string;\n };\n locations: Array<{\n target: string;\n entities: CompoundEntityRef[];\n }>;\n };\n\n// result of the review result\nexport type ReviewResult =\n | {\n type: 'locations';\n locations: Array<{\n target: string;\n entities: Entity[];\n }>;\n refreshed: Array<{ target: string }>;\n }\n | {\n type: 'repository';\n url: string;\n integrationType: string;\n pullRequest: {\n url: string;\n };\n locations: Array<{\n target: string;\n entities: Entity[];\n }>;\n };\n\n// function type for the 'analysis' -> 'prepare'/'review' transition\ntype onAnalysisFn = (\n flow: ImportFlows,\n url: string,\n result: AnalyzeResult,\n opts?: { prepareResult?: PrepareResult },\n) => void;\n\n// function type for the 'prepare' -> 'review' transition\ntype onPrepareFn = (\n result: PrepareResult,\n opts?: { notRepeatable?: boolean },\n) => void;\n\n// function type for the 'review' -> 'finish' transition\ntype onReviewFn = (result: ReviewResult) => void;\n\n// the type interfaces that are available in each state. every state provides\n// already known information and means to go to the next, or the previous step.\ntype State =\n | {\n activeState: 'analyze';\n onAnalysis: onAnalysisFn;\n }\n | {\n activeState: 'prepare';\n analyzeResult: AnalyzeResult;\n prepareResult?: PrepareResult;\n onPrepare: onPrepareFn;\n }\n | {\n activeState: 'review';\n analyzeResult: AnalyzeResult;\n prepareResult: PrepareResult;\n onReview: onReviewFn;\n }\n | {\n activeState: 'finish';\n analyzeResult: AnalyzeResult;\n prepareResult: PrepareResult;\n reviewResult: ReviewResult;\n };\n\nexport type ImportState = State & {\n activeFlow: ImportFlows;\n activeStepNumber: number;\n analysisUrl?: string;\n\n onGoBack?: () => void;\n onReset: () => void;\n};\n\ntype ReducerActions =\n | { type: 'onAnalysis'; args: Parameters<onAnalysisFn> }\n | { type: 'onPrepare'; args: Parameters<onPrepareFn> }\n | { type: 'onReview'; args: Parameters<onReviewFn> }\n | { type: 'onGoBack' }\n | { type: 'onReset'; initialUrl?: string };\n\ntype ReducerState = {\n activeFlow: ImportFlows;\n activeState: ImportStateTypes;\n analysisUrl?: string;\n analyzeResult?: AnalyzeResult;\n prepareResult?: PrepareResult;\n reviewResult?: ReviewResult;\n\n previousStates: ImportStateTypes[];\n};\n\nfunction init(initialUrl?: string): ReducerState {\n return {\n activeFlow: 'unknown',\n activeState: 'analyze',\n analysisUrl: initialUrl,\n previousStates: [],\n };\n}\n\nfunction reducer(state: ReducerState, action: ReducerActions): ReducerState {\n switch (action.type) {\n case 'onAnalysis': {\n if (state.activeState !== 'analyze') {\n return state;\n }\n\n const { activeState, previousStates } = state;\n const [activeFlow, analysisUrl, analyzeResult, opts] = action.args;\n\n return {\n ...state,\n analysisUrl,\n activeFlow,\n analyzeResult,\n prepareResult: opts?.prepareResult,\n\n activeState: opts?.prepareResult === undefined ? 'prepare' : 'review',\n previousStates: previousStates.concat(activeState),\n };\n }\n\n case 'onPrepare': {\n if (state.activeState !== 'prepare') {\n return state;\n }\n\n const { activeState, previousStates } = state;\n const [prepareResult, opts] = action.args;\n\n return {\n ...state,\n prepareResult,\n\n activeState: 'review',\n previousStates: opts?.notRepeatable\n ? []\n : previousStates.concat(activeState),\n };\n }\n\n case 'onReview': {\n if (state.activeState !== 'review') {\n return state;\n }\n\n const { activeState, previousStates } = state;\n const [reviewResult] = action.args;\n\n return {\n ...state,\n reviewResult,\n\n activeState: 'finish',\n previousStates: previousStates.concat(activeState),\n };\n }\n\n case 'onGoBack': {\n const { activeState, previousStates } = state;\n\n return {\n ...state,\n\n activeState:\n previousStates.length > 0\n ? previousStates[previousStates.length - 1]\n : activeState,\n previousStates: previousStates.slice(0, previousStates.length - 1),\n };\n }\n\n case 'onReset':\n return {\n ...init(action.initialUrl),\n\n // we keep the old prepareResult since the form is animated and an\n // undefined value might crash the last step.\n prepareResult: state.prepareResult,\n };\n\n default:\n throw new Error();\n }\n}\n\n/**\n * A hook that manages the state machine of the form. It handles different flows\n * which each can implement up to four states:\n * 1. analyze\n * 2. preview (skippable from analyze->review)\n * 3. review\n * 4. finish\n *\n * @param options - options\n */\nexport const useImportState = (options?: {\n initialUrl?: string;\n}): ImportState => {\n const [state, dispatch] = useReducer(reducer, options?.initialUrl, init);\n\n const { activeFlow, activeState, analysisUrl, previousStates } = state;\n\n return {\n activeFlow,\n activeState,\n activeStepNumber: ['analyze', 'prepare', 'review', 'finish'].indexOf(\n activeState,\n ),\n analysisUrl: analysisUrl,\n\n analyzeResult: state.analyzeResult!,\n prepareResult: state.prepareResult!,\n reviewResult: state.reviewResult!,\n\n onAnalysis: (flow, url, result, opts) =>\n dispatch({\n type: 'onAnalysis',\n args: [flow, url, result, opts],\n }),\n\n onPrepare: (result, opts) =>\n dispatch({\n type: 'onPrepare',\n args: [result, opts],\n }),\n\n onReview: result => dispatch({ type: 'onReview', args: [result] }),\n\n onGoBack:\n previousStates.length > 0\n ? () => dispatch({ type: 'onGoBack' })\n : undefined,\n\n onReset: () =>\n dispatch({ type: 'onReset', initialUrl: options?.initialUrl }),\n };\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LinkButton } from '@backstage/core-components';\nimport { Button, CircularProgress } from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { ComponentProps } from 'react';\n\nconst useStyles = makeStyles(theme => ({\n wrapper: {\n marginTop: theme.spacing(1),\n marginRight: theme.spacing(1),\n position: 'relative',\n },\n buttonProgress: {\n position: 'absolute',\n top: '50%',\n left: '50%',\n marginTop: -12,\n marginLeft: -12,\n },\n button: {\n marginTop: theme.spacing(1),\n marginRight: theme.spacing(1),\n },\n}));\n\nexport const NextButton = (\n props: ComponentProps<typeof Button> & { loading?: boolean },\n) => {\n const { loading, ...buttonProps } = props;\n const classes = useStyles();\n\n return (\n <div className={classes.wrapper}>\n <Button\n color=\"primary\"\n variant=\"contained\"\n {...buttonProps}\n disabled={props.disabled || props.loading}\n />\n {props.loading && (\n <CircularProgress size=\"1.5rem\" className={classes.buttonProgress} />\n )}\n {props.loading}\n </div>\n );\n};\n\nexport const BackButton = (props: ComponentProps<typeof Button>) => {\n const classes = useStyles();\n\n return (\n <Button variant=\"outlined\" className={classes.button} {...props}>\n {props.children || 'Back'}\n </Button>\n );\n};\n\nexport const ViewComponentButton = (\n props: ComponentProps<typeof LinkButton>,\n) => {\n const classes = useStyles();\n\n return (\n <LinkButton\n color=\"primary\"\n variant=\"contained\"\n className={classes.button}\n {...props}\n >\n {props.children}\n </LinkButton>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity, CompoundEntityRef } from '@backstage/catalog-model';\nimport { useApp } from '@backstage/core-plugin-api';\nimport {\n EntityRefLink,\n humanizeEntityRef,\n} from '@backstage/plugin-catalog-react';\nimport {\n Collapse,\n IconButton,\n List,\n ListItem,\n ListItemIcon,\n ListItemSecondaryAction,\n ListItemText,\n} from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ExpandLessIcon from '@material-ui/icons/ExpandLess';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport React, { useState } from 'react';\n\nconst useStyles = makeStyles(theme => ({\n nested: {\n paddingLeft: theme.spacing(4),\n },\n}));\n\nfunction sortEntities(entities: Array<CompoundEntityRef | Entity>) {\n return entities.sort((a, b) =>\n humanizeEntityRef(a).localeCompare(humanizeEntityRef(b)),\n );\n}\n\n/**\n * Props for {@link EntityListComponent}.\n *\n * @public\n */\nexport interface EntityListComponentProps {\n locations: Array<{\n target: string;\n entities: (Entity | CompoundEntityRef)[];\n }>;\n locationListItemIcon: (target: string) => React.ReactElement;\n collapsed?: boolean;\n firstListItem?: React.ReactElement;\n onItemClick?: (target: string) => void;\n withLinks?: boolean;\n}\n\n/**\n * Shows a result list of entities.\n *\n * @public\n */\nexport const EntityListComponent = (props: EntityListComponentProps) => {\n const {\n locations,\n collapsed = false,\n locationListItemIcon,\n onItemClick,\n firstListItem,\n withLinks = false,\n } = props;\n\n const app = useApp();\n const classes = useStyles();\n\n const [expandedUrls, setExpandedUrls] = useState<string[]>([]);\n\n const handleClick = (url: string) => {\n setExpandedUrls(urls =>\n urls.includes(url) ? urls.filter(u => u !== url) : urls.concat(url),\n );\n };\n\n return (\n <List>\n {firstListItem}\n {locations.map(r => (\n <React.Fragment key={r.target}>\n <ListItem\n dense\n button={Boolean(onItemClick) as any}\n onClick={() => onItemClick?.(r.target)}\n >\n <ListItemIcon>{locationListItemIcon(r.target)}</ListItemIcon>\n\n <ListItemText\n primary={r.target}\n secondary={`Entities: ${r.entities.length}`}\n />\n\n {collapsed && (\n <ListItemSecondaryAction>\n <IconButton edge=\"end\" onClick={() => handleClick(r.target)}>\n {expandedUrls.includes(r.target) ? (\n <ExpandLessIcon />\n ) : (\n <ExpandMoreIcon />\n )}\n </IconButton>\n </ListItemSecondaryAction>\n )}\n </ListItem>\n\n <Collapse\n in={!collapsed || expandedUrls.includes(r.target)}\n timeout=\"auto\"\n unmountOnExit\n >\n <List component=\"div\" disablePadding dense>\n {sortEntities(r.entities).map(entity => {\n const Icon = app.getSystemIcon(\n `kind:${entity.kind.toLocaleLowerCase('en-US')}`,\n );\n return (\n <ListItem\n key={humanizeEntityRef(entity)}\n className={classes.nested}\n {...(withLinks\n ? {\n component: EntityRefLink,\n entityRef: entity,\n button: withLinks as any,\n }\n : {})}\n >\n <ListItemIcon>{Icon && <Icon />}</ListItemIcon>\n <ListItemText primary={humanizeEntityRef(entity)} />\n </ListItem>\n );\n })}\n </List>\n </Collapse>\n </React.Fragment>\n ))}\n </List>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Grid, Typography } from '@material-ui/core';\nimport LocationOnIcon from '@material-ui/icons/LocationOn';\nimport React from 'react';\nimport { BackButton, ViewComponentButton } from '../Buttons';\nimport { EntityListComponent } from '../EntityListComponent';\nimport { PrepareResult } from '../useImportState';\nimport { Link } from '@backstage/core-components';\nimport partition from 'lodash/partition';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\ntype Props = {\n prepareResult: PrepareResult;\n onReset: () => void;\n};\n\n// Among the newly registered entities, return a software entity (e.g. Component, API, Resource)\nconst filterComponentEntity = (\n newLocations: Array<{\n exists?: boolean;\n target: string;\n entities: CompoundEntityRef[];\n }>,\n): CompoundEntityRef | null => {\n for (const location of newLocations) {\n for (const entity of location.entities) {\n if (\n ['component', 'api', 'resource'].includes(\n entity.kind.toLocaleLowerCase('en-US'),\n )\n ) {\n return entity;\n }\n }\n }\n\n return null;\n};\n\nexport const StepFinishImportLocation = ({ prepareResult, onReset }: Props) => {\n const entityRoute = useRouteRef(entityRouteRef);\n\n if (prepareResult.type === 'repository') {\n return (\n <>\n <Typography paragraph>\n The following Pull Request has been opened:{' '}\n <Link\n to={prepareResult.pullRequest.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {prepareResult.pullRequest.url}\n </Link>\n </Typography>\n <Typography paragraph>\n Your entities will be imported as soon as the Pull Request is merged.\n </Typography>\n <Grid container spacing={0}>\n <BackButton onClick={onReset}>Register another</BackButton>\n </Grid>\n ;\n </>\n );\n }\n\n const [existingLocations, newLocations] = partition(\n prepareResult.locations,\n l => l.exists,\n );\n const newComponentEntity = filterComponentEntity(newLocations);\n return (\n <>\n {newLocations.length > 0 && (\n <>\n <Typography>\n The following entities have been added to the catalog:\n </Typography>\n\n <EntityListComponent\n locations={newLocations}\n locationListItemIcon={() => <LocationOnIcon />}\n withLinks\n />\n </>\n )}\n {existingLocations.length > 0 && (\n <>\n <Typography>\n A refresh was triggered for the following locations:\n </Typography>\n\n <EntityListComponent\n locations={existingLocations}\n locationListItemIcon={() => <LocationOnIcon />}\n withLinks\n />\n </>\n )}\n <Grid container spacing={0}>\n {newComponentEntity && (\n <ViewComponentButton to={entityRoute(newComponentEntity)}>\n View Component\n </ViewComponentButton>\n )}\n <BackButton onClick={onReset}>Register another</BackButton>\n </Grid>\n </>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { FormHelperText, Grid, TextField } from '@material-ui/core';\nimport React, { useCallback, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { AnalyzeResult, catalogImportApiRef } from '../../api';\nimport { NextButton } from '../Buttons';\nimport { asInputRef } from '../helpers';\nimport { ImportFlows, PrepareResult } from '../useImportState';\n\ntype FormData = {\n url: string;\n};\n\n/**\n * Props for {@link StepInitAnalyzeUrl}.\n *\n * @public\n */\nexport interface StepInitAnalyzeUrlProps {\n onAnalysis: (\n flow: ImportFlows,\n url: string,\n result: AnalyzeResult,\n opts?: { prepareResult?: PrepareResult },\n ) => void;\n disablePullRequest?: boolean;\n analysisUrl?: string;\n exampleLocationUrl?: string;\n}\n\n/**\n * A form that lets the user input a url and analyze it for existing locations or potential entities.\n *\n * @param onAnalysis - is called when the analysis was successful\n * @param analysisUrl - a url that can be used as a default value\n * @param disablePullRequest - if true, repositories without entities will abort the wizard\n * @public\n */\nexport const StepInitAnalyzeUrl = (props: StepInitAnalyzeUrlProps) => {\n const {\n onAnalysis,\n analysisUrl = '',\n disablePullRequest = false,\n exampleLocationUrl = 'https://github.com/backstage/backstage/blob/master/catalog-info.yaml',\n } = props;\n\n const errorApi = useApi(errorApiRef);\n const catalogImportApi = useApi(catalogImportApiRef);\n\n const {\n register,\n handleSubmit,\n formState: { errors },\n watch,\n } = useForm<FormData>({\n mode: 'onTouched',\n defaultValues: {\n url: analysisUrl,\n },\n });\n\n const [submitted, setSubmitted] = useState(false);\n const [error, setError] = useState<string | undefined>(undefined);\n\n const handleResult = useCallback(\n async ({ url }: FormData) => {\n setSubmitted(true);\n\n try {\n const analysisResult = await catalogImportApi.analyzeUrl(url);\n\n switch (analysisResult.type) {\n case 'repository':\n if (\n !disablePullRequest &&\n analysisResult.generatedEntities.length > 0\n ) {\n onAnalysis('no-location', url, analysisResult);\n } else {\n setError(\"Couldn't generate entities for your repository\");\n setSubmitted(false);\n }\n break;\n\n case 'locations': {\n if (analysisResult.locations.length === 1) {\n onAnalysis('single-location', url, analysisResult, {\n prepareResult: analysisResult,\n });\n } else if (analysisResult.locations.length > 1) {\n onAnalysis('multiple-locations', url, analysisResult);\n } else {\n setError('There are no entities at this location');\n setSubmitted(false);\n }\n break;\n }\n\n default: {\n const err = `Received unknown analysis result of type ${\n (analysisResult as any).type\n }. Please contact the support team.`;\n setError(err);\n setSubmitted(false);\n\n errorApi.post(new Error(err));\n break;\n }\n }\n } catch (e: any) {\n setError(e?.data?.error?.message ?? e.message);\n setSubmitted(false);\n }\n },\n [catalogImportApi, disablePullRequest, errorApi, onAnalysis],\n );\n\n return (\n <form onSubmit={handleSubmit(handleResult)}>\n <TextField\n {...asInputRef(\n register('url', {\n required: true,\n validate: {\n httpsValidator: (value: any) =>\n (typeof value === 'string' &&\n value.match(/^http[s]?:\\/\\//) !== null) ||\n 'Must start with http:// or https://.',\n },\n }),\n )}\n fullWidth\n id=\"url\"\n label=\"URL\"\n placeholder={exampleLocationUrl}\n helperText=\"Enter the full path to your entity file to start tracking your component\"\n margin=\"normal\"\n variant=\"outlined\"\n error={Boolean(errors.url)}\n required\n />\n\n {errors.url && (\n <FormHelperText error>{errors.url.message}</FormHelperText>\n )}\n\n {error && <FormHelperText error>{error}</FormHelperText>}\n\n <Grid container spacing={0}>\n <NextButton\n disabled={Boolean(errors.url) || !watch('url')}\n loading={submitted}\n type=\"submit\"\n >\n Analyze\n </NextButton>\n </Grid>\n </form>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CircularProgress, TextField } from '@material-ui/core';\nimport { TextFieldProps } from '@material-ui/core/TextField/TextField';\nimport { Autocomplete } from '@material-ui/lab';\nimport React from 'react';\nimport { Controller, FieldErrors } from 'react-hook-form';\n\n/**\n * Props for {@link AutocompleteTextField}.\n *\n * @public\n */\nexport interface AutocompleteTextFieldProps<TFieldValue extends string> {\n name: TFieldValue;\n options: string[];\n required?: boolean;\n\n errors?: FieldErrors;\n rules?: React.ComponentProps<typeof Controller>['rules'];\n\n loading?: boolean;\n loadingText?: string;\n\n helperText?: React.ReactNode;\n errorHelperText?: string;\n\n textFieldProps?: Omit<TextFieldProps, 'required' | 'fullWidth'>;\n}\n\n/**\n * An autocompletion text field for the catalog import flows.\n *\n * @public\n */\nexport const AutocompleteTextField = <TFieldValue extends string>(\n props: AutocompleteTextFieldProps<TFieldValue>,\n) => {\n const {\n name,\n options,\n required,\n errors,\n rules,\n loading = false,\n loadingText,\n helperText,\n errorHelperText,\n textFieldProps = {},\n } = props;\n\n return (\n <Controller\n name={name}\n rules={rules}\n render={({ field: { onChange } }) => (\n <Autocomplete\n loading={loading}\n loadingText={loadingText}\n options={options || []}\n autoSelect\n freeSolo\n onChange={(_event: React.ChangeEvent<{}>, value: string | null) =>\n onChange(value)\n }\n renderInput={params => (\n <TextField\n {...params}\n helperText={(errors?.[name] && errorHelperText) || helperText}\n error={Boolean(errors?.[name])}\n margin=\"normal\"\n variant=\"outlined\"\n required={required}\n InputProps={{\n ...params.InputProps,\n endAdornment: (\n <React.Fragment>\n {loading ? (\n <CircularProgress color=\"inherit\" size=\"1em\" />\n ) : null}\n {params.InputProps.endAdornment}\n </React.Fragment>\n ),\n }}\n {...textFieldProps}\n />\n )}\n />\n )}\n />\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport {\n FormProvider,\n SubmitHandler,\n useForm,\n UseFormProps,\n UseFormReturn,\n} from 'react-hook-form';\n\n/**\n * Props for {@link PreparePullRequestForm}.\n *\n * @public\n */\nexport type PreparePullRequestFormProps<\n TFieldValues extends Record<string, any>,\n> = Pick<UseFormProps<TFieldValues>, 'defaultValues'> & {\n onSubmit: SubmitHandler<TFieldValues>;\n\n render: (\n props: Pick<\n UseFormReturn<TFieldValues>,\n 'formState' | 'register' | 'control' | 'setValue'\n > & {\n values: TFieldValues;\n },\n ) => React.ReactNode;\n};\n\n/**\n * A form wrapper that creates a form that is used to prepare a pull request. It\n * hosts the form logic.\n *\n * @param defaultValues - the default values of the form\n * @param onSubmit - a callback that is executed when the form is submitted\n * (initiated by a button of type=\"submit\")\n * @param render - render the form elements\n * @public\n */\nexport const PreparePullRequestForm = <\n TFieldValues extends Record<string, any>,\n>(\n props: PreparePullRequestFormProps<TFieldValues>,\n) => {\n const { defaultValues, onSubmit, render } = props;\n\n const methods = useForm<TFieldValues>({ mode: 'onTouched', defaultValues });\n const { handleSubmit, watch, control, register, formState, setValue } =\n methods;\n\n return (\n <FormProvider {...methods}>\n <form onSubmit={handleSubmit(onSubmit)}>\n {render({ values: watch(), formState, register, control, setValue })}\n </form>\n </FormProvider>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport { Card, CardContent, CardHeader } from '@material-ui/core';\nimport React from 'react';\nimport YAML from 'yaml';\nimport { CodeSnippet } from '@backstage/core-components';\nimport { trimEnd } from 'lodash';\nimport { useCatalogFilename } from '../../hooks';\n\n/**\n * Props for {@link PreviewCatalogInfoComponent}.\n *\n * @public\n */\nexport interface PreviewCatalogInfoComponentProps {\n repositoryUrl: string;\n entities: Entity[];\n classes?: { card?: string; cardContent?: string };\n}\n\n/**\n * Previews information about an entity to create.\n *\n * @public\n */\nexport const PreviewCatalogInfoComponent = (\n props: PreviewCatalogInfoComponentProps,\n) => {\n const { repositoryUrl, entities, classes } = props;\n const catalogFilename = useCatalogFilename();\n\n return (\n <Card variant=\"outlined\" className={classes?.card}>\n <CardHeader\n title={\n <code>{`${trimEnd(repositoryUrl, '/')}/${catalogFilename}`}</code>\n }\n />\n\n <CardContent className={classes?.cardContent}>\n <CodeSnippet\n text={entities\n .map(e => YAML.stringify(e))\n .join('---\\n')\n .trim()}\n language=\"yaml\"\n />\n </CardContent>\n </Card>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Card, CardContent, CardHeader } from '@material-ui/core';\nimport React from 'react';\nimport { MarkdownContent } from '@backstage/core-components';\n\n/**\n * Props for {@link PreviewPullRequestComponent}.\n *\n * @public\n */\nexport interface PreviewPullRequestComponentProps {\n title: string;\n description: string;\n classes?: { card?: string; cardContent?: string };\n}\n\n/**\n * Previews a pull request.\n *\n * @public\n */\nexport const PreviewPullRequestComponent = (\n props: PreviewPullRequestComponentProps,\n) => {\n const { title, description, classes } = props;\n return (\n <Card variant=\"outlined\" className={classes?.card}>\n <CardHeader title={title} subheader=\"Create a new Pull Request\" />\n <CardContent className={classes?.cardContent}>\n <MarkdownContent content={description} />\n </CardContent>\n </Card>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { assertError } from '@backstage/errors';\nimport {\n catalogApiRef,\n humanizeEntityRef,\n} from '@backstage/plugin-catalog-react';\nimport { Box, FormHelperText, Grid, Typography } from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport { UnpackNestedValue, UseFormReturn } from 'react-hook-form';\nimport useAsync from 'react-use/lib/useAsync';\nimport YAML from 'yaml';\nimport { AnalyzeResult, catalogImportApiRef } from '../../api';\nimport { useCatalogFilename } from '../../hooks';\nimport { PartialEntity } from '../../types';\nimport { BackButton, NextButton } from '../Buttons';\nimport { PrepareResult } from '../useImportState';\nimport { PreparePullRequestForm } from './PreparePullRequestForm';\nimport { PreviewCatalogInfoComponent } from './PreviewCatalogInfoComponent';\nimport { PreviewPullRequestComponent } from './PreviewPullRequestComponent';\n\nconst useStyles = makeStyles(theme => ({\n previewCard: {\n marginTop: theme.spacing(1),\n },\n previewCardContent: {\n paddingTop: 0,\n },\n}));\n\ntype FormData = {\n title: string;\n body: string;\n componentName: string;\n owner: string;\n useCodeowners: boolean;\n};\n\n/**\n * Props for {@link StepPrepareCreatePullRequest}.\n *\n * @public\n */\nexport interface StepPrepareCreatePullRequestProps {\n analyzeResult: Extract<AnalyzeResult, { type: 'repository' }>;\n onPrepare: (\n result: PrepareResult,\n opts?: { notRepeatable?: boolean },\n ) => void;\n onGoBack?: () => void;\n\n renderFormFields: (\n props: Pick<\n UseFormReturn<FormData>,\n 'register' | 'setValue' | 'formState'\n > & {\n values: UnpackNestedValue<FormData>;\n groups: string[];\n groupsLoading: boolean;\n },\n ) => React.ReactNode;\n}\n\nexport function generateEntities(\n entities: PartialEntity[],\n componentName: string,\n owner?: string,\n): Entity[] {\n return entities.map(e => ({\n ...e,\n apiVersion: e.apiVersion!,\n kind: e.kind!,\n metadata: {\n ...e.metadata,\n name: componentName,\n },\n spec: {\n ...e.spec,\n ...(owner ? { owner } : {}),\n },\n }));\n}\n\n/**\n * Prepares a pull request.\n *\n * @public\n */\nexport const StepPrepareCreatePullRequest = (\n props: StepPrepareCreatePullRequestProps,\n) => {\n const { analyzeResult, onPrepare, onGoBack, renderFormFields } = props;\n\n const classes = useStyles();\n const catalogApi = useApi(catalogApiRef);\n const catalogImportApi = useApi(catalogImportApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [submitted, setSubmitted] = useState(false);\n const [error, setError] = useState<string>();\n\n const catalogFilename = useCatalogFilename();\n\n const {\n loading: prDefaultsLoading,\n value: prDefaults,\n error: prDefaultsError,\n } = useAsync(\n () => catalogImportApi.preparePullRequest!(),\n [catalogImportApi.preparePullRequest],\n );\n\n useEffect(() => {\n if (prDefaultsError) {\n errorApi.post(prDefaultsError);\n }\n }, [prDefaultsError, errorApi]);\n\n const { loading: groupsLoading, value: groups } = useAsync(async () => {\n const groupEntities = await catalogApi.getEntities({\n filter: { kind: 'group' },\n });\n\n return groupEntities.items\n .map(e => humanizeEntityRef(e, { defaultKind: 'group' }))\n .sort();\n });\n\n const handleResult = useCallback(\n async (data: FormData) => {\n setSubmitted(true);\n\n try {\n const pr = await catalogImportApi.submitPullRequest({\n repositoryUrl: analyzeResult.url,\n title: data.title,\n body: data.body,\n fileContent: generateEntities(\n analyzeResult.generatedEntities,\n data.componentName,\n data.owner,\n )\n .map(e => YAML.stringify(e))\n .join('---\\n'),\n });\n\n onPrepare(\n {\n type: 'repository',\n url: analyzeResult.url,\n integrationType: analyzeResult.integrationType,\n pullRequest: {\n url: pr.link,\n },\n locations: [\n {\n target: pr.location,\n entities: generateEntities(\n analyzeResult.generatedEntities,\n data.componentName,\n data.owner,\n ).map(e => ({\n kind: e.kind,\n namespace: e.metadata.namespace!,\n name: e.metadata.name,\n })),\n },\n ],\n },\n { notRepeatable: true },\n );\n } catch (e) {\n assertError(e);\n setError(e.message);\n setSubmitted(false);\n }\n },\n [\n analyzeResult.generatedEntities,\n analyzeResult.integrationType,\n analyzeResult.url,\n catalogImportApi,\n onPrepare,\n ],\n );\n\n return (\n <>\n <Typography>\n You entered a link to a {analyzeResult.integrationType} repository but a{' '}\n <code>{catalogFilename}</code> could not be found. Use this form to open\n a Pull Request that creates one.\n </Typography>\n\n {!prDefaultsLoading && (\n <PreparePullRequestForm<FormData>\n onSubmit={handleResult}\n defaultValues={{\n title: prDefaults?.title ?? '',\n body: prDefaults?.body ?? '',\n owner:\n (analyzeResult.generatedEntities[0]?.spec?.owner as string) || '',\n componentName:\n analyzeResult.generatedEntities[0]?.metadata?.name || '',\n useCodeowners: false,\n }}\n render={({ values, formState, register, setValue }) => (\n <>\n {renderFormFields({\n values,\n formState,\n register,\n setValue,\n groups: groups ?? [],\n groupsLoading,\n })}\n\n <Box marginTop={2}>\n <Typography variant=\"h6\">Preview Pull Request</Typography>\n </Box>\n\n <PreviewPullRequestComponent\n title={values.title}\n description={values.body}\n classes={{\n card: classes.previewCard,\n cardContent: classes.previewCardContent,\n }}\n />\n\n <Box marginTop={2} marginBottom={1}>\n <Typography variant=\"h6\">Preview Entities</Typography>\n </Box>\n\n <PreviewCatalogInfoComponent\n entities={generateEntities(\n analyzeResult.generatedEntities,\n values.componentName,\n values.owner,\n )}\n repositoryUrl={analyzeResult.url}\n classes={{\n card: classes.previewCard,\n cardContent: classes.previewCardContent,\n }}\n />\n\n {error && <FormHelperText error>{error}</FormHelperText>}\n\n <Grid container spacing={0}>\n {onGoBack && (\n <BackButton onClick={onGoBack} disabled={submitted} />\n )}\n <NextButton\n type=\"submit\"\n disabled={Boolean(\n formState.errors.title ||\n formState.errors.body ||\n formState.errors.owner,\n )}\n loading={submitted}\n >\n Create PR\n </NextButton>\n </Grid>\n </>\n )}\n />\n )}\n </>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Checkbox,\n Grid,\n ListItem,\n ListItemIcon,\n ListItemText,\n Typography,\n} from '@material-ui/core';\nimport LocationOnIcon from '@material-ui/icons/LocationOn';\nimport React, { useCallback, useState } from 'react';\nimport { AnalyzeResult } from '../../api';\nimport { BackButton, NextButton } from '../Buttons';\nimport { EntityListComponent } from '../EntityListComponent';\nimport { PrepareResult } from '../useImportState';\nimport partition from 'lodash/partition';\n\ntype Props = {\n analyzeResult: Extract<AnalyzeResult, { type: 'locations' }>;\n prepareResult?: PrepareResult;\n onPrepare: (result: PrepareResult) => void;\n onGoBack?: () => void;\n};\n\n/**\n * A form that lets a user select one of a list of locations to import\n *\n * @param analyzeResult - the result of the analysis\n * @param prepareResult - the selectected locations from a previous step\n * @param onPrepare - called after the selection\n * @param onGoBack - called to go back to the previous step\n */\nexport const StepPrepareSelectLocations = ({\n analyzeResult,\n prepareResult,\n onPrepare,\n onGoBack,\n}: Props) => {\n const [selectedUrls, setSelectedUrls] = useState<string[]>(\n prepareResult?.locations.map(l => l.target) || [],\n );\n\n const [existingLocations, locations] = partition(\n analyzeResult?.locations,\n l => l.exists,\n );\n\n const handleResult = useCallback(async () => {\n onPrepare({\n type: 'locations',\n locations: locations.filter((l: any) => selectedUrls.includes(l.target)),\n });\n }, [locations, onPrepare, selectedUrls]);\n\n const onItemClick = (url: string) => {\n setSelectedUrls(urls =>\n urls.includes(url) ? urls.filter(u => u !== url) : urls.concat(url),\n );\n };\n\n const onSelectAll = () => {\n setSelectedUrls(urls =>\n urls.length < locations.length ? locations.map(l => l.target) : [],\n );\n };\n\n return (\n <>\n {locations.length > 0 && (\n <>\n <Typography>\n Select one or more locations that are present in your git\n repository:\n </Typography>\n <EntityListComponent\n firstListItem={\n <ListItem dense button onClick={onSelectAll}>\n <ListItemIcon>\n <Checkbox\n edge=\"start\"\n checked={selectedUrls.length === locations.length}\n indeterminate={\n selectedUrls.length > 0 &&\n selectedUrls.length < locations.length\n }\n tabIndex={-1}\n disableRipple\n />\n </ListItemIcon>\n <ListItemText primary=\"Select All\" />\n </ListItem>\n }\n onItemClick={onItemClick}\n locations={locations}\n locationListItemIcon={target => (\n <Checkbox\n edge=\"start\"\n checked={selectedUrls.includes(target)}\n tabIndex={-1}\n disableRipple\n />\n )}\n collapsed\n />\n </>\n )}\n\n {existingLocations.length > 0 && (\n <>\n <Typography>These locations already exist in the catalog:</Typography>\n <EntityListComponent\n locations={existingLocations}\n locationListItemIcon={() => <LocationOnIcon />}\n withLinks\n collapsed\n />\n </>\n )}\n\n <Grid container spacing={0}>\n {onGoBack && <BackButton onClick={onGoBack} />}\n <NextButton disabled={selectedUrls.length === 0} onClick={handleResult}>\n Review\n </NextButton>\n </Grid>\n </>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { FormHelperText, Grid, Typography } from '@material-ui/core';\nimport LocationOnIcon from '@material-ui/icons/LocationOn';\nimport React, { useCallback, useState } from 'react';\nimport { BackButton, NextButton } from '../Buttons';\nimport { EntityListComponent } from '../EntityListComponent';\nimport { PrepareResult, ReviewResult } from '../useImportState';\n\nimport { configApiRef, useAnalytics, useApi } from '@backstage/core-plugin-api';\nimport { Link } from '@backstage/core-components';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { assertError } from '@backstage/errors';\n\ntype Props = {\n prepareResult: PrepareResult;\n onReview: (result: ReviewResult) => void;\n onGoBack?: () => void;\n};\n\nexport const StepReviewLocation = ({\n prepareResult,\n onReview,\n onGoBack,\n}: Props) => {\n const catalogApi = useApi(catalogApiRef);\n const configApi = useApi(configApiRef);\n const analytics = useAnalytics();\n\n const appTitle = configApi.getOptionalString('app.title') || 'Backstage';\n\n const [submitted, setSubmitted] = useState(false);\n const [error, setError] = useState<string>();\n const exists =\n prepareResult.type === 'locations' &&\n prepareResult.locations.some(l => l.exists)\n ? true\n : false;\n const handleClick = useCallback(async () => {\n setSubmitted(true);\n analytics.captureEvent('click', 'import entity');\n try {\n let refreshed = new Array<{ target: string }>();\n if (prepareResult.type === 'locations') {\n refreshed = await Promise.all(\n prepareResult.locations\n .filter(l => l.exists)\n .map(async l => {\n const ref = stringifyEntityRef(l.entities[0] ?? l);\n await catalogApi.refreshEntity(ref);\n return { target: l.target };\n }),\n );\n }\n\n const locations = await Promise.all(\n prepareResult.locations\n .filter((l: unknown) => !(l as { exists?: boolean }).exists)\n .map(async l => {\n const result = await catalogApi.addLocation({\n type: 'url',\n target: l.target,\n });\n return {\n target: result.location.target,\n entities: result.entities,\n };\n }),\n );\n\n onReview({\n ...prepareResult,\n ...{ refreshed },\n locations,\n });\n } catch (e) {\n assertError(e);\n // TODO: this error should be handled differently. We add it as 'optional' and\n // it is not uncommon that a PR has not been merged yet.\n if (\n prepareResult.type === 'repository' &&\n e.message.startsWith(\n 'Location was added but has no entities specified yet',\n )\n ) {\n onReview({\n ...prepareResult,\n locations: prepareResult.locations.map(l => ({\n target: l.target,\n entities: [],\n })),\n });\n } else {\n setError(e.message);\n setSubmitted(false);\n }\n }\n }, [prepareResult, onReview, catalogApi, analytics]);\n\n return (\n <>\n {prepareResult.type === 'repository' && (\n <>\n <Typography paragraph>\n The following Pull Request has been opened:{' '}\n <Link\n to={prepareResult.pullRequest.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {prepareResult.pullRequest.url}\n </Link>\n </Typography>\n\n <Typography paragraph>\n You can already import the location and {appTitle} will fetch the\n entities as soon as the Pull Request is merged.\n </Typography>\n </>\n )}\n\n <Typography>\n {exists\n ? 'The following locations already exist in the catalog:'\n : 'The following entities will be added to the catalog:'}\n </Typography>\n\n <EntityListComponent\n locations={prepareResult.locations}\n locationListItemIcon={() => <LocationOnIcon />}\n />\n\n {error && <FormHelperText error>{error}</FormHelperText>}\n\n <Grid container spacing={0}>\n {onGoBack && <BackButton onClick={onGoBack} disabled={submitted} />}\n <NextButton\n disabled={submitted}\n loading={submitted}\n onClick={() => handleClick()}\n >\n {exists ? 'Refresh' : 'Import'}\n </NextButton>\n </Grid>\n </>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Box,\n Checkbox,\n FormControlLabel,\n FormHelperText,\n StepLabel,\n TextField,\n Typography,\n} from '@material-ui/core';\nimport React from 'react';\nimport { BackButton } from '../Buttons';\nimport { asInputRef } from '../helpers';\nimport { StepFinishImportLocation } from '../StepFinishImportLocation';\nimport { StepInitAnalyzeUrl } from '../StepInitAnalyzeUrl';\nimport {\n AutocompleteTextField,\n StepPrepareCreatePullRequest,\n} from '../StepPrepareCreatePullRequest';\nimport { StepPrepareSelectLocations } from '../StepPrepareSelectLocations';\nimport { StepReviewLocation } from '../StepReviewLocation';\nimport { StepperApis } from '../types';\nimport { ImportFlows, ImportState } from '../useImportState';\n\nexport type StepConfiguration = {\n stepLabel: React.ReactElement;\n content: React.ReactElement;\n};\n\n/**\n * Defines the details of the stepper.\n *\n * @public\n */\nexport interface StepperProvider {\n analyze: (\n s: Extract<ImportState, { activeState: 'analyze' }>,\n opts: { apis: StepperApis },\n ) => StepConfiguration;\n prepare: (\n s: Extract<ImportState, { activeState: 'prepare' }>,\n opts: { apis: StepperApis },\n ) => StepConfiguration;\n review: (\n s: Extract<ImportState, { activeState: 'review' }>,\n opts: { apis: StepperApis },\n ) => StepConfiguration;\n finish: (\n s: Extract<ImportState, { activeState: 'finish' }>,\n opts: { apis: StepperApis },\n ) => StepConfiguration;\n}\n\n/**\n * The default stepper generation function.\n *\n * Override this function to customize the import flow. Each flow should at\n * least override the prepare operation.\n *\n * @param flow - the name of the active flow\n * @param defaults - the default steps\n * @public\n */\nexport function defaultGenerateStepper(\n flow: ImportFlows,\n defaults: StepperProvider,\n): StepperProvider {\n switch (flow) {\n // the prepare step is skipped but the label of the step is updated\n case 'single-location':\n return {\n ...defaults,\n prepare: () => ({\n stepLabel: (\n <StepLabel\n optional={\n <Typography variant=\"caption\">\n Discovered Locations: 1\n </Typography>\n }\n >\n Select Locations\n </StepLabel>\n ),\n content: <></>,\n }),\n };\n\n // let the user select one or more of the discovered locations in the prepare step\n case 'multiple-locations':\n return {\n ...defaults,\n prepare: (state, opts) => {\n if (state.analyzeResult.type !== 'locations') {\n return defaults.prepare(state, opts);\n }\n\n return {\n stepLabel: (\n <StepLabel\n optional={\n <Typography variant=\"caption\">\n Discovered Locations: {state.analyzeResult.locations.length}\n </Typography>\n }\n >\n Select Locations\n </StepLabel>\n ),\n content: (\n <StepPrepareSelectLocations\n analyzeResult={state.analyzeResult}\n prepareResult={state.prepareResult}\n onPrepare={state.onPrepare}\n onGoBack={state.onGoBack}\n />\n ),\n };\n },\n };\n\n case 'no-location':\n return {\n ...defaults,\n prepare: (state, opts) => {\n if (state.analyzeResult.type !== 'repository') {\n return defaults.prepare(state, opts);\n }\n\n return {\n stepLabel: <StepLabel>Create Pull Request</StepLabel>,\n content: (\n <StepPrepareCreatePullRequest\n analyzeResult={state.analyzeResult}\n onPrepare={state.onPrepare}\n onGoBack={state.onGoBack}\n renderFormFields={({\n values,\n setValue,\n formState,\n groupsLoading,\n groups,\n register,\n }) => (\n <>\n <Box marginTop={2}>\n <Typography variant=\"h6\">Pull Request Details</Typography>\n </Box>\n\n <TextField\n {...asInputRef(\n register('title', {\n required: true,\n }),\n )}\n label=\"Pull Request Title\"\n placeholder=\"Add Backstage catalog entity descriptor files\"\n margin=\"normal\"\n variant=\"outlined\"\n fullWidth\n error={Boolean(formState.errors.title)}\n required\n />\n\n <TextField\n {...asInputRef(\n register('body', {\n required: true,\n }),\n )}\n label=\"Pull Request Body\"\n placeholder=\"A describing text with Markdown support\"\n margin=\"normal\"\n variant=\"outlined\"\n fullWidth\n error={Boolean(formState.errors.body)}\n multiline\n required\n />\n\n <Box marginTop={2}>\n <Typography variant=\"h6\">Entity Configuration</Typography>\n </Box>\n\n <TextField\n {...asInputRef(\n register('componentName', { required: true }),\n )}\n label=\"Name of the created component\"\n placeholder=\"my-component\"\n margin=\"normal\"\n variant=\"outlined\"\n fullWidth\n error={Boolean(formState.errors.componentName)}\n required\n />\n\n {!values.useCodeowners && (\n <AutocompleteTextField\n name=\"owner\"\n errors={formState.errors}\n options={groups || []}\n loading={groupsLoading}\n loadingText=\"Loading groups…\"\n helperText=\"Select an owner from the list or enter a reference to a Group or a User\"\n errorHelperText=\"required value\"\n textFieldProps={{\n label: 'Entity Owner',\n placeholder: 'my-group',\n }}\n rules={{ required: true }}\n required\n />\n )}\n\n <FormControlLabel\n control={\n <Checkbox\n {...asInputRef(register('useCodeowners'))}\n onChange={(_, value) => {\n if (value) {\n setValue('owner', '');\n }\n }}\n />\n }\n label={\n <>\n Use <em>CODEOWNERS</em> file as Entity Owner\n </>\n }\n />\n <FormHelperText>\n WARNING: This may fail if no CODEOWNERS file is found at\n the target location.\n </FormHelperText>\n </>\n )}\n />\n ),\n };\n },\n };\n\n default:\n return defaults;\n }\n}\n\nexport const defaultStepper: StepperProvider = {\n analyze: (state, { apis }) => ({\n stepLabel: <StepLabel>Select URL</StepLabel>,\n content: (\n <StepInitAnalyzeUrl\n key=\"analyze\"\n analysisUrl={state.analysisUrl}\n onAnalysis={state.onAnalysis}\n disablePullRequest={!apis.catalogImportApi.preparePullRequest}\n />\n ),\n }),\n\n prepare: state => ({\n stepLabel: (\n <StepLabel optional={<Typography variant=\"caption\">Optional</Typography>}>\n Import Actions\n </StepLabel>\n ),\n content: <BackButton onClick={state.onGoBack} />,\n }),\n\n review: state => ({\n stepLabel: <StepLabel>Review</StepLabel>,\n content: (\n <StepReviewLocation\n prepareResult={state.prepareResult}\n onReview={state.onReview}\n onGoBack={state.onGoBack}\n />\n ),\n }),\n\n finish: state => ({\n stepLabel: <StepLabel>Finish</StepLabel>,\n content: (\n <StepFinishImportLocation\n prepareResult={state.prepareResult}\n onReset={state.onReset}\n />\n ),\n }),\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InfoCard, InfoCardVariants } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Step, StepContent, Stepper } from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { useMemo } from 'react';\nimport { catalogImportApiRef } from '../../api';\nimport { ImportFlows, ImportState, useImportState } from '../useImportState';\nimport {\n defaultGenerateStepper,\n defaultStepper,\n StepConfiguration,\n StepperProvider,\n} from './defaults';\n\nconst useStyles = makeStyles(() => ({\n stepperRoot: {\n padding: 0,\n },\n}));\n\n/**\n * Props for {@link ImportStepper}.\n *\n * @public\n */\nexport interface ImportStepperProps {\n initialUrl?: string;\n generateStepper?: (\n flow: ImportFlows,\n defaults: StepperProvider,\n ) => StepperProvider;\n variant?: InfoCardVariants;\n}\n\n/**\n * The stepper that holds the different import stages.\n *\n * @public\n */\nexport const ImportStepper = (props: ImportStepperProps) => {\n const {\n initialUrl,\n generateStepper = defaultGenerateStepper,\n variant,\n } = props;\n\n const catalogImportApi = useApi(catalogImportApiRef);\n const classes = useStyles();\n const state = useImportState({ initialUrl });\n\n const states = useMemo<StepperProvider>(\n () => generateStepper(state.activeFlow, defaultStepper),\n [generateStepper, state.activeFlow],\n );\n\n const render = (step: StepConfiguration) => {\n return (\n <Step>\n {step.stepLabel}\n <StepContent>{step.content}</StepContent>\n </Step>\n );\n };\n\n return (\n <InfoCard variant={variant}>\n <Stepper\n classes={{ root: classes.stepperRoot }}\n activeStep={state.activeStepNumber}\n orientation=\"vertical\"\n >\n {render(\n states.analyze(\n state as Extract<ImportState, { activeState: 'analyze' }>,\n { apis: { catalogImportApi } },\n ),\n )}\n {render(\n states.prepare(\n state as Extract<ImportState, { activeState: 'prepare' }>,\n { apis: { catalogImportApi } },\n ),\n )}\n {render(\n states.review(\n state as Extract<ImportState, { activeState: 'review' }>,\n { apis: { catalogImportApi } },\n ),\n )}\n {render(\n states.finish(\n state as Extract<ImportState, { activeState: 'finish' }>,\n { apis: { catalogImportApi } },\n ),\n )}\n </Stepper>\n </InfoCard>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Content,\n ContentHeader,\n Header,\n Page,\n SupportButton,\n} from '@backstage/core-components';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { Grid, useMediaQuery, useTheme } from '@material-ui/core';\nimport React from 'react';\nimport { ImportInfoCard } from '../ImportInfoCard';\nimport { ImportStepper } from '../ImportStepper';\n\n/**\n * The default catalog import page.\n *\n * @public\n */\nexport const DefaultImportPage = () => {\n const theme = useTheme();\n const configApi = useApi(configApiRef);\n const isMobile = useMediaQuery(theme.breakpoints.down('sm'));\n const appTitle = configApi.getOptionalString('app.title') || 'Backstage';\n\n const contentItems = [\n <Grid key={0} item xs={12} md={4} lg={6} xl={8}>\n <ImportInfoCard />\n </Grid>,\n\n <Grid key={1} item xs={12} md={8} lg={6} xl={4}>\n <ImportStepper />\n </Grid>,\n ];\n\n return (\n <Page themeId=\"home\">\n <Header title=\"Register an existing component\" />\n <Content>\n <ContentHeader title={`Start tracking your component in ${appTitle}`}>\n <SupportButton>\n Start tracking your component in {appTitle} by adding it to the\n software catalog.\n </SupportButton>\n </ContentHeader>\n\n <Grid container spacing={2}>\n {isMobile ? contentItems : contentItems.reverse()}\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmBO,SAAS,kBAA6B,GAAA;AAC3C,EAAM,MAAA,MAAA,GAAS,OAAO,YAAY,CAAA,CAAA;AAElC,EAAA,OAAO,mBAAmB,MAAM,CAAA,CAAA;AAClC;;ACea,MAAA,cAAA,GAAiB,CAAC,KAA+B,KAAA;AAC5D,EAAM,MAAA;AAAA,IACJ,kBAAqB,GAAA,sEAAA;AAAA,IACrB,oBAAuB,GAAA,wCAAA;AAAA,GACrB,GAAA,KAAA,CAAA;AAEJ,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA,CAAA;AACrC,EAAA,MAAM,QAAW,GAAA,SAAA,CAAU,iBAAkB,CAAA,WAAW,CAAK,IAA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