Teach SonarQube isPluginApplicableToEntity.
Signed-off-by: Jeff Cook <jeff.cook@endurance.com>
This commit is contained in:
@@ -15,3 +15,4 @@
|
||||
*/
|
||||
|
||||
export * from './SonarQubeCard';
|
||||
export { isSonarQubeAvailable as isPluginApplicableToEntity } 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