@backstage/plugin-catalog-import 0.10.10 → 0.10.11-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 +18 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.esm.js +4 -6
- package/dist/alpha.esm.js.map +1 -1
- package/dist/api/CatalogImportApi.esm.js +8 -0
- package/dist/api/CatalogImportApi.esm.js.map +1 -0
- package/dist/{esm/plugin-_ZVWmjOr.esm.js → api/CatalogImportClient.esm.js} +4 -84
- package/dist/api/CatalogImportClient.esm.js.map +1 -0
- package/dist/api/GitHub.esm.js +17 -0
- package/dist/api/GitHub.esm.js.map +1 -0
- package/dist/components/Buttons/index.esm.js +57 -0
- package/dist/components/Buttons/index.esm.js.map +1 -0
- package/dist/components/DefaultImportPage/DefaultImportPage.esm.js +53 -0
- package/dist/components/DefaultImportPage/DefaultImportPage.esm.js.map +1 -0
- package/dist/components/EntityListComponent/EntityListComponent.esm.js +88 -0
- package/dist/components/EntityListComponent/EntityListComponent.esm.js.map +1 -0
- package/dist/components/ImportInfoCard/ImportInfoCard.esm.js +42 -0
- package/dist/components/ImportInfoCard/ImportInfoCard.esm.js.map +1 -0
- package/dist/components/ImportPage/ImportPage.esm.js +11 -0
- package/dist/components/ImportPage/ImportPage.esm.js.map +1 -0
- package/dist/components/ImportPage/index.esm.js +2 -0
- package/dist/components/ImportPage/index.esm.js.map +1 -0
- package/dist/components/ImportStepper/ImportStepper.esm.js +72 -0
- package/dist/components/ImportStepper/ImportStepper.esm.js.map +1 -0
- package/dist/components/ImportStepper/defaults.esm.js +222 -0
- package/dist/components/ImportStepper/defaults.esm.js.map +1 -0
- package/dist/components/StepFinishImportLocation/StepFinishImportLocation.esm.js +66 -0
- package/dist/components/StepFinishImportLocation/StepFinishImportLocation.esm.js.map +1 -0
- package/dist/components/StepInitAnalyzeUrl/StepInitAnalyzeUrl.esm.js +113 -0
- package/dist/components/StepInitAnalyzeUrl/StepInitAnalyzeUrl.esm.js.map +1 -0
- package/dist/components/StepPrepareCreatePullRequest/AutocompleteTextField.esm.js +57 -0
- package/dist/components/StepPrepareCreatePullRequest/AutocompleteTextField.esm.js.map +1 -0
- package/dist/components/StepPrepareCreatePullRequest/PreparePullRequestForm.esm.js +12 -0
- package/dist/components/StepPrepareCreatePullRequest/PreparePullRequestForm.esm.js.map +1 -0
- package/dist/components/StepPrepareCreatePullRequest/PreviewCatalogInfoComponent.esm.js +28 -0
- package/dist/components/StepPrepareCreatePullRequest/PreviewCatalogInfoComponent.esm.js.map +1 -0
- package/dist/components/StepPrepareCreatePullRequest/PreviewPullRequestComponent.esm.js +13 -0
- package/dist/components/StepPrepareCreatePullRequest/PreviewPullRequestComponent.esm.js.map +1 -0
- package/dist/components/StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.esm.js +185 -0
- package/dist/components/StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.esm.js.map +1 -0
- package/dist/components/StepPrepareSelectLocations/StepPrepareSelectLocations.esm.js +80 -0
- package/dist/components/StepPrepareSelectLocations/StepPrepareSelectLocations.esm.js.map +1 -0
- package/dist/components/StepReviewLocation/StepReviewLocation.esm.js +102 -0
- package/dist/components/StepReviewLocation/StepReviewLocation.esm.js.map +1 -0
- package/dist/components/helpers.esm.js +18 -0
- package/dist/components/helpers.esm.js.map +1 -0
- package/dist/components/useImportState.esm.js +102 -0
- package/dist/components/useImportState.esm.js.map +1 -0
- package/dist/hooks/useCatalogFilename.esm.js +10 -0
- package/dist/hooks/useCatalogFilename.esm.js.map +1 -0
- package/dist/index.esm.js +14 -47
- package/dist/index.esm.js.map +1 -1
- package/dist/plugin.esm.js +53 -0
- package/dist/plugin.esm.js.map +1 -0
- package/package.json +11 -11
- package/dist/esm/DefaultImportPage-CkqCH5aQ.esm.js +0 -1104
- package/dist/esm/DefaultImportPage-CkqCH5aQ.esm.js.map +0 -1
- package/dist/esm/index-ClJNUA7x.esm.js +0 -56
- package/dist/esm/index-ClJNUA7x.esm.js.map +0 -1
- package/dist/esm/plugin-_ZVWmjOr.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-import
|
|
2
2
|
|
|
3
|
+
## 0.10.11-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/core-compat-api@0.2.5-next.0
|
|
9
|
+
- @backstage/catalog-model@1.5.0-next.0
|
|
10
|
+
- @backstage/core-components@0.14.5-next.0
|
|
11
|
+
- @backstage/catalog-client@1.6.5-next.0
|
|
12
|
+
- @backstage/plugin-catalog-common@1.0.23-next.0
|
|
13
|
+
- @backstage/plugin-catalog-react@1.11.4-next.0
|
|
14
|
+
- @backstage/config@1.2.0
|
|
15
|
+
- @backstage/core-plugin-api@1.9.2
|
|
16
|
+
- @backstage/errors@1.2.4
|
|
17
|
+
- @backstage/frontend-plugin-api@0.6.5-next.0
|
|
18
|
+
- @backstage/integration@1.10.0
|
|
19
|
+
- @backstage/integration-react@1.1.26
|
|
20
|
+
|
|
3
21
|
## 0.10.10
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.esm.js
CHANGED
|
@@ -3,17 +3,15 @@ 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 {
|
|
6
|
+
import { catalogImportApiRef } from './api/CatalogImportApi.esm.js';
|
|
7
|
+
import { CatalogImportClient } from './api/CatalogImportClient.esm.js';
|
|
8
|
+
import { rootRouteRef } from './plugin.esm.js';
|
|
7
9
|
import { catalogApiRef } from '@backstage/plugin-catalog-react';
|
|
8
|
-
import '@octokit/rest';
|
|
9
|
-
import 'js-base64';
|
|
10
|
-
import 'yaml';
|
|
11
|
-
import 'git-url-parse';
|
|
12
10
|
|
|
13
11
|
const catalogImportPage = createPageExtension({
|
|
14
12
|
defaultPath: "/catalog-import",
|
|
15
13
|
routeRef: convertLegacyRouteRef(rootRouteRef),
|
|
16
|
-
loader: () => import('./
|
|
14
|
+
loader: () => import('./components/ImportPage/index.esm.js').then(
|
|
17
15
|
(m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ImportPage, null))
|
|
18
16
|
)
|
|
19
17
|
});
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -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 identityApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n createApiExtension,\n createPageExtension,\n createPlugin,\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 = createPageExtension({\n defaultPath: '/catalog-import',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n loader: () =>\n import('./components/ImportPage').then(m =>\n compatWrapper(<m.ImportPage />),\n ),\n});\n\nconst catalogImportApi = createApiExtension({\n factory: 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\n/** @alpha */\nexport default createPlugin({\n id: 'catalog-import',\n extensions: [catalogImportApi, catalogImportPage],\n routes: {\n importPage: convertLegacyRouteRef(rootRouteRef),\n },\n});\n"],"names":[],"mappings":"
|
|
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 identityApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n createApiExtension,\n createPageExtension,\n createPlugin,\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 = createPageExtension({\n defaultPath: '/catalog-import',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n loader: () =>\n import('./components/ImportPage').then(m =>\n compatWrapper(<m.ImportPage />),\n ),\n});\n\nconst catalogImportApi = createApiExtension({\n factory: 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\n/** @alpha */\nexport default createPlugin({\n id: 'catalog-import',\n extensions: [catalogImportApi, catalogImportPage],\n routes: {\n importPage: convertLegacyRouteRef(rootRouteRef),\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AA0CA,MAAM,oBAAoB,mBAAoB,CAAA;AAAA,EAC5C,WAAa,EAAA,iBAAA;AAAA,EACb,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,EAC5C,MAAQ,EAAA,MACN,OAAO,sCAAyB,CAAE,CAAA,IAAA;AAAA,IAAK,OACrC,aAAc,iBAAA,KAAA,CAAA,aAAA,CAAC,CAAE,CAAA,UAAA,EAAF,IAAa,CAAE,CAAA;AAAA,GAChC;AACJ,CAAC,CAAA,CAAA;AAED,MAAM,mBAAmB,kBAAmB,CAAA;AAAA,EAC1C,SAAS,gBAAiB,CAAA;AAAA,IACxB,GAAK,EAAA,mBAAA;AAAA,IACL,IAAM,EAAA;AAAA,MACJ,YAAc,EAAA,eAAA;AAAA,MACd,UAAY,EAAA,aAAA;AAAA,MACZ,WAAa,EAAA,cAAA;AAAA,MACb,kBAAoB,EAAA,qBAAA;AAAA,MACpB,UAAY,EAAA,aAAA;AAAA,MACZ,SAAW,EAAA,YAAA;AAAA,KACb;AAAA,IACA,SAAS,CAAC;AAAA,MACR,YAAA;AAAA,MACA,UAAA;AAAA,MACA,WAAA;AAAA,MACA,kBAAA;AAAA,MACA,UAAA;AAAA,MACA,SAAA;AAAA,KACF,KACE,IAAI,mBAAoB,CAAA;AAAA,MACtB,YAAA;AAAA,MACA,UAAA;AAAA,MACA,kBAAA;AAAA,MACA,WAAA;AAAA,MACA,UAAA;AAAA,MACA,SAAA;AAAA,KACD,CAAA;AAAA,GACJ,CAAA;AACH,CAAC,CAAA,CAAA;AAGD,YAAe,YAAa,CAAA;AAAA,EAC1B,EAAI,EAAA,gBAAA;AAAA,EACJ,UAAA,EAAY,CAAC,gBAAA,EAAkB,iBAAiB,CAAA;AAAA,EAChD,MAAQ,EAAA;AAAA,IACN,UAAA,EAAY,sBAAsB,YAAY,CAAA;AAAA,GAChD;AACF,CAAC,CAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CatalogImportApi.esm.js","sources":["../../src/api/CatalogImportApi.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"],"names":[],"mappings":";;AAyBO,MAAM,sBAAsB,YAA+B,CAAA;AAAA,EAChE,EAAI,EAAA,+BAAA;AACN,CAAC;;;;"}
|
|
@@ -1,43 +1,8 @@
|
|
|
1
|
-
import { createApiRef, createRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, configApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
|
|
2
|
-
import { scmAuthApiRef, scmIntegrationsApiRef } from '@backstage/integration-react';
|
|
3
|
-
import { catalogApiRef } from '@backstage/plugin-catalog-react';
|
|
4
1
|
import { Octokit } from '@octokit/rest';
|
|
5
2
|
import { Base64 } from 'js-base64';
|
|
6
3
|
import YAML from 'yaml';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
const catalogImportApiRef = createApiRef({
|
|
10
|
-
id: "plugin.catalog-import.service"
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const getGithubIntegrationConfig = (scmIntegrationsApi, location) => {
|
|
14
|
-
const integration = scmIntegrationsApi.github.byUrl(location);
|
|
15
|
-
if (!integration) {
|
|
16
|
-
return void 0;
|
|
17
|
-
}
|
|
18
|
-
const { name: repo, owner } = parseGitUrl(location);
|
|
19
|
-
return {
|
|
20
|
-
repo,
|
|
21
|
-
owner,
|
|
22
|
-
githubIntegrationConfig: integration.config
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
function asInputRef(renderResult) {
|
|
27
|
-
const { ref, ...rest } = renderResult;
|
|
28
|
-
return {
|
|
29
|
-
inputRef: ref,
|
|
30
|
-
...rest
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function getCatalogFilename(config) {
|
|
34
|
-
var _a;
|
|
35
|
-
return (_a = config.getOptionalString("catalog.import.entityFilename")) != null ? _a : "catalog-info.yaml";
|
|
36
|
-
}
|
|
37
|
-
function getBranchName(config) {
|
|
38
|
-
var _a;
|
|
39
|
-
return (_a = config.getOptionalString("catalog.import.pullRequestBranchName")) != null ? _a : "backstage-integration";
|
|
40
|
-
}
|
|
4
|
+
import { getGithubIntegrationConfig } from './GitHub.esm.js';
|
|
5
|
+
import { getCatalogFilename, getBranchName } from '../components/helpers.esm.js';
|
|
41
6
|
|
|
42
7
|
var __defProp = Object.defineProperty;
|
|
43
8
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -294,50 +259,5 @@ function formatHttpErrorMessage(message, error) {
|
|
|
294
259
|
return `${message}, received http response status code ${error.status}: ${error.message}`;
|
|
295
260
|
}
|
|
296
261
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
});
|
|
300
|
-
const catalogImportPlugin = createPlugin({
|
|
301
|
-
id: "catalog-import",
|
|
302
|
-
apis: [
|
|
303
|
-
createApiFactory({
|
|
304
|
-
api: catalogImportApiRef,
|
|
305
|
-
deps: {
|
|
306
|
-
discoveryApi: discoveryApiRef,
|
|
307
|
-
scmAuthApi: scmAuthApiRef,
|
|
308
|
-
identityApi: identityApiRef,
|
|
309
|
-
scmIntegrationsApi: scmIntegrationsApiRef,
|
|
310
|
-
catalogApi: catalogApiRef,
|
|
311
|
-
configApi: configApiRef
|
|
312
|
-
},
|
|
313
|
-
factory: ({
|
|
314
|
-
discoveryApi,
|
|
315
|
-
scmAuthApi,
|
|
316
|
-
identityApi,
|
|
317
|
-
scmIntegrationsApi,
|
|
318
|
-
catalogApi,
|
|
319
|
-
configApi
|
|
320
|
-
}) => new CatalogImportClient({
|
|
321
|
-
discoveryApi,
|
|
322
|
-
scmAuthApi,
|
|
323
|
-
scmIntegrationsApi,
|
|
324
|
-
identityApi,
|
|
325
|
-
catalogApi,
|
|
326
|
-
configApi
|
|
327
|
-
})
|
|
328
|
-
})
|
|
329
|
-
],
|
|
330
|
-
routes: {
|
|
331
|
-
importPage: rootRouteRef
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
const CatalogImportPage = catalogImportPlugin.provide(
|
|
335
|
-
createRoutableExtension({
|
|
336
|
-
name: "CatalogImportPage",
|
|
337
|
-
component: () => import('./index-ClJNUA7x.esm.js').then((m) => m.ImportPage),
|
|
338
|
-
mountPoint: rootRouteRef
|
|
339
|
-
})
|
|
340
|
-
);
|
|
341
|
-
|
|
342
|
-
export { CatalogImportPage as C, catalogImportApiRef as a, CatalogImportClient as b, catalogImportPlugin as c, asInputRef as d, getCatalogFilename as g, rootRouteRef as r };
|
|
343
|
-
//# sourceMappingURL=plugin-_ZVWmjOr.esm.js.map
|
|
262
|
+
export { CatalogImportClient };
|
|
263
|
+
//# sourceMappingURL=CatalogImportClient.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CatalogImportClient.esm.js","sources":["../../src/api/CatalogImportClient.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 { 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 YAML from 'yaml';\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 const parseData = YAML.parse(fileContent);\n\n const validationResponse = await this.catalogApi.validateEntity(\n parseData,\n `url:${repositoryUrl}`,\n );\n if (!validationResponse.valid) {\n throw new Error(validationResponse.errors[0].message);\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 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"],"names":["_a"],"mappings":";;;;;;;;;;;;AAyCO,MAAM,mBAAgD,CAAA;AAAA,EAQ3D,YAAY,OAOT,EAAA;AAdH,IAAiB,aAAA,CAAA,IAAA,EAAA,cAAA,CAAA,CAAA;AACjB,IAAiB,aAAA,CAAA,IAAA,EAAA,aAAA,CAAA,CAAA;AACjB,IAAiB,aAAA,CAA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AA,MAAM,IAAI,KAAA;AAAA,QACR,sBAAA;AAAA,UACE,sCAAsC,UAAU,CAAA,OAAA,CAAA;AAAA,UAChD,CAAA;AAAA,SACF;AAAA,OACF,CAAA;AAAA,KACD,CAAA,CAAA;AAEH,IAAO,OAAA;AAAA,MACL,IAAA,EAAM,oBAAoB,IAAK,CAAA,QAAA;AAAA,MAC/B,QAAU,EAAA,CAAA,QAAA,EAAW,uBAAwB,CAAA,IAAI,CAAI,CAAA,EAAA,KAAK,CAAI,CAAA,EAAA,IAAI,CAAS,MAAA,EAAA,QAAA,CAAS,IAAK,CAAA,cAAc,IAAI,QAAQ,CAAA,CAAA;AAAA,KACrH,CAAA;AAAA,GACF;AACF,CAAA;AAEA,SAAS,sBAAA,CACP,SACA,KACA,EAAA;AACA,EAAA,OAAO,GAAG,OAAO,CAAA,qCAAA,EAAwC,MAAM,MAAM,CAAA,EAAA,EAAK,MAAM,OAAO,CAAA,CAAA,CAAA;AACzF;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import parseGitUrl from 'git-url-parse';
|
|
2
|
+
|
|
3
|
+
const getGithubIntegrationConfig = (scmIntegrationsApi, location) => {
|
|
4
|
+
const integration = scmIntegrationsApi.github.byUrl(location);
|
|
5
|
+
if (!integration) {
|
|
6
|
+
return void 0;
|
|
7
|
+
}
|
|
8
|
+
const { name: repo, owner } = parseGitUrl(location);
|
|
9
|
+
return {
|
|
10
|
+
repo,
|
|
11
|
+
owner,
|
|
12
|
+
githubIntegrationConfig: integration.config
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { getGithubIntegrationConfig };
|
|
17
|
+
//# sourceMappingURL=GitHub.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHub.esm.js","sources":["../../src/api/GitHub.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 { 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"],"names":[],"mappings":";;AAmBa,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,EAAA,IAAA,EAAM,KAAM,EAAA,GAAI,YAAY,QAAQ,CAAA,CAAA;AAClD,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,KAAA;AAAA,IACA,yBAAyB,WAAY,CAAA,MAAA;AAAA,GACvC,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { LinkButton } from '@backstage/core-components';
|
|
2
|
+
import Button from '@material-ui/core/Button';
|
|
3
|
+
import CircularProgress from '@material-ui/core/CircularProgress';
|
|
4
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
const useStyles = makeStyles((theme) => ({
|
|
8
|
+
wrapper: {
|
|
9
|
+
marginTop: theme.spacing(1),
|
|
10
|
+
marginRight: theme.spacing(1),
|
|
11
|
+
position: "relative"
|
|
12
|
+
},
|
|
13
|
+
buttonProgress: {
|
|
14
|
+
position: "absolute",
|
|
15
|
+
top: "50%",
|
|
16
|
+
left: "50%",
|
|
17
|
+
marginTop: -12,
|
|
18
|
+
marginLeft: -12
|
|
19
|
+
},
|
|
20
|
+
button: {
|
|
21
|
+
marginTop: theme.spacing(1),
|
|
22
|
+
marginRight: theme.spacing(1)
|
|
23
|
+
}
|
|
24
|
+
}));
|
|
25
|
+
const NextButton = (props) => {
|
|
26
|
+
const { loading, ...buttonProps } = props;
|
|
27
|
+
const classes = useStyles();
|
|
28
|
+
return /* @__PURE__ */ React.createElement("div", { className: classes.wrapper }, /* @__PURE__ */ React.createElement(
|
|
29
|
+
Button,
|
|
30
|
+
{
|
|
31
|
+
color: "primary",
|
|
32
|
+
variant: "contained",
|
|
33
|
+
...buttonProps,
|
|
34
|
+
disabled: props.disabled || props.loading
|
|
35
|
+
}
|
|
36
|
+
), props.loading && /* @__PURE__ */ React.createElement(CircularProgress, { size: "1.5rem", className: classes.buttonProgress }), props.loading);
|
|
37
|
+
};
|
|
38
|
+
const BackButton = (props) => {
|
|
39
|
+
const classes = useStyles();
|
|
40
|
+
return /* @__PURE__ */ React.createElement(Button, { variant: "outlined", className: classes.button, ...props }, props.children || "Back");
|
|
41
|
+
};
|
|
42
|
+
const ViewComponentButton = (props) => {
|
|
43
|
+
const classes = useStyles();
|
|
44
|
+
return /* @__PURE__ */ React.createElement(
|
|
45
|
+
LinkButton,
|
|
46
|
+
{
|
|
47
|
+
color: "primary",
|
|
48
|
+
variant: "contained",
|
|
49
|
+
className: classes.button,
|
|
50
|
+
...props
|
|
51
|
+
},
|
|
52
|
+
props.children
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { BackButton, NextButton, ViewComponentButton };
|
|
57
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../src/components/Buttons/index.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 { LinkButton } from '@backstage/core-components';\nimport Button from '@material-ui/core/Button';\nimport CircularProgress from '@material-ui/core/CircularProgress';\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"],"names":[],"mappings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A,cAAA,EAAgB,CAEpE,EAAA,KAAA,CAAM,OACT,CAAA,CAAA;AAEJ,EAAA;AAEa,MAAA,UAAA,GAAa,CAAC,KAAyC,KAAA;AAClE,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,OAAA,EAAQ,UAAW,EAAA,SAAA,EAAW,OAAQ,CAAA,MAAA,EAAS,GAAG,KAAA,EAAA,EACvD,KAAM,CAAA,QAAA,IAAY,MACrB,CAAA,CAAA;AAEJ,EAAA;AAEa,MAAA,mBAAA,GAAsB,CACjC,KACG,KAAA;AACH,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,SAAA;AAAA,MACN,OAAQ,EAAA,WAAA;AAAA,MACR,WAAW,OAAQ,CAAA,MAAA;AAAA,MAClB,GAAG,KAAA;AAAA,KAAA;AAAA,IAEH,KAAM,CAAA,QAAA;AAAA,GACT,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Page, Header, Content, ContentHeader, SupportButton } from '@backstage/core-components';
|
|
2
|
+
import { useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
3
|
+
import Grid from '@material-ui/core/Grid';
|
|
4
|
+
import useMediaQuery from '@material-ui/core/useMediaQuery';
|
|
5
|
+
import { useTheme } from '@material-ui/core/styles';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { ImportInfoCard } from '../ImportInfoCard/ImportInfoCard.esm.js';
|
|
8
|
+
import { ImportStepper } from '../ImportStepper/ImportStepper.esm.js';
|
|
9
|
+
import '@material-ui/core/Box';
|
|
10
|
+
import '@material-ui/core/Checkbox';
|
|
11
|
+
import '@material-ui/core/FormControlLabel';
|
|
12
|
+
import '@material-ui/core/FormHelperText';
|
|
13
|
+
import '@material-ui/core/StepLabel';
|
|
14
|
+
import '@material-ui/core/TextField';
|
|
15
|
+
import '@material-ui/core/Typography';
|
|
16
|
+
import '../Buttons/index.esm.js';
|
|
17
|
+
import '@material-ui/icons/LocationOn';
|
|
18
|
+
import '../EntityListComponent/EntityListComponent.esm.js';
|
|
19
|
+
import 'lodash/partition';
|
|
20
|
+
import '@backstage/catalog-model';
|
|
21
|
+
import '@backstage/plugin-catalog-react';
|
|
22
|
+
import 'react-hook-form';
|
|
23
|
+
import '../../api/CatalogImportApi.esm.js';
|
|
24
|
+
import '@octokit/rest';
|
|
25
|
+
import 'js-base64';
|
|
26
|
+
import 'yaml';
|
|
27
|
+
import 'git-url-parse';
|
|
28
|
+
import '@material-ui/core/CircularProgress';
|
|
29
|
+
import '@material-ui/lab/Autocomplete';
|
|
30
|
+
import '@material-ui/core/Card';
|
|
31
|
+
import '@material-ui/core/CardContent';
|
|
32
|
+
import '@material-ui/core/CardHeader';
|
|
33
|
+
import 'lodash';
|
|
34
|
+
import '../StepPrepareCreatePullRequest/StepPrepareCreatePullRequest.esm.js';
|
|
35
|
+
import '@material-ui/core/ListItem';
|
|
36
|
+
import '@material-ui/core/ListItemIcon';
|
|
37
|
+
import '@material-ui/core/ListItemText';
|
|
38
|
+
import '@backstage/errors';
|
|
39
|
+
|
|
40
|
+
const DefaultImportPage = () => {
|
|
41
|
+
const theme = useTheme();
|
|
42
|
+
const configApi = useApi(configApiRef);
|
|
43
|
+
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
|
44
|
+
const appTitle = configApi.getOptionalString("app.title") || "Backstage";
|
|
45
|
+
const contentItems = [
|
|
46
|
+
/* @__PURE__ */ React.createElement(Grid, { key: 0, item: true, xs: 12, md: 4, lg: 6, xl: 8 }, /* @__PURE__ */ React.createElement(ImportInfoCard, null)),
|
|
47
|
+
/* @__PURE__ */ React.createElement(Grid, { key: 1, item: true, xs: 12, md: 8, lg: 6, xl: 4 }, /* @__PURE__ */ React.createElement(ImportStepper, null))
|
|
48
|
+
];
|
|
49
|
+
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, "Start tracking your component in ", appTitle, " by adding it to the software catalog.")), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2 }, isMobile ? contentItems : contentItems.reverse())));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { DefaultImportPage };
|
|
53
|
+
//# sourceMappingURL=DefaultImportPage.esm.js.map
|
|
@@ -0,0 +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 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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,MAAM,oBAAoB,MAAM;AACrC,EAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AACvB,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA,CAAA;AACrC,EAAA,MAAM,WAAW,aAAc,CAAA,KAAA,CAAM,WAAY,CAAA,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA;AAC3D,EAAA,MAAM,QAAW,GAAA,SAAA,CAAU,iBAAkB,CAAA,WAAW,CAAK,IAAA,WAAA,CAAA;AAE7D,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,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;;;;"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useApp } from '@backstage/core-plugin-api';
|
|
2
|
+
import { humanizeEntityRef, EntityRefLink } from '@backstage/plugin-catalog-react';
|
|
3
|
+
import Collapse from '@material-ui/core/Collapse';
|
|
4
|
+
import IconButton from '@material-ui/core/IconButton';
|
|
5
|
+
import List from '@material-ui/core/List';
|
|
6
|
+
import ListItem from '@material-ui/core/ListItem';
|
|
7
|
+
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
|
8
|
+
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
|
|
9
|
+
import ListItemText from '@material-ui/core/ListItemText';
|
|
10
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
11
|
+
import ExpandLessIcon from '@material-ui/icons/ExpandLess';
|
|
12
|
+
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
|
13
|
+
import React, { useState } from 'react';
|
|
14
|
+
|
|
15
|
+
const useStyles = makeStyles((theme) => ({
|
|
16
|
+
nested: {
|
|
17
|
+
paddingLeft: theme.spacing(4)
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
20
|
+
function sortEntities(entities) {
|
|
21
|
+
return entities.sort(
|
|
22
|
+
(a, b) => humanizeEntityRef(a).localeCompare(humanizeEntityRef(b))
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
const EntityListComponent = (props) => {
|
|
26
|
+
const {
|
|
27
|
+
locations,
|
|
28
|
+
collapsed = false,
|
|
29
|
+
locationListItemIcon,
|
|
30
|
+
onItemClick,
|
|
31
|
+
firstListItem,
|
|
32
|
+
withLinks = false
|
|
33
|
+
} = props;
|
|
34
|
+
const app = useApp();
|
|
35
|
+
const classes = useStyles();
|
|
36
|
+
const [expandedUrls, setExpandedUrls] = useState([]);
|
|
37
|
+
const handleClick = (url) => {
|
|
38
|
+
setExpandedUrls(
|
|
39
|
+
(urls) => urls.includes(url) ? urls.filter((u) => u !== url) : urls.concat(url)
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ React.createElement(List, null, firstListItem, locations.map((r) => /* @__PURE__ */ React.createElement(React.Fragment, { key: r.target }, /* @__PURE__ */ React.createElement(
|
|
43
|
+
ListItem,
|
|
44
|
+
{
|
|
45
|
+
dense: true,
|
|
46
|
+
button: Boolean(onItemClick),
|
|
47
|
+
onClick: () => onItemClick == null ? void 0 : onItemClick(r.target)
|
|
48
|
+
},
|
|
49
|
+
/* @__PURE__ */ React.createElement(ListItemIcon, null, locationListItemIcon(r.target)),
|
|
50
|
+
/* @__PURE__ */ React.createElement(
|
|
51
|
+
ListItemText,
|
|
52
|
+
{
|
|
53
|
+
primary: r.target,
|
|
54
|
+
secondary: `Entities: ${r.entities.length}`
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
collapsed && /* @__PURE__ */ React.createElement(ListItemSecondaryAction, null, /* @__PURE__ */ React.createElement(IconButton, { edge: "end", onClick: () => handleClick(r.target) }, expandedUrls.includes(r.target) ? /* @__PURE__ */ React.createElement(ExpandLessIcon, null) : /* @__PURE__ */ React.createElement(ExpandMoreIcon, null)))
|
|
58
|
+
), /* @__PURE__ */ React.createElement(
|
|
59
|
+
Collapse,
|
|
60
|
+
{
|
|
61
|
+
in: !collapsed || expandedUrls.includes(r.target),
|
|
62
|
+
timeout: "auto",
|
|
63
|
+
unmountOnExit: true
|
|
64
|
+
},
|
|
65
|
+
/* @__PURE__ */ React.createElement(List, { component: "div", disablePadding: true, dense: true }, sortEntities(r.entities).map((entity) => {
|
|
66
|
+
const Icon = app.getSystemIcon(
|
|
67
|
+
`kind:${entity.kind.toLocaleLowerCase("en-US")}`
|
|
68
|
+
);
|
|
69
|
+
return /* @__PURE__ */ React.createElement(
|
|
70
|
+
ListItem,
|
|
71
|
+
{
|
|
72
|
+
key: humanizeEntityRef(entity),
|
|
73
|
+
className: classes.nested,
|
|
74
|
+
...withLinks ? {
|
|
75
|
+
component: EntityRefLink,
|
|
76
|
+
entityRef: entity,
|
|
77
|
+
button: withLinks
|
|
78
|
+
} : {}
|
|
79
|
+
},
|
|
80
|
+
/* @__PURE__ */ React.createElement(ListItemIcon, null, Icon && /* @__PURE__ */ React.createElement(Icon, null)),
|
|
81
|
+
/* @__PURE__ */ React.createElement(ListItemText, { primary: humanizeEntityRef(entity) })
|
|
82
|
+
);
|
|
83
|
+
}))
|
|
84
|
+
))));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export { EntityListComponent };
|
|
88
|
+
//# sourceMappingURL=EntityListComponent.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityListComponent.esm.js","sources":["../../../src/components/EntityListComponent/EntityListComponent.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, CompoundEntityRef } from '@backstage/catalog-model';\nimport { useApp } from '@backstage/core-plugin-api';\nimport {\n EntityRefLink,\n humanizeEntityRef,\n} from '@backstage/plugin-catalog-react';\nimport Collapse from '@material-ui/core/Collapse';\nimport IconButton from '@material-ui/core/IconButton';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport ListItemText from '@material-ui/core/ListItemText';\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"],"names":[],"mappings":";;;;;;;;;;;;;;AAkCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GAC9B;AACF,CAAE,CAAA,CAAA,CAAA;AAEF,SAAS,aAAa,QAA6C,EAAA;AACjE,EAAA,OAAO,QAAS,CAAA,IAAA;AAAA,IAAK,CAAC,GAAG,CACvB,KAAA,iBAAA,CAAkB,CAAC,CAAE,CAAA,aAAA,CAAc,iBAAkB,CAAA,CAAC,CAAC,CAAA;AAAA,GACzD,CAAA;AACF,CAAA;AAwBa,MAAA,mBAAA,GAAsB,CAAC,KAAoC,KAAA;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A;AAAA,UAClB,GAAI,SACD,GAAA;AAAA,YACE,SAAW,EAAA,aAAA;AAAA,YACX,SAAW,EAAA,MAAA;AAAA,YACX,MAAQ,EAAA,SAAA;AAAA,cAEV,EAAC;AAAA,SAAA;AAAA,wBAEJ,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,IAAA,EAAc,IAAQ,oBAAA,KAAA,CAAA,aAAA,CAAC,UAAK,CAAG,CAAA;AAAA,wBAC/B,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,OAAS,EAAA,iBAAA,CAAkB,MAAM,CAAG,EAAA,CAAA;AAAA,OACpD,CAAA;AAAA,KAEH,CACH,CAAA;AAAA,GAEJ,CACD,CACH,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { InfoCard } from '@backstage/core-components';
|
|
2
|
+
import { useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
3
|
+
import Chip from '@material-ui/core/Chip';
|
|
4
|
+
import Typography from '@material-ui/core/Typography';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { catalogImportApiRef } from '../../api/CatalogImportApi.esm.js';
|
|
7
|
+
import '@octokit/rest';
|
|
8
|
+
import 'js-base64';
|
|
9
|
+
import 'yaml';
|
|
10
|
+
import 'git-url-parse';
|
|
11
|
+
import { useCatalogFilename } from '../../hooks/useCatalogFilename.esm.js';
|
|
12
|
+
|
|
13
|
+
const ImportInfoCard = (props) => {
|
|
14
|
+
const {
|
|
15
|
+
exampleLocationUrl = "https://github.com/backstage/backstage/blob/master/catalog-info.yaml",
|
|
16
|
+
exampleRepositoryUrl = "https://github.com/backstage/backstage"
|
|
17
|
+
} = props;
|
|
18
|
+
const configApi = useApi(configApiRef);
|
|
19
|
+
const appTitle = configApi.getOptionalString("app.title") || "Backstage";
|
|
20
|
+
const catalogImportApi = useApi(catalogImportApiRef);
|
|
21
|
+
const hasGithubIntegration = configApi.has("integrations.github");
|
|
22
|
+
const catalogFilename = useCatalogFilename();
|
|
23
|
+
return /* @__PURE__ */ React.createElement(
|
|
24
|
+
InfoCard,
|
|
25
|
+
{
|
|
26
|
+
title: "Register an existing component",
|
|
27
|
+
titleTypographyProps: { component: "h3" },
|
|
28
|
+
deepLink: {
|
|
29
|
+
title: "Learn more about the Software Catalog",
|
|
30
|
+
link: "https://backstage.io/docs/features/software-catalog/"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
/* @__PURE__ */ React.createElement(Typography, { variant: "body2", paragraph: true }, "Enter the URL to your source code repository to add it to ", appTitle, "."),
|
|
34
|
+
/* @__PURE__ */ React.createElement(Typography, { component: "h4", variant: "h6" }, "Link to an existing entity file"),
|
|
35
|
+
/* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2", color: "textSecondary", paragraph: true }, "Example: ", /* @__PURE__ */ React.createElement("code", null, exampleLocationUrl)),
|
|
36
|
+
/* @__PURE__ */ React.createElement(Typography, { variant: "body2", paragraph: true }, "The wizard analyzes the file, previews the entities, and adds them to the ", appTitle, " catalog."),
|
|
37
|
+
hasGithubIntegration && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { component: "h4", variant: "h6" }, "Link to a repository", " ", /* @__PURE__ */ React.createElement(Chip, { label: "GitHub only", variant: "outlined", size: "small" })), /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2", color: "textSecondary", paragraph: true }, "Example: ", /* @__PURE__ */ React.createElement("code", null, exampleRepositoryUrl)), /* @__PURE__ */ React.createElement(Typography, { variant: "body2", paragraph: true }, "The wizard discovers all ", /* @__PURE__ */ React.createElement("code", null, catalogFilename), " files in the repository, previews the entities, and adds them to the ", appTitle, " ", "catalog."), catalogImportApi.preparePullRequest && /* @__PURE__ */ React.createElement(Typography, { variant: "body2", paragraph: true }, "If no entities are found, the wizard will prepare a Pull Request that adds an example ", /* @__PURE__ */ React.createElement("code", null, catalogFilename), " and prepares the ", appTitle, " catalog to load all entities as soon as the Pull Request is merged."))
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { ImportInfoCard };
|
|
42
|
+
//# sourceMappingURL=ImportInfoCard.esm.js.map
|
|
@@ -0,0 +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;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,IAAA,WAAA,CAAA;AAC7D,EAAM,MAAA,gBAAA,GAAmB,OAAO,mBAAmB,CAAA,CAAA;AAEnD,EAAM,MAAA,oBAAA,GAAuB,SAAU,CAAA,GAAA,CAAI,qBAAqB,CAAA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AAW,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,CAAA;AAAA,GAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useOutlet } from 'react-router-dom';
|
|
3
|
+
import { DefaultImportPage } from '../DefaultImportPage/DefaultImportPage.esm.js';
|
|
4
|
+
|
|
5
|
+
const ImportPage = () => {
|
|
6
|
+
const outlet = useOutlet();
|
|
7
|
+
return outlet || /* @__PURE__ */ React.createElement(DefaultImportPage, null);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { ImportPage };
|
|
11
|
+
//# sourceMappingURL=ImportPage.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportPage.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;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|