@roadiehq/backstage-plugin-jira
Version:
204 lines (193 loc) • 6.62 kB
TypeScript
import * as _backstage_plugin_home_react from '@backstage/plugin-home-react';
import * as react_jsx_runtime from 'react/jsx-runtime';
import { Entity } from '@backstage/catalog-model';
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
import { DiscoveryApi, ConfigApi, FetchApi, ErrorApi } from '@backstage/core-plugin-api';
type EntityProps = {
/** @deprecated The entity is now grabbed from context instead */
entity?: Entity;
};
type IssuesCounter = {
total: number;
name: string;
iconUrl: string;
};
type Ticket = {
key: string;
id?: string;
self: string;
fields?: {
issuetype: {
iconUrl: string;
name: string;
};
parent?: {
key: string;
};
summary: string;
assignee: {
displayName: string;
avatarUrls: {
[key: string]: string;
};
};
status: {
iconUrl: string;
name: string;
};
updated: string;
created: string;
priority: {
iconUrl: string;
name: string;
};
project?: {
name: string;
self: string;
key: string;
};
};
};
type PullRequest = {
id: string;
name: string;
url: string;
status: string;
lastUpdate: string;
author?: {
name: string;
avatar?: string;
};
};
type TicketSummary = {
key: string;
id?: string;
parent?: string;
summary?: string;
assignee?: {
displayName?: string;
avatarUrl?: string;
};
status?: {
iconUrl: string;
name: string;
};
issuetype?: {
iconUrl: string;
name: string;
};
priority?: {
iconUrl: string;
name: string;
};
created?: string;
updated?: string;
lastComment?: string;
assignedDate?: string;
assignedRelativeTime?: string;
linkedPullRequests?: PullRequest[];
};
type UserSummary = {
name: string;
avatarUrl: string;
url: string;
};
type IssuesTableProps = {
title?: string;
subtitle?: string;
issues: Ticket[];
columnIds?: ('key' | 'type' | 'type-icon' | 'status' | 'assignee' | 'assignee-icon' | 'summary' | 'priority' | 'created' | 'updated' | 'project')[];
};
declare const IssuesTable: ({ issues, title, subtitle, columnIds, }: IssuesTableProps) => react_jsx_runtime.JSX.Element;
type EntityJiraQueryCardProps = {
jqlQueryFromAnnotation?: string;
jqlQuery?: string;
maxResults?: number;
hideOnMissingAnnotation?: boolean;
} & Omit<IssuesTableProps, 'issues'>;
declare const jiraPlugin: _backstage_core_plugin_api.BackstagePlugin<{}, {}, {}>;
declare const EntityJiraOverviewCard: (props: EntityProps & {
hideIssueFilter?: boolean;
}) => react_jsx_runtime.JSX.Element;
declare const EntityJiraActivityStreamCard: () => react_jsx_runtime.JSX.Element;
declare const EntityJiraQueryCard: ({ jqlQueryFromAnnotation, jqlQuery, maxResults, hideOnMissingAnnotation, ...tableProps }: EntityJiraQueryCardProps) => react_jsx_runtime.JSX.Element | null;
declare const HomePageMyJiraTicketsCard: (props: _backstage_plugin_home_react.CardExtensionProps<{
userId: string;
}>) => react_jsx_runtime.JSX.Element;
type JiraCardOptionalProps = {
hideIssueFilter?: boolean;
};
declare const JiraOverviewCard: (props: EntityProps & JiraCardOptionalProps) => react_jsx_runtime.JSX.Element;
type JiraQueryCardProps = {
jqlQuery: string;
maxResults?: number;
hideOnMissingAnnotation?: boolean;
} & Omit<IssuesTableProps, 'issues'>;
declare const JiraQueryCard: ({ jqlQuery, maxResults, hideOnMissingAnnotation, ...tableProps }: JiraQueryCardProps) => react_jsx_runtime.JSX.Element;
declare const ActivityStream: ({ projectKey, tokenType, componentName, ticketIds, label, }: {
projectKey: string;
tokenType: string | undefined;
componentName: string | undefined;
ticketIds: string[] | undefined;
label: string | undefined;
}) => react_jsx_runtime.JSX.Element | null;
declare const isJiraAvailable: (entity: Entity) => boolean;
declare const hasJiraQuery: (entity: Entity) => boolean;
declare const jiraApiRef: _backstage_core_plugin_api.ApiRef<JiraAPI>;
type Options = {
discoveryApi: DiscoveryApi;
configApi: ConfigApi;
fetchApi: FetchApi;
errorApi?: ErrorApi;
};
declare class JiraAPI {
private readonly discoveryApi;
private readonly proxyPath;
private readonly apiVersion;
private readonly strategy;
private readonly confluenceActivityFilter;
private readonly fetchApi;
private readonly errorApi?;
constructor(options: Options);
private logError;
private getDomainFromApiUrl;
private generateProjectUrl;
private getUrls;
private convertToString;
private getIssuesPaged;
getProjectDetails(projectKey: string, component: string, label: string, statusesNames: Array<string>): Promise<{
project: {
name: string;
iconUrl: string;
type: string;
url: string;
};
issues: IssuesCounter[];
ticketIds: string[];
tickets: {
key: string;
summary: string | undefined;
assignee: {
displayName: string | undefined;
avatarUrl: string | undefined;
};
status: string | undefined;
priority: {
iconUrl: string;
name: string;
} | undefined;
created: string | undefined;
updated: string | undefined;
}[];
}>;
getActivityStream(size: number, projectKey: string, componentName: string | undefined, ticketIds: string[] | undefined, label: string | undefined, isBearerAuth: boolean): Promise<string>;
getStatuses(projectKey: string): Promise<string[]>;
getIssueDetails(issueKey: string): Promise<any>;
getLinkedPullRequests(issueId: string): Promise<any>;
getUserDetails(userId: string, fetchLinkedPRs: boolean): Promise<{
user: UserSummary;
tickets: TicketSummary[];
}>;
jqlQuery(query: string, maxResults?: number): Promise<Ticket[]>;
}
export { ActivityStream, EntityJiraActivityStreamCard, EntityJiraOverviewCard, EntityJiraQueryCard, HomePageMyJiraTicketsCard, IssuesTable, type IssuesTableProps, JiraAPI, JiraOverviewCard, JiraQueryCard, type JiraQueryCardProps, hasJiraQuery, isJiraAvailable, isJiraAvailable as isPluginApplicableToEntity, jiraApiRef, jiraPlugin, jiraPlugin as plugin };