Skip to content

Commit

Permalink
Add default jira query entity matcher (#1686)
Browse files Browse the repository at this point in the history
  • Loading branch information
iain-b authored Oct 18, 2024
1 parent 34dc0e9 commit 184aedc
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/stale-grapes-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@roadiehq/backstage-plugin-jira': minor
---

Export entity matcher for query card
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { JiraQueryCard } from '../JiraQueryCard';
import { useTemplateParser } from '../../hooks/useTemplateParser';
import { Entity } from '@backstage/catalog-model';
import {
DEFAULT_JIRA_QUERY_ANNOTATION,
JIRA_COMPONENT_ANNOTATION,
JIRA_LABEL_ANNOTATION,
JIRA_PROJECT_KEY_ANNOTATION,
Expand Down Expand Up @@ -40,7 +41,7 @@ const buildTemplateParserEntityContext = (entity: Entity) => {
};

export const EntityJiraQueryCard = ({
jqlQueryFromAnnotation = 'jira/all-issues-jql',
jqlQueryFromAnnotation = DEFAULT_JIRA_QUERY_ANNOTATION,
jqlQuery,
maxResults,
hideOnMissingAnnotation = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
*/

import { Entity } from '@backstage/catalog-model';
import { JIRA_PROJECT_KEY_ANNOTATION } from '../constants';
import {
JIRA_PROJECT_KEY_ANNOTATION,
DEFAULT_JIRA_QUERY_ANNOTATION,
} from '../constants';

export const isJiraAvailable = (entity: Entity) =>
Boolean(entity?.metadata.annotations?.[JIRA_PROJECT_KEY_ANNOTATION]);

export const hasJiraQuery = (entity: Entity) =>
Boolean(entity?.metadata.annotations?.[DEFAULT_JIRA_QUERY_ANNOTATION]);
1 change: 1 addition & 0 deletions plugins/frontend/backstage-plugin-jira/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export const JIRA_BEARER_TOKEN_ANNOTATION = 'jira/token-type';
export const JIRA_PROJECT_KEY_ANNOTATION = 'jira/project-key';
export const JIRA_LABEL_ANNOTATION = 'jira/label';
export const JIRA_TEAM_ANNOTATION = 'jira/team';
export const DEFAULT_JIRA_QUERY_ANNOTATION = 'jira/all-issues-jql';
1 change: 1 addition & 0 deletions plugins/frontend/backstage-plugin-jira/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ export {
*/
isJiraAvailable as isPluginApplicableToEntity,
isJiraAvailable,
hasJiraQuery,
} from './components/Router';

0 comments on commit 184aedc

Please sign in to comment.