Skip to content

Commit

Permalink
UI: add an option to download zipped reports
Browse files Browse the repository at this point in the history
  • Loading branch information
manV committed Nov 7, 2024
1 parent e3c3972 commit 624dbc6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
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

0 comments on commit 624dbc6

Please sign in to comment.