Skip to content

Commit

Permalink
Add export ZIP (#905)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosthe19916 committed Apr 4, 2023
1 parent b4155c6 commit 79cdc17
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ui-pf4/src/main/webapp/src/Constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const WINDUP_ENV_VARIABLES: WindupEnv = (window as any)[
];

export const MERGED_CSV_FILENAME = "AllIssues.csv";
export const ZIP_REPORT_FILENAME = "reports.zip";

export const getWindupRestBase = () => {
let base = packageJson.proxy + API_BASE_URL; // Development
Expand Down Expand Up @@ -62,6 +63,7 @@ export enum AdvancedOptionsFieldKey {

// Switch
EXPORT_CSV = "exportCSV",
EXPORT_ZIP_REPORT = "exportZipReport",
TATTLETALE = "disableTattletale",
CLASS_NOT_FOUND_ANALYSIS = "enableClassNotFoundAnalysis",
COMPATIBLE_FILES_REPORT = "enableCompatibleFilesReport",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ interface FormValues {
[AdvancedOptionsFieldKey.IGNORE_PATH]?: string;

[AdvancedOptionsFieldKey.EXPORT_CSV]?: boolean;
[AdvancedOptionsFieldKey.EXPORT_ZIP_REPORT]?: boolean;
[AdvancedOptionsFieldKey.TATTLETALE]?: boolean;
[AdvancedOptionsFieldKey.CLASS_NOT_FOUND_ANALYSIS]?: boolean;
[AdvancedOptionsFieldKey.COMPATIBLE_FILES_REPORT]?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ export const Fields: Map<AdvancedOptionsFieldKey, IFieldInfo> = new Map([
type: "switch",
},
],
[
AdvancedOptionsFieldKey.EXPORT_ZIP_REPORT,
{
label: "Export ZIP report",
type: "switch",
},
],
[
AdvancedOptionsFieldKey.TATTLETALE,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ import {
List,
ListItem,
} from "@patternfly/react-core";
import { ChartBarIcon, DownloadIcon } from "@patternfly/react-icons";
import {
ChartBarIcon,
DownloadIcon,
FileArchiveIcon,
} from "@patternfly/react-icons";

import {
AdvancedOptionsFieldKey,
getWindupStaticReportsBase,
MERGED_CSV_FILENAME,
ZIP_REPORT_FILENAME,
} from "Constants";
import {
ExecutionStatusWithTime,
Expand Down Expand Up @@ -162,6 +167,23 @@ export const Overview: React.FC<OverviewProps> = ({ match }) => {
</a>
</StackItem>
)}
{isOptionEnabledInExecution(
execution,
AdvancedOptionsFieldKey.EXPORT_ZIP_REPORT
) && (
<StackItem>
<a
title="Download ZIP report"
target="_blank"
rel="noopener noreferrer"
href={`${getWindupStaticReportsBase()}/${
execution.id
}/${ZIP_REPORT_FILENAME}`}
>
<FileArchiveIcon /> ZIP report
</a>
</StackItem>
)}
</Stack>
) : (
"Not available"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
DownloadIcon,
CubesIcon,
TrashIcon,
FileArchiveIcon,
} from "@patternfly/react-icons";

import { RootState } from "store/rootReducer";
Expand Down Expand Up @@ -62,6 +63,7 @@ import {
AdvancedOptionsFieldKey,
getWindupStaticReportsBase,
MERGED_CSV_FILENAME,
ZIP_REPORT_FILENAME,
} from "Constants";
import { isNullOrUndefined } from "utils/utils";
import {
Expand Down Expand Up @@ -131,6 +133,12 @@ const getCSVReportURL = (execution: WindupExecution) => {
}/${MERGED_CSV_FILENAME}`;
};

const getZIPReportURL = (execution: WindupExecution) => {
return `${getWindupStaticReportsBase()}/${
execution.id
}/${ZIP_REPORT_FILENAME}`;
};

interface ExecutionListProps extends RouteComponentProps<ProjectRoute> {}

export const ExecutionList: React.FC<ExecutionListProps> = ({ match }) => {
Expand Down Expand Up @@ -372,6 +380,22 @@ export const ExecutionList: React.FC<ExecutionListProps> = ({ match }) => {
</a>
</FlexItem>
)}
{isOptionEnabledInExecution(
item,
AdvancedOptionsFieldKey.EXPORT_ZIP_REPORT
) && (
<FlexItem>
<a
title="Download ZIP repot"
target="_blank"
rel="noopener noreferrer"
href={`${getZIPReportURL(item)}`}
className="pf-c-button pf-m-link"
>
<FileArchiveIcon />
</a>
</FlexItem>
)}
</>
)}
{!isExecutionActive(item) && (
Expand Down

0 comments on commit 79cdc17

Please sign in to comment.