@backstage/plugin-catalog-import 0.8.0-next.0 → 0.8.2
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 +81 -0
- package/dist/esm/{index-ebc7277b.esm.js → index-577cd187.esm.js} +1 -1
- package/dist/esm/{index-ebc7277b.esm.js.map → index-577cd187.esm.js.map} +1 -1
- package/dist/index.d.ts +164 -30
- package/dist/index.esm.js +65 -82
- package/dist/index.esm.js.map +1 -1
- package/package.json +26 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,86 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-import
|
|
2
2
|
|
|
3
|
+
## 0.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1ed305728b: Bump `node-fetch` to version 2.6.7 and `cross-fetch` to version 3.1.5
|
|
8
|
+
- c77c5c7eb6: Added `backstage.role` to `package.json`
|
|
9
|
+
- deaf6065db: Adapt to the new `CatalogApi.getLocationByRef`
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- @backstage/catalog-client@0.7.0
|
|
12
|
+
- @backstage/core-components@0.8.9
|
|
13
|
+
- @backstage/core-plugin-api@0.6.1
|
|
14
|
+
- @backstage/errors@0.2.1
|
|
15
|
+
- @backstage/integration@0.7.3
|
|
16
|
+
- @backstage/integration-react@0.1.22
|
|
17
|
+
- @backstage/plugin-catalog-react@0.6.15
|
|
18
|
+
- @backstage/catalog-model@0.10.0
|
|
19
|
+
- @backstage/config@0.1.14
|
|
20
|
+
|
|
21
|
+
## 0.8.1
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 7bb1bde7f6: Minor API cleanups
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
- @backstage/catalog-client@0.6.0
|
|
28
|
+
- @backstage/core-components@0.8.8
|
|
29
|
+
- @backstage/plugin-catalog-react@0.6.14
|
|
30
|
+
- @backstage/integration-react@0.1.21
|
|
31
|
+
|
|
32
|
+
## 0.8.1-next.0
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- 7bb1bde7f6: Minor API cleanups
|
|
37
|
+
- Updated dependencies
|
|
38
|
+
- @backstage/core-components@0.8.8-next.0
|
|
39
|
+
- @backstage/plugin-catalog-react@0.6.14-next.0
|
|
40
|
+
- @backstage/integration-react@0.1.21-next.0
|
|
41
|
+
|
|
42
|
+
## 0.8.0
|
|
43
|
+
|
|
44
|
+
### Minor Changes
|
|
45
|
+
|
|
46
|
+
- 2e8764b95f: Make filename, branch name and examples URLs used in catalog import customizable.
|
|
47
|
+
|
|
48
|
+
Catalog backend ingestion loop can be already configured to fetch targets with custom catalog filename (other than `catalog-info.yaml`). It's now possible to customize said filename and branch name used in pull requests created by catalog import flow too. This allows organizations to further customize Backstage experience and to better reflect their branding.
|
|
49
|
+
|
|
50
|
+
Filename (default: `catalog-info.yaml`) and branch name (default: `backstage-integration`) used in pull requests can be configured in `app-config.yaml` as follows:
|
|
51
|
+
|
|
52
|
+
```yaml
|
|
53
|
+
// app-config.yaml
|
|
54
|
+
|
|
55
|
+
catalog:
|
|
56
|
+
import:
|
|
57
|
+
entityFilename: anvil.yaml
|
|
58
|
+
pullRequestBranchName: anvil-integration
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Following React components have also been updated to accept optional props for providing example entity and repository paths:
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<StepInitAnalyzeUrl
|
|
65
|
+
...
|
|
66
|
+
exampleLocationUrl="https://github.com/acme-corp/our-awesome-api/blob/main/anvil.yaml"
|
|
67
|
+
/>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<ImportInfoCard
|
|
72
|
+
exampleLocationUrl="https://github.com/acme-corp/our-awesome-api/blob/main/anvil.yaml"
|
|
73
|
+
exampleRepositoryUrl="https://github.com/acme-corp/our-awesome-api"
|
|
74
|
+
/>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- Updated dependencies
|
|
80
|
+
- @backstage/core-components@0.8.7
|
|
81
|
+
- @backstage/plugin-catalog-react@0.6.13
|
|
82
|
+
- @backstage/integration-react@0.1.20
|
|
83
|
+
|
|
3
84
|
## 0.8.0-next.0
|
|
4
85
|
|
|
5
86
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-577cd187.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';\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":";;;;;;;;;;;;;;;;;;;;;;;;;MAyBa,aAAa,MAAM;AAC9B,QAAM,SAAS;AAEf,SAAO,8CAAW,mBAAD;AAAA;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,14 +10,35 @@ import { CatalogApi } from '@backstage/catalog-client';
|
|
|
10
10
|
import { ScmIntegrationRegistry } from '@backstage/integration';
|
|
11
11
|
import { ScmAuthApi } from '@backstage/integration-react';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* A plugin that helps the user in importing projects and YAML files into the
|
|
15
|
+
* catalog.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
13
19
|
declare const catalogImportPlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
14
20
|
importPage: _backstage_core_plugin_api.RouteRef<undefined>;
|
|
15
21
|
}, {}>;
|
|
22
|
+
/**
|
|
23
|
+
* The page for importing projects and YAML files into the catalog.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
16
27
|
declare const CatalogImportPage: () => JSX.Element;
|
|
17
28
|
|
|
29
|
+
/**
|
|
30
|
+
* The default catalog import page.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
18
34
|
declare const DefaultImportPage: () => JSX.Element;
|
|
19
35
|
|
|
20
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Props for {@link EntityListComponent}.
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
interface EntityListComponentProps {
|
|
21
42
|
locations: Array<{
|
|
22
43
|
target: string;
|
|
23
44
|
entities: (Entity | EntityName)[];
|
|
@@ -27,21 +48,46 @@ declare type Props$8 = {
|
|
|
27
48
|
firstListItem?: React.ReactElement;
|
|
28
49
|
onItemClick?: (target: string) => void;
|
|
29
50
|
withLinks?: boolean;
|
|
30
|
-
}
|
|
31
|
-
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Shows a result list of entities.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
declare const EntityListComponent: (props: EntityListComponentProps) => JSX.Element;
|
|
32
58
|
|
|
33
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Props for {@link ImportInfoCard}.
|
|
61
|
+
*
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
interface ImportInfoCardProps {
|
|
34
65
|
exampleLocationUrl?: string;
|
|
35
66
|
exampleRepositoryUrl?: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Shows information about the import process.
|
|
70
|
+
*
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
declare const ImportInfoCard: (props: ImportInfoCardProps) => JSX.Element;
|
|
38
74
|
|
|
39
75
|
declare type RecursivePartial<T> = {
|
|
40
76
|
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
|
|
41
77
|
};
|
|
42
78
|
declare type PartialEntity = RecursivePartial<Entity>;
|
|
43
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Utility API reference for the {@link CatalogImportApi}.
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
44
85
|
declare const catalogImportApiRef: _backstage_core_plugin_api.ApiRef<CatalogImportApi>;
|
|
86
|
+
/**
|
|
87
|
+
* Result of the analysis.
|
|
88
|
+
*
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
45
91
|
declare type AnalyzeResult = {
|
|
46
92
|
type: 'locations';
|
|
47
93
|
locations: Array<{
|
|
@@ -55,6 +101,11 @@ declare type AnalyzeResult = {
|
|
|
55
101
|
integrationType: string;
|
|
56
102
|
generatedEntities: PartialEntity[];
|
|
57
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* API for driving catalog imports.
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
58
109
|
interface CatalogImportApi {
|
|
59
110
|
analyzeUrl(url: string): Promise<AnalyzeResult>;
|
|
60
111
|
preparePullRequest?(): Promise<{
|
|
@@ -72,6 +123,11 @@ interface CatalogImportApi {
|
|
|
72
123
|
}>;
|
|
73
124
|
}
|
|
74
125
|
|
|
126
|
+
/**
|
|
127
|
+
* The default implementation of the {@link CatalogImportApi}.
|
|
128
|
+
*
|
|
129
|
+
* @public
|
|
130
|
+
*/
|
|
75
131
|
declare class CatalogImportClient implements CatalogImportApi {
|
|
76
132
|
private readonly discoveryApi;
|
|
77
133
|
private readonly identityApi;
|
|
@@ -92,7 +148,7 @@ declare class CatalogImportClient implements CatalogImportApi {
|
|
|
92
148
|
title: string;
|
|
93
149
|
body: string;
|
|
94
150
|
}>;
|
|
95
|
-
submitPullRequest(
|
|
151
|
+
submitPullRequest(options: {
|
|
96
152
|
repositoryUrl: string;
|
|
97
153
|
fileContent: string;
|
|
98
154
|
title: string;
|
|
@@ -106,7 +162,17 @@ declare class CatalogImportClient implements CatalogImportApi {
|
|
|
106
162
|
private submitGitHubPrToRepo;
|
|
107
163
|
}
|
|
108
164
|
|
|
165
|
+
/**
|
|
166
|
+
* The configuration of the stepper.
|
|
167
|
+
*
|
|
168
|
+
* @public
|
|
169
|
+
*/
|
|
109
170
|
declare type ImportFlows = 'unknown' | 'single-location' | 'multiple-locations' | 'no-location';
|
|
171
|
+
/**
|
|
172
|
+
* Result of the prepare state.
|
|
173
|
+
*
|
|
174
|
+
* @public
|
|
175
|
+
*/
|
|
110
176
|
declare type PrepareResult = {
|
|
111
177
|
type: 'locations';
|
|
112
178
|
locations: Array<{
|
|
@@ -189,7 +255,12 @@ declare type StepConfiguration = {
|
|
|
189
255
|
stepLabel: React.ReactElement;
|
|
190
256
|
content: React.ReactElement;
|
|
191
257
|
};
|
|
192
|
-
|
|
258
|
+
/**
|
|
259
|
+
* Defines the details of the stepper.
|
|
260
|
+
*
|
|
261
|
+
* @public
|
|
262
|
+
*/
|
|
263
|
+
interface StepperProvider {
|
|
193
264
|
analyze: (s: Extract<ImportState, {
|
|
194
265
|
activeState: 'analyze';
|
|
195
266
|
}>, opts: {
|
|
@@ -210,7 +281,7 @@ declare type StepperProvider = {
|
|
|
210
281
|
}>, opts: {
|
|
211
282
|
apis: StepperApis;
|
|
212
283
|
}) => StepConfiguration;
|
|
213
|
-
}
|
|
284
|
+
}
|
|
214
285
|
/**
|
|
215
286
|
* The default stepper generation function.
|
|
216
287
|
*
|
|
@@ -219,34 +290,56 @@ declare type StepperProvider = {
|
|
|
219
290
|
*
|
|
220
291
|
* @param flow - the name of the active flow
|
|
221
292
|
* @param defaults - the default steps
|
|
293
|
+
* @public
|
|
222
294
|
*/
|
|
223
295
|
declare function defaultGenerateStepper(flow: ImportFlows, defaults: StepperProvider): StepperProvider;
|
|
224
296
|
|
|
225
|
-
|
|
297
|
+
/**
|
|
298
|
+
* Props for {@link ImportStepper}.
|
|
299
|
+
*
|
|
300
|
+
* @public
|
|
301
|
+
*/
|
|
302
|
+
interface ImportStepperProps {
|
|
226
303
|
initialUrl?: string;
|
|
227
304
|
generateStepper?: (flow: ImportFlows, defaults: StepperProvider) => StepperProvider;
|
|
228
305
|
variant?: InfoCardVariants;
|
|
229
|
-
}
|
|
230
|
-
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* The stepper that holds the different import stages.
|
|
309
|
+
*
|
|
310
|
+
* @public
|
|
311
|
+
*/
|
|
312
|
+
declare const ImportStepper: (props: ImportStepperProps) => JSX.Element;
|
|
231
313
|
|
|
232
|
-
|
|
314
|
+
/**
|
|
315
|
+
* Props for {@link StepInitAnalyzeUrl}.
|
|
316
|
+
*
|
|
317
|
+
* @public
|
|
318
|
+
*/
|
|
319
|
+
interface StepInitAnalyzeUrlProps {
|
|
233
320
|
onAnalysis: (flow: ImportFlows, url: string, result: AnalyzeResult, opts?: {
|
|
234
321
|
prepareResult?: PrepareResult;
|
|
235
322
|
}) => void;
|
|
236
323
|
disablePullRequest?: boolean;
|
|
237
324
|
analysisUrl?: string;
|
|
238
325
|
exampleLocationUrl?: string;
|
|
239
|
-
}
|
|
326
|
+
}
|
|
240
327
|
/**
|
|
241
328
|
* A form that lets the user input a url and analyze it for existing locations or potential entities.
|
|
242
329
|
*
|
|
243
330
|
* @param onAnalysis - is called when the analysis was successful
|
|
244
331
|
* @param analysisUrl - a url that can be used as a default value
|
|
245
332
|
* @param disablePullRequest - if true, repositories without entities will abort the wizard
|
|
333
|
+
* @public
|
|
246
334
|
*/
|
|
247
|
-
declare const StepInitAnalyzeUrl: (
|
|
335
|
+
declare const StepInitAnalyzeUrl: (props: StepInitAnalyzeUrlProps) => JSX.Element;
|
|
248
336
|
|
|
249
|
-
|
|
337
|
+
/**
|
|
338
|
+
* Props for {@link AutocompleteTextField}.
|
|
339
|
+
*
|
|
340
|
+
* @public
|
|
341
|
+
*/
|
|
342
|
+
interface AutocompleteTextFieldProps<TFieldValue extends string> {
|
|
250
343
|
name: TFieldValue;
|
|
251
344
|
options: string[];
|
|
252
345
|
required?: boolean;
|
|
@@ -257,10 +350,20 @@ declare type Props$4<TFieldValue extends string> = {
|
|
|
257
350
|
helperText?: React.ReactNode;
|
|
258
351
|
errorHelperText?: string;
|
|
259
352
|
textFieldProps?: Omit<TextFieldProps, 'required' | 'fullWidth'>;
|
|
260
|
-
}
|
|
261
|
-
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* An autocompletion text field for the catalog import flows.
|
|
356
|
+
*
|
|
357
|
+
* @public
|
|
358
|
+
*/
|
|
359
|
+
declare const AutocompleteTextField: <TFieldValue extends string>(props: AutocompleteTextFieldProps<TFieldValue>) => JSX.Element;
|
|
262
360
|
|
|
263
|
-
|
|
361
|
+
/**
|
|
362
|
+
* Props for {@link PreparePullRequestForm}.
|
|
363
|
+
*
|
|
364
|
+
* @public
|
|
365
|
+
*/
|
|
366
|
+
declare type PreparePullRequestFormProps<TFieldValues extends Record<string, any>> = Pick<UseFormProps<TFieldValues>, 'defaultValues'> & {
|
|
264
367
|
onSubmit: SubmitHandler<TFieldValues>;
|
|
265
368
|
render: (props: Pick<UseFormReturn<TFieldValues>, 'formState' | 'register' | 'control' | 'setValue'> & {
|
|
266
369
|
values: UnpackNestedValue<TFieldValues>;
|
|
@@ -274,28 +377,49 @@ declare type Props$3<TFieldValues extends Record<string, any>> = Pick<UseFormPro
|
|
|
274
377
|
* @param onSubmit - a callback that is executed when the form is submitted
|
|
275
378
|
* (initiated by a button of type="submit")
|
|
276
379
|
* @param render - render the form elements
|
|
380
|
+
* @public
|
|
277
381
|
*/
|
|
278
|
-
declare const PreparePullRequestForm: <TFieldValues extends Record<string, any>>(
|
|
382
|
+
declare const PreparePullRequestForm: <TFieldValues extends Record<string, any>>(props: PreparePullRequestFormProps<TFieldValues>) => JSX.Element;
|
|
279
383
|
|
|
280
|
-
|
|
384
|
+
/**
|
|
385
|
+
* Props for {@link PreviewCatalogInfoComponent}.
|
|
386
|
+
*
|
|
387
|
+
* @public
|
|
388
|
+
*/
|
|
389
|
+
interface PreviewCatalogInfoComponentProps {
|
|
281
390
|
repositoryUrl: string;
|
|
282
391
|
entities: Entity[];
|
|
283
392
|
classes?: {
|
|
284
393
|
card?: string;
|
|
285
394
|
cardContent?: string;
|
|
286
395
|
};
|
|
287
|
-
}
|
|
288
|
-
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Previews information about an entity to create.
|
|
399
|
+
*
|
|
400
|
+
* @public
|
|
401
|
+
*/
|
|
402
|
+
declare const PreviewCatalogInfoComponent: (props: PreviewCatalogInfoComponentProps) => JSX.Element;
|
|
289
403
|
|
|
290
|
-
|
|
404
|
+
/**
|
|
405
|
+
* Props for {@link PreviewPullRequestComponent}.
|
|
406
|
+
*
|
|
407
|
+
* @public
|
|
408
|
+
*/
|
|
409
|
+
interface PreviewPullRequestComponentProps {
|
|
291
410
|
title: string;
|
|
292
411
|
description: string;
|
|
293
412
|
classes?: {
|
|
294
413
|
card?: string;
|
|
295
414
|
cardContent?: string;
|
|
296
415
|
};
|
|
297
|
-
}
|
|
298
|
-
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Previews a pull request.
|
|
419
|
+
*
|
|
420
|
+
* @public
|
|
421
|
+
*/
|
|
422
|
+
declare const PreviewPullRequestComponent: (props: PreviewPullRequestComponentProps) => JSX.Element;
|
|
299
423
|
|
|
300
424
|
declare type FormData = {
|
|
301
425
|
title: string;
|
|
@@ -304,7 +428,12 @@ declare type FormData = {
|
|
|
304
428
|
owner: string;
|
|
305
429
|
useCodeowners: boolean;
|
|
306
430
|
};
|
|
307
|
-
|
|
431
|
+
/**
|
|
432
|
+
* Props for {@link StepPrepareCreatePullRequest}.
|
|
433
|
+
*
|
|
434
|
+
* @public
|
|
435
|
+
*/
|
|
436
|
+
interface StepPrepareCreatePullRequestProps {
|
|
308
437
|
analyzeResult: Extract<AnalyzeResult, {
|
|
309
438
|
type: 'repository';
|
|
310
439
|
}>;
|
|
@@ -317,7 +446,12 @@ declare type Props = {
|
|
|
317
446
|
groups: string[];
|
|
318
447
|
groupsLoading: boolean;
|
|
319
448
|
}) => React.ReactNode;
|
|
320
|
-
}
|
|
321
|
-
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Prepares a pull request.
|
|
452
|
+
*
|
|
453
|
+
* @public
|
|
454
|
+
*/
|
|
455
|
+
declare const StepPrepareCreatePullRequest: (props: StepPrepareCreatePullRequestProps) => JSX.Element;
|
|
322
456
|
|
|
323
|
-
export { AnalyzeResult, AutocompleteTextField, CatalogImportApi, CatalogImportClient, CatalogImportPage, DefaultImportPage, EntityListComponent, ImportInfoCard, ImportStepper, PreparePullRequestForm, PreviewCatalogInfoComponent, PreviewPullRequestComponent, StepInitAnalyzeUrl, StepPrepareCreatePullRequest, catalogImportApiRef, catalogImportPlugin, defaultGenerateStepper, catalogImportPlugin as plugin };
|
|
457
|
+
export { AnalyzeResult, AutocompleteTextField, AutocompleteTextFieldProps, CatalogImportApi, CatalogImportClient, CatalogImportPage, DefaultImportPage, EntityListComponent, EntityListComponentProps, ImportFlows, ImportInfoCard, ImportInfoCardProps, ImportState, ImportStepper, ImportStepperProps, PreparePullRequestForm, PreparePullRequestFormProps, PrepareResult, PreviewCatalogInfoComponent, PreviewCatalogInfoComponentProps, PreviewPullRequestComponent, PreviewPullRequestComponentProps, StepInitAnalyzeUrl, StepInitAnalyzeUrlProps, StepPrepareCreatePullRequest, StepPrepareCreatePullRequestProps, catalogImportApiRef, catalogImportPlugin, defaultGenerateStepper, catalogImportPlugin as plugin };
|
package/dist/index.esm.js
CHANGED
|
@@ -131,12 +131,8 @@ After this pull request is merged, the component will become available.
|
|
|
131
131
|
For more information, read an [overview of the Backstage software catalog](https://backstage.io/docs/features/software-catalog/software-catalog-overview).`
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
async submitPullRequest({
|
|
135
|
-
repositoryUrl,
|
|
136
|
-
fileContent,
|
|
137
|
-
title,
|
|
138
|
-
body
|
|
139
|
-
}) {
|
|
134
|
+
async submitPullRequest(options) {
|
|
135
|
+
const { repositoryUrl, fileContent, title, body } = options;
|
|
140
136
|
const ghConfig = getGithubIntegrationConfig(this.scmIntegrationsApi, repositoryUrl);
|
|
141
137
|
if (ghConfig) {
|
|
142
138
|
return await this.submitGitHubPrToRepo({
|
|
@@ -149,9 +145,7 @@ For more information, read an [overview of the Backstage software catalog](https
|
|
|
149
145
|
}
|
|
150
146
|
throw new Error("unimplemented!");
|
|
151
147
|
}
|
|
152
|
-
async generateEntityDefinitions({
|
|
153
|
-
repo
|
|
154
|
-
}) {
|
|
148
|
+
async generateEntityDefinitions(options) {
|
|
155
149
|
const { token } = await this.identityApi.getCredentials();
|
|
156
150
|
const response = await fetch(`${await this.discoveryApi.getBaseUrl("catalog")}/analyze-location`, {
|
|
157
151
|
headers: {
|
|
@@ -160,7 +154,7 @@ For more information, read an [overview of the Backstage software catalog](https
|
|
|
160
154
|
},
|
|
161
155
|
method: "POST",
|
|
162
156
|
body: JSON.stringify({
|
|
163
|
-
location: { type: "url", target: repo }
|
|
157
|
+
location: { type: "url", target: options.repo }
|
|
164
158
|
})
|
|
165
159
|
}).catch((e) => {
|
|
166
160
|
throw new Error(`Failed to generate entity definitions, ${e.message}`);
|
|
@@ -171,12 +165,8 @@ For more information, read an [overview of the Backstage software catalog](https
|
|
|
171
165
|
const payload = await response.json();
|
|
172
166
|
return payload.generateEntities.map((x) => x.entity);
|
|
173
167
|
}
|
|
174
|
-
async checkGitHubForExistingCatalogInfo({
|
|
175
|
-
url,
|
|
176
|
-
owner,
|
|
177
|
-
repo,
|
|
178
|
-
githubIntegrationConfig
|
|
179
|
-
}) {
|
|
168
|
+
async checkGitHubForExistingCatalogInfo(options) {
|
|
169
|
+
const { url, owner, repo, githubIntegrationConfig } = options;
|
|
180
170
|
const { token } = await this.scmAuthApi.getCredentials({ url });
|
|
181
171
|
const octo = new Octokit({
|
|
182
172
|
auth: token,
|
|
@@ -215,15 +205,16 @@ For more information, read an [overview of the Backstage software catalog](https
|
|
|
215
205
|
}
|
|
216
206
|
return [];
|
|
217
207
|
}
|
|
218
|
-
async submitGitHubPrToRepo({
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
208
|
+
async submitGitHubPrToRepo(options) {
|
|
209
|
+
const {
|
|
210
|
+
owner,
|
|
211
|
+
repo,
|
|
212
|
+
title,
|
|
213
|
+
body,
|
|
214
|
+
fileContent,
|
|
215
|
+
repositoryUrl,
|
|
216
|
+
githubIntegrationConfig
|
|
217
|
+
} = options;
|
|
227
218
|
const { token } = await this.scmAuthApi.getCredentials({
|
|
228
219
|
url: repositoryUrl,
|
|
229
220
|
additionalScope: {
|
|
@@ -326,7 +317,7 @@ const catalogImportPlugin = createPlugin({
|
|
|
326
317
|
});
|
|
327
318
|
const CatalogImportPage = catalogImportPlugin.provide(createRoutableExtension({
|
|
328
319
|
name: "CatalogImportPage",
|
|
329
|
-
component: () => import('./esm/index-
|
|
320
|
+
component: () => import('./esm/index-577cd187.esm.js').then((m) => m.ImportPage),
|
|
330
321
|
mountPoint: rootRouteRef
|
|
331
322
|
}));
|
|
332
323
|
|
|
@@ -335,10 +326,11 @@ function useCatalogFilename() {
|
|
|
335
326
|
return getCatalogFilename(config);
|
|
336
327
|
}
|
|
337
328
|
|
|
338
|
-
const ImportInfoCard = ({
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
329
|
+
const ImportInfoCard = (props) => {
|
|
330
|
+
const {
|
|
331
|
+
exampleLocationUrl = "https://github.com/backstage/backstage/blob/master/catalog-info.yaml",
|
|
332
|
+
exampleRepositoryUrl = "https://github.com/backstage/backstage"
|
|
333
|
+
} = props;
|
|
342
334
|
const configApi = useApi(configApiRef);
|
|
343
335
|
const appTitle = configApi.getOptional("app.title") || "Backstage";
|
|
344
336
|
const catalogImportApi = useApi(catalogImportApiRef);
|
|
@@ -526,14 +518,15 @@ const useStyles$2 = makeStyles((theme) => ({
|
|
|
526
518
|
function sortEntities(entities) {
|
|
527
519
|
return entities.sort((a, b) => formatEntityRefTitle(a).localeCompare(formatEntityRefTitle(b)));
|
|
528
520
|
}
|
|
529
|
-
const EntityListComponent = ({
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
521
|
+
const EntityListComponent = (props) => {
|
|
522
|
+
const {
|
|
523
|
+
locations,
|
|
524
|
+
collapsed = false,
|
|
525
|
+
locationListItemIcon,
|
|
526
|
+
onItemClick,
|
|
527
|
+
firstListItem,
|
|
528
|
+
withLinks = false
|
|
529
|
+
} = props;
|
|
537
530
|
const app = useApp();
|
|
538
531
|
const classes = useStyles$2();
|
|
539
532
|
const [expandedUrls, setExpandedUrls] = useState([]);
|
|
@@ -607,12 +600,13 @@ const StepFinishImportLocation = ({ prepareResult, onReset }) => {
|
|
|
607
600
|
})), continueButton);
|
|
608
601
|
};
|
|
609
602
|
|
|
610
|
-
const StepInitAnalyzeUrl = ({
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
603
|
+
const StepInitAnalyzeUrl = (props) => {
|
|
604
|
+
const {
|
|
605
|
+
onAnalysis,
|
|
606
|
+
analysisUrl = "",
|
|
607
|
+
disablePullRequest = false,
|
|
608
|
+
exampleLocationUrl = "https://github.com/backstage/backstage/blob/master/catalog-info.yaml"
|
|
609
|
+
} = props;
|
|
616
610
|
const errorApi = useApi(errorApiRef);
|
|
617
611
|
const catalogImportApi = useApi(catalogImportApiRef);
|
|
618
612
|
const {
|
|
@@ -700,18 +694,19 @@ const StepInitAnalyzeUrl = ({
|
|
|
700
694
|
}, "Analyze")));
|
|
701
695
|
};
|
|
702
696
|
|
|
703
|
-
const AutocompleteTextField = ({
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
697
|
+
const AutocompleteTextField = (props) => {
|
|
698
|
+
const {
|
|
699
|
+
name,
|
|
700
|
+
options,
|
|
701
|
+
required,
|
|
702
|
+
errors,
|
|
703
|
+
rules,
|
|
704
|
+
loading = false,
|
|
705
|
+
loadingText,
|
|
706
|
+
helperText,
|
|
707
|
+
errorHelperText,
|
|
708
|
+
textFieldProps = {}
|
|
709
|
+
} = props;
|
|
715
710
|
return /* @__PURE__ */ React.createElement(Controller, {
|
|
716
711
|
name,
|
|
717
712
|
rules,
|
|
@@ -742,11 +737,8 @@ const AutocompleteTextField = ({
|
|
|
742
737
|
});
|
|
743
738
|
};
|
|
744
739
|
|
|
745
|
-
const PreparePullRequestForm = ({
|
|
746
|
-
defaultValues,
|
|
747
|
-
onSubmit,
|
|
748
|
-
render
|
|
749
|
-
}) => {
|
|
740
|
+
const PreparePullRequestForm = (props) => {
|
|
741
|
+
const { defaultValues, onSubmit, render } = props;
|
|
750
742
|
const methods = useForm({ mode: "onTouched", defaultValues });
|
|
751
743
|
const { handleSubmit, watch, control, register, formState, setValue } = methods;
|
|
752
744
|
return /* @__PURE__ */ React.createElement(FormProvider, {
|
|
@@ -756,11 +748,8 @@ const PreparePullRequestForm = ({
|
|
|
756
748
|
}, render({ values: watch(), formState, register, control, setValue })));
|
|
757
749
|
};
|
|
758
750
|
|
|
759
|
-
const PreviewCatalogInfoComponent = ({
|
|
760
|
-
repositoryUrl,
|
|
761
|
-
entities,
|
|
762
|
-
classes
|
|
763
|
-
}) => {
|
|
751
|
+
const PreviewCatalogInfoComponent = (props) => {
|
|
752
|
+
const { repositoryUrl, entities, classes } = props;
|
|
764
753
|
const catalogFilename = useCatalogFilename();
|
|
765
754
|
return /* @__PURE__ */ React.createElement(Card, {
|
|
766
755
|
variant: "outlined",
|
|
@@ -775,11 +764,8 @@ const PreviewCatalogInfoComponent = ({
|
|
|
775
764
|
})));
|
|
776
765
|
};
|
|
777
766
|
|
|
778
|
-
const PreviewPullRequestComponent = ({
|
|
779
|
-
title,
|
|
780
|
-
description,
|
|
781
|
-
classes
|
|
782
|
-
}) => {
|
|
767
|
+
const PreviewPullRequestComponent = (props) => {
|
|
768
|
+
const { title, description, classes } = props;
|
|
783
769
|
return /* @__PURE__ */ React.createElement(Card, {
|
|
784
770
|
variant: "outlined",
|
|
785
771
|
className: classes == null ? void 0 : classes.card
|
|
@@ -816,13 +802,9 @@ function generateEntities(entities, componentName, owner) {
|
|
|
816
802
|
}
|
|
817
803
|
}));
|
|
818
804
|
}
|
|
819
|
-
const StepPrepareCreatePullRequest = ({
|
|
820
|
-
analyzeResult,
|
|
821
|
-
onPrepare,
|
|
822
|
-
onGoBack,
|
|
823
|
-
renderFormFields
|
|
824
|
-
}) => {
|
|
805
|
+
const StepPrepareCreatePullRequest = (props) => {
|
|
825
806
|
var _a, _b, _c, _d, _e, _f;
|
|
807
|
+
const { analyzeResult, onPrepare, onGoBack, renderFormFields } = props;
|
|
826
808
|
const classes = useStyles$1();
|
|
827
809
|
const catalogApi = useApi(catalogApiRef);
|
|
828
810
|
const catalogImportApi = useApi(catalogImportApiRef);
|
|
@@ -1251,11 +1233,12 @@ const useStyles = makeStyles(() => ({
|
|
|
1251
1233
|
padding: 0
|
|
1252
1234
|
}
|
|
1253
1235
|
}));
|
|
1254
|
-
const ImportStepper = ({
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1236
|
+
const ImportStepper = (props) => {
|
|
1237
|
+
const {
|
|
1238
|
+
initialUrl,
|
|
1239
|
+
generateStepper = defaultGenerateStepper,
|
|
1240
|
+
variant
|
|
1241
|
+
} = props;
|
|
1259
1242
|
const catalogImportApi = useApi(catalogImportApiRef);
|
|
1260
1243
|
const classes = useStyles();
|
|
1261
1244
|
const state = useImportState({ initialUrl });
|