Update the wording for unknown URLs in the import flow
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-import': patch
|
||||
---
|
||||
|
||||
Update the wording for unknown URLs in the import flow
|
||||
@@ -167,7 +167,11 @@ describe('CatalogImportClient', () => {
|
||||
catalogImportClient.analyzeUrl(
|
||||
'https://github.com/backstage/backstage',
|
||||
),
|
||||
).rejects.toThrow(new Error('Invalid url'));
|
||||
).rejects.toThrow(
|
||||
new Error(
|
||||
'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 catalog-info.yaml file instead.',
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
it('should find locations from github', async () => {
|
||||
|
||||
@@ -73,32 +73,33 @@ export class CatalogImportClient implements CatalogImportApi {
|
||||
}
|
||||
|
||||
const ghConfig = getGithubIntegrationConfig(this.configApi, url);
|
||||
if (!ghConfig) {
|
||||
throw new Error(
|
||||
'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 catalog-info.yaml file instead.',
|
||||
);
|
||||
}
|
||||
|
||||
if (ghConfig) {
|
||||
// TODO: this could be part of the analyze-location endpoint
|
||||
const locations = await this.checkGitHubForExistingCatalogInfo({
|
||||
...ghConfig,
|
||||
url,
|
||||
});
|
||||
|
||||
if (locations.length > 0) {
|
||||
return {
|
||||
type: 'locations',
|
||||
locations,
|
||||
};
|
||||
}
|
||||
// TODO: this could be part of the analyze-location endpoint
|
||||
const locations = await this.checkGitHubForExistingCatalogInfo({
|
||||
...ghConfig,
|
||||
url,
|
||||
});
|
||||
|
||||
if (locations.length > 0) {
|
||||
return {
|
||||
type: 'repository',
|
||||
integrationType: 'github',
|
||||
url: url,
|
||||
generatedEntities: await this.generateEntityDefinitions({
|
||||
repo: url,
|
||||
}),
|
||||
type: 'locations',
|
||||
locations,
|
||||
};
|
||||
}
|
||||
|
||||
throw new Error('Invalid url');
|
||||
return {
|
||||
type: 'repository',
|
||||
integrationType: 'github',
|
||||
url: url,
|
||||
generatedEntities: await this.generateEntityDefinitions({
|
||||
repo: url,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
async submitPullRequest({
|
||||
|
||||
Reference in New Issue
Block a user