Merge pull request #5245 from sjuxax/sonarqube-ispluginavail
Teach SonarQube `isPluginApplicableToEntity`.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-sonarqube': patch
|
||||
---
|
||||
|
||||
Export isSonarQubeAvailable.
|
||||
@@ -15,3 +15,4 @@
|
||||
*/
|
||||
|
||||
export * from './SonarQubeCard';
|
||||
export { isSonarQubeAvailable } from './useProjectKey';
|
||||
|
||||
@@ -18,6 +18,9 @@ import { Entity } from '@backstage/catalog-model';
|
||||
|
||||
export const SONARQUBE_PROJECT_KEY_ANNOTATION = 'sonarqube.org/project-key';
|
||||
|
||||
export const isSonarQubeAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[SONARQUBE_PROJECT_KEY_ANNOTATION]);
|
||||
|
||||
export const useProjectKey = (entity: Entity) => {
|
||||
return entity?.metadata.annotations?.[SONARQUBE_PROJECT_KEY_ANNOTATION] ?? '';
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user