diff --git a/.changeset/spicy-poets-sell.md b/.changeset/spicy-poets-sell.md new file mode 100644 index 0000000000..28ef965282 --- /dev/null +++ b/.changeset/spicy-poets-sell.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-jenkins': minor +--- + +Extend EntityJenkinsContent to recieve columns as prop diff --git a/plugins/jenkins/src/api/index.ts b/plugins/jenkins/src/api/index.ts index af1829c0b4..32c98ae5a6 100644 --- a/plugins/jenkins/src/api/index.ts +++ b/plugins/jenkins/src/api/index.ts @@ -16,4 +16,4 @@ export { JenkinsClient, jenkinsApiRef } from './JenkinsApi'; -export type { JenkinsApi } from './JenkinsApi'; +export type { JenkinsApi, Project } from './JenkinsApi'; diff --git a/plugins/jenkins/src/components/BuildsPage/lib/CITable/CITable.tsx b/plugins/jenkins/src/components/BuildsPage/lib/CITable/CITable.tsx index f82ce2e7ec..b0474b73da 100644 --- a/plugins/jenkins/src/components/BuildsPage/lib/CITable/CITable.tsx +++ b/plugins/jenkins/src/components/BuildsPage/lib/CITable/CITable.tsx @@ -239,6 +239,7 @@ type Props = { total: number; pageSize: number; onChangePageSize: (pageSize: number) => void; + columns: TableColumn[]; }; export const CITableView = ({ @@ -249,6 +250,7 @@ export const CITableView = ({ projects, onChangePage, onChangePageSize, + columns, total, }: Props) => { const projectsInPage = projects?.slice( @@ -279,17 +281,22 @@ export const CITableView = ({ Projects } - columns={generatedColumns} + columns={columns && columns.length !== 0 ? columns : generatedColumns} /> ); }; -export const CITable = () => { +type CITableProps = { + columns?: TableColumn[]; +}; + +export const CITable = ({ columns }: CITableProps) => { const [tableProps, { setPage, retry, setPageSize }] = useBuilds(); return ( Boolean(entity.metadata.annotations?.[JENKINS_ANNOTATION]) || Boolean(entity.metadata.annotations?.[LEGACY_JENKINS_ANNOTATION]); -export const Router = () => { +type Props = { + columns?: TableColumn[]; +}; + +export const Router = (props: Props) => { const { entity } = useEntity(); if (!isJenkinsAvailable(entity)) { return ; } + const columns = props.columns; + return ( - } /> + } /> } /> );