@backstage/plugin-catalog-import 0.12.12-next.0 → 0.12.12-next.1

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,25 @@
1
1
  # @backstage/plugin-catalog-import
2
2
 
3
+ ## 0.12.12-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5b9514f: Expose the `UnpackNestedValue` type as it's been removed from `react-hook-form`
8
+ - f1d9a64: adding translation for `Register an existing component` text
9
+ - Updated dependencies
10
+ - @backstage/core-components@0.17.1-next.0
11
+ - @backstage/integration-react@1.2.6-next.0
12
+ - @backstage/integration@1.16.3-next.0
13
+ - @backstage/frontend-plugin-api@0.10.1-next.0
14
+ - @backstage/plugin-catalog-react@1.16.1-next.1
15
+ - @backstage/core-compat-api@0.4.1-next.1
16
+ - @backstage/catalog-client@1.9.1
17
+ - @backstage/catalog-model@1.7.3
18
+ - @backstage/config@1.3.2
19
+ - @backstage/core-plugin-api@1.10.5
20
+ - @backstage/errors@1.2.7
21
+ - @backstage/plugin-catalog-common@1.1.3
22
+
3
23
  ## 0.12.12-next.0
4
24
 
5
25
  ### Patch Changes
package/dist/alpha.d.ts CHANGED
@@ -1,6 +1,13 @@
1
1
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
2
2
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
3
3
  import React__default from 'react';
4
+ import * as _backstage_core_plugin_api_alpha from '@backstage/core-plugin-api/alpha';
5
+
6
+ /** @alpha */
7
+ declare const catalogImportTranslationRef: _backstage_core_plugin_api_alpha.TranslationRef<"catalog-import", {
8
+ readonly pageTitle: "Register an existing component";
9
+ readonly "importInfoCard.title": "Register an existing component";
10
+ }>;
4
11
 
5
12
  /** @alpha */
6
13
  declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
@@ -38,4 +45,4 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
38
45
  }>;
39
46
  }>;
40
47
 
41
- export { _default as default };
48
+ export { catalogImportTranslationRef, _default as default };
package/dist/alpha.esm.js CHANGED
@@ -7,6 +7,7 @@ import { catalogImportApiRef } from './api/CatalogImportApi.esm.js';
7
7
  import { CatalogImportClient } from './api/CatalogImportClient.esm.js';
8
8
  import { rootRouteRef } from './plugin.esm.js';
9
9
  import { catalogApiRef } from '@backstage/plugin-catalog-react';
10
+ export { catalogImportTranslationRef } from './translation.esm.js';
10
11
 
11
12
  const catalogImportPage = PageBlueprint.make({
12
13
  params: {
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n createFrontendPlugin,\n PageBlueprint,\n ApiBlueprint,\n} from '@backstage/frontend-plugin-api';\nimport {\n scmAuthApiRef,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport React from 'react';\nimport { CatalogImportClient, catalogImportApiRef } from './api';\nimport { rootRouteRef } from './plugin';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\n\n// TODO: It's currently possible to override the import page with a custom one. We need to decide\n// whether this type of override is typically done with an input or by overriding the entire extension.\nconst catalogImportPage = PageBlueprint.make({\n params: {\n defaultPath: '/catalog-import',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n loader: () =>\n import('./components/ImportPage').then(m =>\n compatWrapper(<m.ImportPage />),\n ),\n },\n});\n\nconst catalogImportApi = ApiBlueprint.make({\n params: {\n factory: createApiFactory({\n api: catalogImportApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n scmAuthApi: scmAuthApiRef,\n fetchApi: fetchApiRef,\n scmIntegrationsApi: scmIntegrationsApiRef,\n catalogApi: catalogApiRef,\n configApi: configApiRef,\n },\n factory: ({\n discoveryApi,\n scmAuthApi,\n fetchApi,\n scmIntegrationsApi,\n catalogApi,\n configApi,\n }) =>\n new CatalogImportClient({\n discoveryApi,\n scmAuthApi,\n scmIntegrationsApi,\n fetchApi,\n catalogApi,\n configApi,\n }),\n }),\n },\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n id: 'catalog-import',\n extensions: [catalogImportApi, catalogImportPage],\n routes: {\n importPage: convertLegacyRouteRef(rootRouteRef),\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AA0CA,MAAM,iBAAA,GAAoB,cAAc,IAAK,CAAA;AAAA,EAC3C,MAAQ,EAAA;AAAA,IACN,WAAa,EAAA,iBAAA;AAAA,IACb,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,IAC5C,MAAQ,EAAA,MACN,OAAO,sCAAyB,CAAE,CAAA,IAAA;AAAA,MAAK,OACrC,aAAc,iBAAA,KAAA,CAAA,aAAA,CAAC,CAAE,CAAA,UAAA,EAAF,IAAa,CAAE;AAAA;AAChC;AAEN,CAAC,CAAA;AAED,MAAM,gBAAA,GAAmB,aAAa,IAAK,CAAA;AAAA,EACzC,MAAQ,EAAA;AAAA,IACN,SAAS,gBAAiB,CAAA;AAAA,MACxB,GAAK,EAAA,mBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,UAAY,EAAA,aAAA;AAAA,QACZ,QAAU,EAAA,WAAA;AAAA,QACV,kBAAoB,EAAA,qBAAA;AAAA,QACpB,UAAY,EAAA,aAAA;AAAA,QACZ,SAAW,EAAA;AAAA,OACb;AAAA,MACA,SAAS,CAAC;AAAA,QACR,YAAA;AAAA,QACA,UAAA;AAAA,QACA,QAAA;AAAA,QACA,kBAAA;AAAA,QACA,UAAA;AAAA,QACA;AAAA,OACF,KACE,IAAI,mBAAoB,CAAA;AAAA,QACtB,YAAA;AAAA,QACA,UAAA;AAAA,QACA,kBAAA;AAAA,QACA,QAAA;AAAA,QACA,UAAA;AAAA,QACA;AAAA,OACD;AAAA,KACJ;AAAA;AAEL,CAAC,CAAA;AAGD,YAAe,oBAAqB,CAAA;AAAA,EAClC,EAAI,EAAA,gBAAA;AAAA,EACJ,UAAA,EAAY,CAAC,gBAAA,EAAkB,iBAAiB,CAAA;AAAA,EAChD,MAAQ,EAAA;AAAA,IACN,UAAA,EAAY,sBAAsB,YAAY;AAAA;AAElD,CAAC,CAAA;;;;"}
1
+ {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n createFrontendPlugin,\n PageBlueprint,\n ApiBlueprint,\n} from '@backstage/frontend-plugin-api';\nimport {\n scmAuthApiRef,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport React from 'react';\nimport { CatalogImportClient, catalogImportApiRef } from './api';\nimport { rootRouteRef } from './plugin';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\n\nexport * from './translation';\n\n// TODO: It's currently possible to override the import page with a custom one. We need to decide\n// whether this type of override is typically done with an input or by overriding the entire extension.\nconst catalogImportPage = PageBlueprint.make({\n params: {\n defaultPath: '/catalog-import',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n loader: () =>\n import('./components/ImportPage').then(m =>\n compatWrapper(<m.ImportPage />),\n ),\n },\n});\n\nconst catalogImportApi = ApiBlueprint.make({\n params: {\n factory: createApiFactory({\n api: catalogImportApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n scmAuthApi: scmAuthApiRef,\n fetchApi: fetchApiRef,\n scmIntegrationsApi: scmIntegrationsApiRef,\n catalogApi: catalogApiRef,\n configApi: configApiRef,\n },\n factory: ({\n discoveryApi,\n scmAuthApi,\n fetchApi,\n scmIntegrationsApi,\n catalogApi,\n configApi,\n }) =>\n new CatalogImportClient({\n discoveryApi,\n scmAuthApi,\n scmIntegrationsApi,\n fetchApi,\n catalogApi,\n configApi,\n }),\n }),\n },\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n id: 'catalog-import',\n extensions: [catalogImportApi, catalogImportPage],\n routes: {\n importPage: convertLegacyRouteRef(rootRouteRef),\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;AA4CA,MAAM,iBAAA,GAAoB,cAAc,IAAK,CAAA;AAAA,EAC3C,MAAQ,EAAA;AAAA,IACN,WAAa,EAAA,iBAAA;AAAA,IACb,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,IAC5C,MAAQ,EAAA,MACN,OAAO,sCAAyB,CAAE,CAAA,IAAA;AAAA,MAAK,OACrC,aAAc,iBAAA,KAAA,CAAA,aAAA,CAAC,CAAE,CAAA,UAAA,EAAF,IAAa,CAAE;AAAA;AAChC;AAEN,CAAC,CAAA;AAED,MAAM,gBAAA,GAAmB,aAAa,IAAK,CAAA;AAAA,EACzC,MAAQ,EAAA;AAAA,IACN,SAAS,gBAAiB,CAAA;AAAA,MACxB,GAAK,EAAA,mBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,UAAY,EAAA,aAAA;AAAA,QACZ,QAAU,EAAA,WAAA;AAAA,QACV,kBAAoB,EAAA,qBAAA;AAAA,QACpB,UAAY,EAAA,aAAA;AAAA,QACZ,SAAW,EAAA;AAAA,OACb;AAAA,MACA,SAAS,CAAC;AAAA,QACR,YAAA;AAAA,QACA,UAAA;AAAA,QACA,QAAA;AAAA,QACA,kBAAA;AAAA,QACA,UAAA;AAAA,QACA;AAAA,OACF,KACE,IAAI,mBAAoB,CAAA;AAAA,QACtB,YAAA;AAAA,QACA,UAAA;AAAA,QACA,kBAAA;AAAA,QACA,QAAA;AAAA,QACA,UAAA;AAAA,QACA;AAAA,OACD;AAAA,KACJ;AAAA;AAEL,CAAC,CAAA;AAGD,YAAe,oBAAqB,CAAA;AAAA,EAClC,EAAI,EAAA,gBAAA;AAAA,EACJ,UAAA,EAAY,CAAC,gBAAA,EAAkB,iBAAiB,CAAA;AAAA,EAChD,MAAQ,EAAA;AAAA,IACN,UAAA,EAAY,sBAAsB,YAAY;AAAA;AAElD,CAAC,CAAA;;;;"}
@@ -36,8 +36,11 @@ import '@material-ui/core/ListItem';
36
36
  import '@material-ui/core/ListItemIcon';
37
37
  import '@material-ui/core/ListItemText';
38
38
  import '@backstage/errors';
39
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
40
+ import { catalogImportTranslationRef } from '../../translation.esm.js';
39
41
 
40
42
  const DefaultImportPage = () => {
43
+ const { t } = useTranslationRef(catalogImportTranslationRef);
41
44
  const theme = useTheme();
42
45
  const configApi = useApi(configApiRef);
43
46
  const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
@@ -47,7 +50,7 @@ const DefaultImportPage = () => {
47
50
  /* @__PURE__ */ React.createElement(Grid, { key: 0, item: true, xs: 12, md: 4, lg: 6, xl: 8 }, /* @__PURE__ */ React.createElement(ImportInfoCard, null)),
48
51
  /* @__PURE__ */ React.createElement(Grid, { key: 1, item: true, xs: 12, md: 8, lg: 6, xl: 4 }, /* @__PURE__ */ React.createElement(ImportStepper, null))
49
52
  ];
50
- return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(Header, { title: "Register an existing component" }), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: `Start tracking your component in ${appTitle}` }, /* @__PURE__ */ React.createElement(SupportButton, null, supportTitle)), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2 }, isMobile ? contentItems : contentItems.reverse())));
53
+ return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(Header, { title: t("pageTitle") }), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: `Start tracking your component in ${appTitle}` }, /* @__PURE__ */ React.createElement(SupportButton, null, supportTitle)), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2 }, isMobile ? contentItems : contentItems.reverse())));
51
54
  };
52
55
 
53
56
  export { DefaultImportPage };
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultImportPage.esm.js","sources":["../../../src/components/DefaultImportPage/DefaultImportPage.tsx"],"sourcesContent":["/*\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 from '@material-ui/core/Grid';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\nimport { useTheme } from '@material-ui/core/styles';\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 supportTitle = `Start tracking your component in ${appTitle} by adding it to the software catalog.`;\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>{supportTitle}</SupportButton>\n </ContentHeader>\n\n <Grid container spacing={2}>\n {isMobile ? contentItems : contentItems.reverse()}\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,MAAM,oBAAoB,MAAM;AACrC,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAA,MAAM,WAAW,aAAc,CAAA,KAAA,CAAM,WAAY,CAAA,IAAA,CAAK,IAAI,CAAC,CAAA;AAC3D,EAAA,MAAM,QAAW,GAAA,SAAA,CAAU,iBAAkB,CAAA,WAAW,CAAK,IAAA,WAAA;AAE7D,EAAM,MAAA,YAAA,GAAe,oCAAoC,QAAQ,CAAA,sCAAA,CAAA;AAEjE,EAAA,MAAM,YAAe,GAAA;AAAA,wCAClB,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,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;AAAA,GACF;AAEA,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,MAAA,EAAA,sCACX,MAAO,EAAA,EAAA,KAAA,EAAM,gCAAiC,EAAA,CAAA,sCAC9C,OACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,EAAA,KAAA,EAAO,oCAAoC,QAAQ,CAAA,CAAA,EAAA,kBAC/D,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,IAAA,EAAe,YAAa,CAC/B,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;AAEJ;;;;"}
1
+ {"version":3,"file":"DefaultImportPage.esm.js","sources":["../../../src/components/DefaultImportPage/DefaultImportPage.tsx"],"sourcesContent":["/*\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 from '@material-ui/core/Grid';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\nimport { useTheme } from '@material-ui/core/styles';\nimport React from 'react';\nimport { ImportInfoCard } from '../ImportInfoCard';\nimport { ImportStepper } from '../ImportStepper';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { catalogImportTranslationRef } from '../../translation';\n\n/**\n * The default catalog import page.\n *\n * @public\n */\nexport const DefaultImportPage = () => {\n const { t } = useTranslationRef(catalogImportTranslationRef);\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 supportTitle = `Start tracking your component in ${appTitle} by adding it to the software catalog.`;\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={t('pageTitle')} />\n <Content>\n <ContentHeader title={`Start tracking your component in ${appTitle}`}>\n <SupportButton>{supportTitle}</SupportButton>\n </ContentHeader>\n\n <Grid container spacing={2}>\n {isMobile ? contentItems : contentItems.reverse()}\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCO,MAAM,oBAAoB,MAAM;AACrC,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,2BAA2B,CAAA;AAC3D,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAA,MAAM,WAAW,aAAc,CAAA,KAAA,CAAM,WAAY,CAAA,IAAA,CAAK,IAAI,CAAC,CAAA;AAC3D,EAAA,MAAM,QAAW,GAAA,SAAA,CAAU,iBAAkB,CAAA,WAAW,CAAK,IAAA,WAAA;AAE7D,EAAM,MAAA,YAAA,GAAe,oCAAoC,QAAQ,CAAA,sCAAA,CAAA;AAEjE,EAAA,MAAM,YAAe,GAAA;AAAA,wCAClB,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,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;AAAA,GACF;AAEA,EAAA,2CACG,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAO,KAAO,EAAA,CAAA,CAAE,WAAW,CAAA,EAAG,mBAC9B,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,OAAO,CAAoC,iCAAA,EAAA,QAAQ,CAChE,CAAA,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,qBAAe,YAAa,CAC/B,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;AAEJ;;;;"}
@@ -9,12 +9,15 @@ import 'git-url-parse';
9
9
  import '@octokit/rest';
10
10
  import 'js-base64';
11
11
  import { useCatalogFilename } from '../../hooks/useCatalogFilename.esm.js';
12
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
13
+ import { catalogImportTranslationRef } from '../../translation.esm.js';
12
14
 
13
15
  const ImportInfoCard = (props) => {
14
16
  const {
15
17
  exampleLocationUrl = "https://github.com/backstage/backstage/blob/master/catalog-info.yaml",
16
18
  exampleRepositoryUrl = "https://github.com/backstage/backstage"
17
19
  } = props;
20
+ const { t } = useTranslationRef(catalogImportTranslationRef);
18
21
  const configApi = useApi(configApiRef);
19
22
  const appTitle = configApi.getOptionalString("app.title") || "Backstage";
20
23
  const catalogImportApi = useApi(catalogImportApiRef);
@@ -23,7 +26,7 @@ const ImportInfoCard = (props) => {
23
26
  return /* @__PURE__ */ React.createElement(
24
27
  InfoCard,
25
28
  {
26
- title: "Register an existing component",
29
+ title: t("importInfoCard.title"),
27
30
  titleTypographyProps: { component: "h3" },
28
31
  deepLink: {
29
32
  title: "Learn more about the Software Catalog",
@@ -1 +1 @@
1
- {"version":3,"file":"ImportInfoCard.esm.js","sources":["../../../src/components/ImportInfoCard/ImportInfoCard.tsx"],"sourcesContent":["/*\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 from '@material-ui/core/Chip';\nimport Typography from '@material-ui/core/Typography';\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"],"names":[],"mappings":";;;;;;;;;;;;AAuCa,MAAA,cAAA,GAAiB,CAAC,KAA+B,KAAA;A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AAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAU,EAAA,IAAA,EAAK,OAAQ,EAAA,IAAA,EAAA,EAAK,sBACjB,EAAA,GAAA,kBACpB,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,OAAM,aAAc,EAAA,OAAA,EAAQ,UAAW,EAAA,IAAA,EAAK,OAAQ,EAAA,CAC5D,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,OAAQ,EAAA,WAAA,EAAY,KAAM,EAAA,eAAA,EAAgB,SAAS,EAAA,IAAA,EAAA,EAAC,WACrD,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAM,oBAAqB,CACvC,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAAQ,EAAA,SAAA,EAAS,IAAC,EAAA,EAAA,2BAAA,kBACV,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,EAAM,eAAgB,CAAA,EAAO,wEACE,EAAA,QAAA,EAAU,KAAI,UAEzE,CAAA,EACC,gBAAiB,CAAA,kBAAA,oBACf,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAQ,WAAS,IAAC,EAAA,EAAA,wFAAA,kBAEd,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,EAAM,eAAgB,CAAA,EAAO,oBAC9C,EAAA,QAAA,EAAS,sEAEhB,CAEJ;AAAA,GAEJ;AAEJ;;;;"}
1
+ {"version":3,"file":"ImportInfoCard.esm.js","sources":["../../../src/components/ImportInfoCard/ImportInfoCard.tsx"],"sourcesContent":["/*\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 from '@material-ui/core/Chip';\nimport Typography from '@material-ui/core/Typography';\nimport React from 'react';\nimport { catalogImportApiRef } from '../../api';\nimport { useCatalogFilename } from '../../hooks';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { catalogImportTranslationRef } from '../../translation';\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 { t } = useTranslationRef(catalogImportTranslationRef);\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={t('importInfoCard.title')}\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"],"names":[],"mappings":";;;;;;;;;;;;;;AAyCa,MAAA,cAAA,GAAiB,CAAC,KAA+B,KAAA;AAC5D,EAAM,MAAA;AAAA,IACJ,kBAAqB,GAAA,sEAAA;AAAA,IACrB,oBAAuB,GAAA;AAAA,GACrB,GAAA,KAAA;AAEJ,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,2BAA2B,CAAA;AAC3D,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAA,MAAM,QAAW,GAAA,SAAA,CAAU,iBAAkB,CAAA,WAAW,CAAK,IAAA,WAAA;AAC7D,EAAM,MAAA,gBAAA,GAAmB,OAAO,mBAAmB,CAAA;AAEnD,EAAM,MAAA,oBAAA,GAAuB,SAAU,CAAA,GAAA,CAAI,qBAAqB,CAAA;AAEhE,EAAA,MAAM,kBAAkB,kBAAmB,EAAA;AAE3C,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,sBAAsB,CAAA;AAAA,MAC/B,oBAAA,EAAsB,EAAE,SAAA,EAAW,IAAK,EAAA;AAAA,MACxC,QAAU,EAAA;AAAA,Q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,2BAAA,kBACV,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,EAAM,eAAgB,CAAA,EAAO,wEACE,EAAA,QAAA,EAAU,KAAI,UAEzE,CAAA,EACC,gBAAiB,CAAA,kBAAA,oBACf,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAQ,WAAS,IAAC,EAAA,EAAA,wFAAA,kBAEd,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,EAAM,eAAgB,CAAA,EAAO,oBAC9C,EAAA,QAAA,EAAS,sEAEhB,CAEJ;AAAA,GAEJ;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"StepPrepareCreatePullRequest.esm.js","sources":["../../../src/components/StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.tsx"],"sourcesContent":["/*\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 from '@material-ui/core/Box';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\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/esm/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"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,WAAa,EAAA;AAAA,IACX,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GAC5B;AAAA,EACA,kBAAoB,EAAA;AAAA,IAClB,UAAY,EAAA;AAAA;AAEhB,CAAE,CAAA,CAAA;AAmCc,SAAA,gBAAA,CACd,QACA,EAAA,aAAA,EACA,KACU,EAAA;AACV,EAAO,OAAA,QAAA,CAAS,IAAI,CAAM,CAAA,MAAA;AAAA,IACxB,GAAG,CAAA;AAAA,IACH,YAAY,CAAE,CAAA,UAAA;AAAA,IACd,MAAM,CAAE,CAAA,IAAA;AAAA,IACR,QAAU,EAAA;AAAA,MACR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M,mBAEtC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,WAAS,IAAC,EAAA,OAAA,EAAS,KACtB,QACC,oBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,OAAS,EAAA,QAAA,EAAU,QAAU,EAAA,SAAA,EAAW,CAEtD,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,IAAK,EAAA,QAAA;AAAA,UACL,QAAU,EAAA,OAAA;AAAA,YACR,UAAU,MAAO,CAAA,KAAA,IACf,UAAU,MAAO,CAAA,IAAA,IACjB,UAAU,MAAO,CAAA;AAAA,WACrB;AAAA,UACA,OAAS,EAAA;AAAA,SAAA;AAAA,QACV;AAAA,OAGH,CACF;AAAA;AAAA,GAIR,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"StepPrepareCreatePullRequest.esm.js","sources":["../../../src/components/StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.tsx"],"sourcesContent":["/*\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 from '@material-ui/core/Box';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport { NestedValue, UseFormReturn } from 'react-hook-form';\nimport useAsync from 'react-use/esm/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 * Helper for unpacking NestedValue into the underlying type.\n *\n * @public\n * @deprecated This is a copy of the type from react-hook-form, and will be removed in a future release\n */\nexport type UnpackNestedValue<T> = T extends NestedValue<infer U>\n ? U\n : T extends Date | FileList | File | Blob\n ? T\n : T extends object\n ? {\n [K in keyof T]: UnpackNestedValue<T[K]>;\n }\n : T;\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"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,WAAa,EAAA;AAAA,IACX,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GAC5B;AAAA,EACA,kBAAoB,EA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;AAAA,YACd,MAAO,CAAA,aAAA;AAAA,YACP,MAAO,CAAA;AAAA,WACT;AAAA,UACA,eAAe,aAAc,CAAA,GAAA;AAAA,UAC7B,OAAS,EAAA;AAAA,YACP,MAAM,OAAQ,CAAA,WAAA;AAAA,YACd,aAAa,OAAQ,CAAA;AAAA;AACvB;AAAA,OACF,EAEC,yBAAU,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,EAAe,OAAK,IAAE,EAAA,EAAA,KAAM,mBAEtC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,WAAS,IAAC,EAAA,OAAA,EAAS,KACtB,QACC,oBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,OAAS,EAAA,QAAA,EAAU,QAAU,EAAA,SAAA,EAAW,CAEtD,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,IAAK,EAAA,QAAA;AAAA,UACL,QAAU,EAAA,OAAA;AAAA,YACR,UAAU,MAAO,CAAA,KAAA,IACf,UAAU,MAAO,CAAA,IAAA,IACjB,UAAU,MAAO,CAAA;AAAA,WACrB;AAAA,UACA,OAAS,EAAA;AAAA,SAAA;AAAA,QACV;AAAA,OAGH,CACF;AAAA;AAAA,GAIR,CAAA;AAEJ;;;;"}
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import { DiscoveryApi, FetchApi, ConfigApi } from '@backstage/core-plugin-api';
5
5
  import { Entity, CompoundEntityRef } from '@backstage/catalog-model';
6
6
  import { InfoCardVariants } from '@backstage/core-components';
7
7
  import { TextFieldProps } from '@material-ui/core/TextField/TextField';
8
- import { FieldErrors, Controller, UseFormProps, SubmitHandler, UseFormReturn, UnpackNestedValue } from 'react-hook-form';
8
+ import { FieldErrors, Controller, UseFormProps, SubmitHandler, UseFormReturn, NestedValue } from 'react-hook-form';
9
9
  import { CatalogApi } from '@backstage/catalog-client';
10
10
  import { ScmIntegrationRegistry } from '@backstage/integration';
11
11
  import { ScmAuthApi } from '@backstage/integration-react';
@@ -426,6 +426,15 @@ type FormData = {
426
426
  owner: string;
427
427
  useCodeowners: boolean;
428
428
  };
429
+ /**
430
+ * Helper for unpacking NestedValue into the underlying type.
431
+ *
432
+ * @public
433
+ * @deprecated This is a copy of the type from react-hook-form, and will be removed in a future release
434
+ */
435
+ type UnpackNestedValue<T> = T extends NestedValue<infer U> ? U : T extends Date | FileList | File | Blob ? T : T extends object ? {
436
+ [K in keyof T]: UnpackNestedValue<T[K]>;
437
+ } : T;
429
438
  /**
430
439
  * Props for {@link StepPrepareCreatePullRequest}.
431
440
  *
@@ -452,4 +461,4 @@ interface StepPrepareCreatePullRequestProps {
452
461
  */
453
462
  declare const StepPrepareCreatePullRequest: (props: StepPrepareCreatePullRequestProps) => React__default.JSX.Element;
454
463
 
455
- export { type AnalyzeResult, AutocompleteTextField, type AutocompleteTextFieldProps, type CatalogImportApi, CatalogImportClient, CatalogImportPage, DefaultImportPage, EntityListComponent, type EntityListComponentProps, type ImportFlows, ImportInfoCard, type ImportInfoCardProps, type ImportState, ImportStepper, type ImportStepperProps, PreparePullRequestForm, type PreparePullRequestFormProps, type PrepareResult, PreviewCatalogInfoComponent, type PreviewCatalogInfoComponentProps, PreviewPullRequestComponent, type PreviewPullRequestComponentProps, StepInitAnalyzeUrl, type StepInitAnalyzeUrlProps, StepPrepareCreatePullRequest, type StepPrepareCreatePullRequestProps, catalogImportApiRef, catalogImportPlugin, defaultGenerateStepper, catalogImportPlugin as plugin };
464
+ export { type AnalyzeResult, AutocompleteTextField, type AutocompleteTextFieldProps, type CatalogImportApi, CatalogImportClient, CatalogImportPage, DefaultImportPage, EntityListComponent, type EntityListComponentProps, type ImportFlows, ImportInfoCard, type ImportInfoCardProps, type ImportState, ImportStepper, type ImportStepperProps, PreparePullRequestForm, type PreparePullRequestFormProps, type PrepareResult, PreviewCatalogInfoComponent, type PreviewCatalogInfoComponentProps, PreviewPullRequestComponent, type PreviewPullRequestComponentProps, StepInitAnalyzeUrl, type StepInitAnalyzeUrlProps, StepPrepareCreatePullRequest, type StepPrepareCreatePullRequestProps, type UnpackNestedValue, catalogImportApiRef, catalogImportPlugin, defaultGenerateStepper, catalogImportPlugin as plugin };
@@ -0,0 +1,14 @@
1
+ import { createTranslationRef } from '@backstage/core-plugin-api/alpha';
2
+
3
+ const catalogImportTranslationRef = createTranslationRef({
4
+ id: "catalog-import",
5
+ messages: {
6
+ pageTitle: "Register an existing component",
7
+ importInfoCard: {
8
+ title: "Register an existing component"
9
+ }
10
+ }
11
+ });
12
+
13
+ export { catalogImportTranslationRef };
14
+ //# sourceMappingURL=translation.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translation.esm.js","sources":["../src/translation.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { createTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @alpha */\nexport const catalogImportTranslationRef = createTranslationRef({\n id: 'catalog-import',\n messages: {\n pageTitle: 'Register an existing component',\n importInfoCard: {\n title: 'Register an existing component',\n },\n },\n});\n"],"names":[],"mappings":";;AAmBO,MAAM,8BAA8B,oBAAqB,CAAA;AAAA,EAC9D,EAAI,EAAA,gBAAA;AAAA,EACJ,QAAU,EAAA;AAAA,IACR,SAAW,EAAA,gCAAA;AAAA,IACX,cAAgB,EAAA;AAAA,MACd,KAAO,EAAA;AAAA;AACT;AAEJ,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-import",
3
- "version": "0.12.12-next.0",
3
+ "version": "0.12.12-next.1",
4
4
  "description": "A Backstage plugin the helps you import entities into your catalog",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -69,15 +69,15 @@
69
69
  "@backstage/catalog-client": "1.9.1",
70
70
  "@backstage/catalog-model": "1.7.3",
71
71
  "@backstage/config": "1.3.2",
72
- "@backstage/core-compat-api": "0.4.1-next.0",
73
- "@backstage/core-components": "0.17.0",
72
+ "@backstage/core-compat-api": "0.4.1-next.1",
73
+ "@backstage/core-components": "0.17.1-next.0",
74
74
  "@backstage/core-plugin-api": "1.10.5",
75
75
  "@backstage/errors": "1.2.7",
76
- "@backstage/frontend-plugin-api": "0.10.0",
77
- "@backstage/integration": "1.16.2",
78
- "@backstage/integration-react": "1.2.5",
76
+ "@backstage/frontend-plugin-api": "0.10.1-next.0",
77
+ "@backstage/integration": "1.16.3-next.0",
78
+ "@backstage/integration-react": "1.2.6-next.0",
79
79
  "@backstage/plugin-catalog-common": "1.1.3",
80
- "@backstage/plugin-catalog-react": "1.16.1-next.0",
80
+ "@backstage/plugin-catalog-react": "1.16.1-next.1",
81
81
  "@material-ui/core": "^4.12.2",
82
82
  "@material-ui/icons": "^4.9.1",
83
83
  "@material-ui/lab": "4.0.0-alpha.61",
@@ -90,10 +90,10 @@
90
90
  "yaml": "^2.0.0"
91
91
  },
92
92
  "devDependencies": {
93
- "@backstage/cli": "0.32.0-next.0",
93
+ "@backstage/cli": "0.32.0-next.1",
94
94
  "@backstage/core-app-api": "1.16.0",
95
- "@backstage/dev-utils": "1.1.9-next.0",
96
- "@backstage/plugin-catalog": "1.29.0-next.0",
95
+ "@backstage/dev-utils": "1.1.9-next.1",
96
+ "@backstage/plugin-catalog": "1.29.0-next.1",
97
97
  "@backstage/test-utils": "1.7.6",
98
98
  "@testing-library/dom": "^10.0.0",
99
99
  "@testing-library/jest-dom": "^6.0.0",