Skip to content

Commit

Permalink
🐛 FIx broken analysis report download
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 committed Sep 27, 2023
1 parent d3f416e commit 6633a60
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ export const ApplicationDetailDrawerAnalysis: React.FC<
<DownloadButton
id={application.id}
mimeType={MimeType.TAR}
>
TAR
</DownloadButton>
/>
</Tooltip>
{" | "}
<Tooltip
Expand All @@ -153,9 +151,7 @@ export const ApplicationDetailDrawerAnalysis: React.FC<
<DownloadButton
id={application.id}
mimeType={MimeType.YAML}
>
YAML
</DownloadButton>
/>
</Tooltip>
</DescriptionListDescription>
</DescriptionListGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import React from "react";
import { Alert, Button } from "@patternfly/react-core";
import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing";
import { Application } from "@app/api/models";
import { Spinner } from "@patternfly/react-core";
import { useDownloadStaticReport } from "@app/queries/download";
import { useDownloadStaticReport } from "@app/queries/applications";

export enum MimeType {
TAR = "tar",
YAML = "yaml",
}
function DownloadButton({
application,
mimeType,
}: {
application: Application;
interface IDownloadButtonProps {
id: number;
mimeType: MimeType;
}) {
}
export const DownloadButton: React.FC<IDownloadButtonProps> = ({
id,
mimeType,
}) => {
const {
mutate: downloadFile,
isLoading,
Expand All @@ -24,7 +24,7 @@ function DownloadButton({

const handleDownload = () => {
downloadFile({
applicationId: application.id,
applicationId: id,
mimeType: mimeType,
});
};
Expand All @@ -51,6 +51,6 @@ function DownloadButton({
)}
</>
);
}
};

export default DownloadButton;
4 changes: 3 additions & 1 deletion client/src/app/queries/applications.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { AxiosError } from "axios";
import axios, { AxiosError } from "axios";

import { MimeType } from "@app/api/models";
import {
APPLICATIONS,
createApplication,
deleteApplication,
deleteBulkApplications,
Expand All @@ -13,6 +14,7 @@ import {
} from "@app/api/rest";
import { reviewsQueryKey } from "./reviews";
import { assessmentsQueryKey } from "./assessments";
import saveAs from "file-saver";

export const ApplicationDependencyQueryKey = "applicationdependencies";
export const ApplicationsQueryKey = "applications";
Expand Down

0 comments on commit 6633a60

Please sign in to comment.