Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: add an option for zipped report download #2366

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion deepfence_frontend/apps/dashboard/api-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -14650,7 +14650,8 @@
"from_timestamp": { "type": "integer" },
"options": { "$ref": "#/components/schemas/UtilsReportOptions" },
"report_type": { "enum": ["pdf", "xlsx", "sbom"], "type": "string" },
"to_timestamp": { "type": "integer" }
"to_timestamp": { "type": "integer" },
"zipped_report": { "type": "boolean" }
}
},
"ModelGenerateReportResp": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ export interface ModelGenerateReportReq {
* @memberof ModelGenerateReportReq
*/
to_timestamp?: number;
/**
*
* @type {boolean}
* @memberof ModelGenerateReportReq
*/
zipped_report?: boolean;
}


Expand Down Expand Up @@ -101,6 +107,7 @@ export function ModelGenerateReportReqFromJSONTyped(json: any, ignoreDiscriminat
'options': !exists(json, 'options') ? undefined : UtilsReportOptionsFromJSON(json['options']),
'report_type': json['report_type'],
'to_timestamp': !exists(json, 'to_timestamp') ? undefined : json['to_timestamp'],
'zipped_report': !exists(json, 'zipped_report') ? undefined : json['zipped_report'],
};
}

Expand All @@ -118,6 +125,7 @@ export function ModelGenerateReportReqToJSON(value?: ModelGenerateReportReq | nu
'options': UtilsReportOptionsToJSON(value.options),
'report_type': value.report_type,
'to_timestamp': value.to_timestamp,
'zipped_report': value.zipped_report,
};
}

Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ const action = async ({ request }: ActionFunctionArgs): Promise<ActionData> => {
severity_or_check_type:
severitiesOrCheckTypes as UtilsReportFiltersSeverityOrCheckTypeEnum,
},

zipped_report: body.downloadZip === 'on',
report_type: _reportType,
},
});
Expand Down Expand Up @@ -191,6 +191,7 @@ const ReportForm = () => {
const [provider, setProvider] = useState('');
const [downloadType, setDownloadType] = useState('');
const [deadNodes, setIncludeDeadNodes] = useState(false);
const [downloadZip, setDownloadZip] = useState(false);

const { navigate } = usePageNavigation();

Expand Down Expand Up @@ -308,7 +309,7 @@ const ReportForm = () => {
})}
</Listbox>

<div className="col-span-2 my-5">
<div className="col-span-2">
<Checkbox
label="Include Dead Nodes"
key="deadNodes"
Expand All @@ -319,6 +320,17 @@ const ReportForm = () => {
}}
/>
</div>

<div className="col-span-2">
<Checkbox
label="Download a zipped archive of reports with a separate file per node/account?"
name="downloadZip"
checked={downloadZip}
onCheckedChange={(checked: boolean) => {
setDownloadZip(checked);
}}
/>
</div>
</div>

<AdvancedFilter
Expand Down
Loading