Skip to content

Commit

Permalink
Update analysis details style and tooltip
Browse files Browse the repository at this point in the history
Add styling

Signed-off-by: ibolton336 <ibolton@redhat.com>
  • Loading branch information
ibolton336 committed Aug 24, 2023
1 parent b992f78 commit 86b3404
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 21 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 @@ -102,7 +107,7 @@ export const ApplicationDetailDrawerAnalysis: React.FC<
</Title>
{task?.state === "Succeeded" && application ? (
<>
<Tooltip content="View Report">
<Tooltip content="View the analysis task details">
<Button
icon={
<span className={spacing.mrXs}>
Expand All @@ -114,25 +119,42 @@ export const ApplicationDetailDrawerAnalysis: React.FC<
type="button"
variant="link"
onClick={() => setAppAnalysisToView(application.id)}
className={spacing.ml_0}
style={{ margin: "0", padding: "0" }}
>
View analysis
Analysis details
</Button>
</Tooltip>
<Text component="small">
<Tooltip
content="Click to download Analysis report"
position="top"
>
<DownloadButton application={application} mimeType="tar" />
</Tooltip>
{" | "}
<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="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 86b3404

Please sign in to comment.