Skip to content

Commit

Permalink
Add styling
Browse files Browse the repository at this point in the history
Signed-off-by: ibolton336 <ibolton@redhat.com>
  • Loading branch information
ibolton336 committed Aug 24, 2023
1 parent 550a73e commit 12027e0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import {
Title,
Tooltip,
Button,
Divider,
TextList,
TextListItem,
TextListVariants,
TextListItemVariants,
} from "@patternfly/react-core";
import {
CheckCircleIcon,
Expand All @@ -26,7 +31,7 @@ import { SimpleDocumentViewerModal } from "@app/components/SimpleDocumentViewer"
import { APPLICATIONS, getTaskById } from "@app/api/rest";
import { COLOR_HEX_VALUES_BY_NAME } from "@app/Constants";
import { Link } from "react-router-dom";
import DownloadButton from "./components/download-button";
import DownloadButton, { MimeType } from "./components/download-button";

export interface IApplicationDetailDrawerAnalysisProps
extends Pick<
Expand Down Expand Up @@ -120,21 +125,36 @@ export const ApplicationDetailDrawerAnalysis: React.FC<
Analysis details
</Button>
</Tooltip>
<Text component="small">
<Tooltip
content="Click to download Analysis report"
position="top"
<Divider className={spacing.mtMd}></Divider>
<TextList component={TextListVariants.dl}>
<TextListItem
component={TextListItemVariants.dt}
className={spacing.pXs}
>
<DownloadButton application={application} mimeType="tar" />
</Tooltip>
{" | "}
<Tooltip
content="Click to download Analysis report"
position="top"
>
<DownloadButton application={application} mimeType="yaml" />
</Tooltip>
</Text>
Download
</TextListItem>
<TextListItem component={TextListItemVariants.dd}>
<Tooltip
content="Click to download Analysis report"
position="top"
>
<DownloadButton
application={application}
mimeType={MimeType.TAR}
/>
</Tooltip>
{" | "}
<Tooltip
content="Click to download Analysis report"
position="top"
>
<DownloadButton
application={application}
mimeType={MimeType.YAML}
/>
</Tooltip>
</TextListItem>
</TextList>
</>
) : task?.state === "Failed" ? (
task ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@ import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing";
import { Application } from "@app/api/models";
import { Spinner } from "@patternfly/react-core";

export enum MimeType {
TAR = "tar",
YAML = "yaml",
}
function DownloadButton({
application,
mimeType,
}: {
application: Application;
mimeType: string;
mimeType: MimeType;
}) {
const [isLoading, setIsLoading] = useState(false);

const handleDownload = async () => {
let acceptHeader = "application/x-tar";

switch (mimeType) {
case "yaml":
case MimeType.YAML:
acceptHeader = "application/x-yaml";
break;
case "tar":
case MimeType.TAR:
default:
acceptHeader = "application/x-tar";
}
Expand Down Expand Up @@ -70,7 +74,7 @@ function DownloadButton({
variant="link"
className={spacing.pXs}
>
{`Download ${mimeType.toUpperCase()}`}
{mimeType === MimeType.YAML ? "YAML" : "Report"}
</Button>
)}
</>
Expand Down

0 comments on commit 12027e0

Please sign in to comment.