Skip to content

Commit

Permalink
Jira Dashboard - Props propagation for JiraUserIssuesViewCard (#248)
Browse files Browse the repository at this point in the history
* Issue 239 - customization of JiraUserIssuesCard via propogation of properties to JiraUserIssuesTable

* changeset generation

---------

Co-authored-by: Backstage <devops@evgo.com>
  • Loading branch information
Ethan-99 and evgo-renovate authored Jan 17, 2025
1 parent ae01dea commit 66bac1a
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/angry-hounds-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@axis-backstage/plugin-jira-dashboard': patch
---

Added tableOptions and tableStyle props to JiraUserIssuesCard for customization ability
30 changes: 30 additions & 0 deletions plugins/jira-dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,36 @@ import { JiraUserIssuesViewCard } from '@axis-backstage/plugin-jira-dashboard';
// ...
```

Optionally, you can provide the `maxResults`, `tableOptions`, and `tableStyle` properties to the JiraUserIssuesViewCard for further customization. Example:

```tsx
import { JiraUserIssuesViewCard } from '@axis-backstage/plugin-jira-dashboard';
// ...

<Grid item xs={12} md={6}>
<JiraUserIssuesViewCard
bottomLinkProps={{
link: 'https://our-jira-server/issues',
title: 'Open in Jira',
}}
maxResults={30} // default is 15
tableOptions={{
toolbar: true, // default is false
search: true, // default is false
paging: true, // default is true
pageSize: 15, // default is 10
}}
tableStyle={{
padding: '5px', // default is 0px
overflowY: 'auto', // default is auto
width: '95%', // default is 100%
}}
/>
</Grid>;

// ...
```

Note that the list of user issues is limited by permissions defined for the [JIRA_TOKEN](https://github.com/AxisCommunications/backstage-plugins/blob/main/plugins/jira-dashboard-backend/README.md#configuration-details) used by backend.
The username is being extracted from the user's email or created as a combination of user entity `metadata.name` and [JIRA_EMAIL_SUFFIX](https://github.com/AxisCommunications/backstage-plugins/blob/main/plugins/jira-dashboard-backend/README.md#configuration-details) ([see function `getAssigneUser`](/plugins/jira-dashboard-backend/src/filters.ts) for more information).

Expand Down
4 changes: 4 additions & 0 deletions plugins/jira-dashboard/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export type JiraUserIssuesCardProps = {
title?: string;
maxResults?: number;
bottomLinkProps?: BottomLinkProps;
tableOptions?: TableOptions<Issue>;
tableStyle?: TableComponentProps['style'];
};

// @public
Expand All @@ -93,6 +95,8 @@ export const JiraUserIssuesViewCard: ({
title,
maxResults,
bottomLinkProps,
tableOptions,
tableStyle,
}: JiraUserIssuesCardProps) => JSX_2.Element;

// @public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import React from 'react';

import { BottomLinkProps, InfoCard } from '@backstage/core-components';
import {
BottomLinkProps,
InfoCard,
TableOptions,
} from '@backstage/core-components';

import { JiraUserIssuesTable } from '../JiraUserIssuesTable';
import {
JiraUserIssuesTable,
TableComponentProps,
} from '../JiraUserIssuesTable';

import { Issue } from '@axis-backstage/plugin-jira-dashboard-common';

/**
* Jira user issues list card properties
Expand All @@ -11,6 +20,8 @@ export type JiraUserIssuesCardProps = {
title?: string;
maxResults?: number;
bottomLinkProps?: BottomLinkProps;
tableOptions?: TableOptions<Issue>;
tableStyle?: TableComponentProps['style'];
};

/**
Expand All @@ -20,17 +31,24 @@ export const JiraUserIssuesCard = ({
title,
maxResults,
bottomLinkProps,
tableOptions = {
toolbar: false,
search: false,
paging: true,
pageSize: 10,
},
tableStyle = {
padding: '0px',
overflowY: 'auto',
width: '100%',
},
}: JiraUserIssuesCardProps) => {
return (
<InfoCard title={title} variant="fullHeight" deepLink={bottomLinkProps}>
<JiraUserIssuesTable
maxResults={maxResults}
tableOptions={{
toolbar: false,
search: false,
paging: true,
pageSize: 10,
}}
tableOptions={tableOptions}
tableStyle={tableStyle}
/>
</InfoCard>
);
Expand Down

0 comments on commit 66bac1a

Please sign in to comment.