fix: update query params

Signed-off-by: Sam Robson <srobson@gocardless.com>
This commit is contained in:
Sam Robson
2021-05-26 15:43:25 +01:00
parent 79ce75ed46
commit e9702d811f
2 changed files with 20 additions and 7 deletions
+2 -1
View File
@@ -81,7 +81,8 @@ type QueryParams = {
host: string | undefined;
owner: string;
repo: string;
last: number;
lastDeployments: number;
lastStatuses: number;
};
export interface GithubDeploymentsApi {
@@ -35,12 +35,14 @@ import {
const GithubDeploymentsComponent = ({
projectSlug,
last,
lastDeployments,
lastStatuses,
columns,
host,
}: {
projectSlug: string;
last: number;
lastDeployments: number;
lastStatuses: number;
columns: TableColumn<GithubDeployment>[];
host: string | undefined;
}) => {
@@ -48,7 +50,14 @@ const GithubDeploymentsComponent = ({
const [owner, repo] = projectSlug.split('/');
const { loading, value, error, retry: reload } = useAsyncRetry(
async () => await api.listDeployments({ host, owner, repo, last }),
async () =>
await api.listDeployments({
host,
owner,
repo,
lastStatuses,
lastDeployments,
}),
);
if (error) {
@@ -66,10 +75,12 @@ const GithubDeploymentsComponent = ({
};
export const GithubDeploymentsCard = ({
last,
lastDeployments,
lastStatuses,
columns,
}: {
last?: number;
lastDeployments?: number;
lastStatuses?: number;
columns?: TableColumn<GithubDeployment>[];
}) => {
const { entity } = useEntity();
@@ -85,7 +96,8 @@ export const GithubDeploymentsCard = ({
projectSlug={
entity?.metadata.annotations?.[GITHUB_PROJECT_SLUG_ANNOTATION] || ''
}
last={last || 10}
lastDeployments={lastDeployments || 10}
lastStatuses={lastStatuses || 5}
host={host}
columns={columns || GithubDeploymentsTable.defaultDeploymentColumns}
/>