revert(integration): remove annotation prefix props
Signed-off-by: Phil Kuang <pkuang@factset.com>
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
---
|
||||
'@backstage/integration': patch
|
||||
---
|
||||
|
||||
Expose an `annotationPrefix` property for SCM integrations
|
||||
@@ -9,7 +9,6 @@ import { Config } from '@backstage/config';
|
||||
// @public (undocumented)
|
||||
export class AzureIntegration implements ScmIntegration {
|
||||
constructor(integrationConfig: AzureIntegrationConfig);
|
||||
get annotationPrefix(): string;
|
||||
// (undocumented)
|
||||
get config(): AzureIntegrationConfig;
|
||||
// (undocumented)
|
||||
@@ -37,7 +36,6 @@ export type AzureIntegrationConfig = {
|
||||
// @public (undocumented)
|
||||
export class BitbucketIntegration implements ScmIntegration {
|
||||
constructor(integrationConfig: BitbucketIntegrationConfig);
|
||||
get annotationPrefix(): string;
|
||||
// (undocumented)
|
||||
get config(): BitbucketIntegrationConfig;
|
||||
// (undocumented)
|
||||
@@ -120,7 +118,6 @@ export class GithubCredentialsProvider {
|
||||
// @public (undocumented)
|
||||
export class GitHubIntegration implements ScmIntegration {
|
||||
constructor(integrationConfig: GitHubIntegrationConfig);
|
||||
get annotationPrefix(): string;
|
||||
// (undocumented)
|
||||
get config(): GitHubIntegrationConfig;
|
||||
// (undocumented)
|
||||
@@ -151,7 +148,6 @@ export type GitHubIntegrationConfig = {
|
||||
// @public (undocumented)
|
||||
export class GitLabIntegration implements ScmIntegration {
|
||||
constructor(integrationConfig: GitLabIntegrationConfig);
|
||||
get annotationPrefix(): string;
|
||||
// (undocumented)
|
||||
get config(): GitLabIntegrationConfig;
|
||||
// (undocumented)
|
||||
@@ -213,7 +209,6 @@ export function readGoogleGcsIntegrationConfig(config: Config): GoogleGcsIntegra
|
||||
|
||||
// @public
|
||||
export interface ScmIntegration {
|
||||
annotationPrefix: string;
|
||||
resolveEditUrl(url: string): string;
|
||||
resolveUrl(options: {
|
||||
url: string;
|
||||
|
||||
@@ -39,7 +39,6 @@ describe('AzureIntegration', () => {
|
||||
it('returns the basics', () => {
|
||||
const integration = new AzureIntegration({ host: 'h.com' } as any);
|
||||
expect(integration.type).toBe('azure');
|
||||
expect(integration.annotationPrefix).toBe('dev.azure.com');
|
||||
expect(integration.title).toBe('h.com');
|
||||
});
|
||||
|
||||
|
||||
@@ -36,13 +36,6 @@ export class AzureIntegration implements ScmIntegration {
|
||||
return 'azure';
|
||||
}
|
||||
|
||||
/**
|
||||
* The prefix used for entity metadata.annotations for the integration.
|
||||
*/
|
||||
get annotationPrefix(): string {
|
||||
return 'dev.azure.com';
|
||||
}
|
||||
|
||||
get title(): string {
|
||||
return this.integrationConfig.host;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ describe('BitbucketIntegration', () => {
|
||||
it('returns the basics', () => {
|
||||
const integration = new BitbucketIntegration({ host: 'h.com' } as any);
|
||||
expect(integration.type).toBe('bitbucket');
|
||||
expect(integration.annotationPrefix).toBe('bitbucket.org');
|
||||
expect(integration.title).toBe('h.com');
|
||||
});
|
||||
|
||||
|
||||
@@ -41,13 +41,6 @@ export class BitbucketIntegration implements ScmIntegration {
|
||||
return 'bitbucket';
|
||||
}
|
||||
|
||||
/**
|
||||
* The prefix used for entity metadata.annotations for the integration.
|
||||
*/
|
||||
get annotationPrefix(): string {
|
||||
return 'bitbucket.org';
|
||||
}
|
||||
|
||||
get title(): string {
|
||||
return this.integrationConfig.host;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ describe('GitHubIntegration', () => {
|
||||
token: 't',
|
||||
});
|
||||
expect(integration.type).toBe('github');
|
||||
expect(integration.annotationPrefix).toBe('github.com');
|
||||
expect(integration.title).toBe('h.com');
|
||||
expect(integration.config.host).toBe('h.com');
|
||||
});
|
||||
|
||||
@@ -38,13 +38,6 @@ export class GitHubIntegration implements ScmIntegration {
|
||||
return 'github';
|
||||
}
|
||||
|
||||
/**
|
||||
* The prefix used for entity metadata.annotations for the integration.
|
||||
*/
|
||||
get annotationPrefix(): string {
|
||||
return 'github.com';
|
||||
}
|
||||
|
||||
get title(): string {
|
||||
return this.integrationConfig.host;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ describe('GitLabIntegration', () => {
|
||||
it('returns the basics', () => {
|
||||
const integration = new GitLabIntegration({ host: 'h.com' } as any);
|
||||
expect(integration.type).toBe('gitlab');
|
||||
expect(integration.annotationPrefix).toBe('gitlab.com');
|
||||
expect(integration.title).toBe('h.com');
|
||||
});
|
||||
|
||||
|
||||
@@ -38,13 +38,6 @@ export class GitLabIntegration implements ScmIntegration {
|
||||
return 'gitlab';
|
||||
}
|
||||
|
||||
/**
|
||||
* The prefix used for entity metadata.annotations for the integration.
|
||||
*/
|
||||
get annotationPrefix(): string {
|
||||
return 'gitlab.com';
|
||||
}
|
||||
|
||||
get title(): string {
|
||||
return this.integrationConfig.host;
|
||||
}
|
||||
|
||||
@@ -29,11 +29,6 @@ export interface ScmIntegration {
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* The prefix used for entity metadata.annotations for the integration , e.g. "github.com".
|
||||
*/
|
||||
annotationPrefix: string;
|
||||
|
||||
/**
|
||||
* A human readable title for the integration, that can be shown to users to
|
||||
* differentiate between different integrations.
|
||||
|
||||
@@ -46,9 +46,27 @@ export class RepoLocationAnalyzer implements LocationAnalyzer {
|
||||
};
|
||||
|
||||
const integration = this.scmIntegrations.byUrl(request.location.target);
|
||||
if (integration) {
|
||||
let annotationPrefix;
|
||||
switch (integration?.type) {
|
||||
case 'azure':
|
||||
annotationPrefix = 'dev.azure.com';
|
||||
break;
|
||||
case 'bitbucket':
|
||||
annotationPrefix = 'bitbucket.org';
|
||||
break;
|
||||
case 'github':
|
||||
annotationPrefix = 'github.com';
|
||||
break;
|
||||
case 'gitlab':
|
||||
annotationPrefix = 'gitlab.com';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (annotationPrefix) {
|
||||
entity.metadata.annotations = {
|
||||
[`${integration.annotationPrefix}/project-slug`]: `${owner}/${name}`,
|
||||
[`${annotationPrefix}/project-slug`]: `${owner}/${name}`,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user