mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
Fleet UI: Update software automation preview payload modal (#7607)
This commit is contained in:
parent
1c26e2555d
commit
13cb716674
1
changes/issue-7602-software-automations-payload-example
Normal file
1
changes/issue-7602-software-automations-payload-example
Normal file
@ -0,0 +1 @@
|
||||
* Fleet Free and Fleet Premium UI show different software automation payload example
|
@ -5,10 +5,16 @@ export default PropTypes.shape({
|
||||
details_link: PropTypes.string,
|
||||
});
|
||||
|
||||
export interface IVulnerability {
|
||||
cisa_known_exploit: string | null;
|
||||
cve: string;
|
||||
cvss_score: string | null;
|
||||
details_link: string;
|
||||
epss_probability: number | null;
|
||||
export interface IHostsAffected {
|
||||
id: number;
|
||||
hostname: string;
|
||||
url: string;
|
||||
}
|
||||
export interface IVulnerability {
|
||||
cisa_known_exploit?: boolean;
|
||||
cve: string;
|
||||
cvss_score?: number;
|
||||
details_link: string;
|
||||
epss_probability?: number;
|
||||
hosts_affected?: IHostsAffected[];
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
import React from "react";
|
||||
import React, { useContext } from "react";
|
||||
import { syntaxHighlight } from "utilities/helpers";
|
||||
|
||||
import { AppContext } from "context/app";
|
||||
import { IVulnerability } from "interfaces/vulnerability";
|
||||
import Modal from "components/Modal";
|
||||
import Button from "components/buttons/Button";
|
||||
import ExternalLinkIcon from "../../../../../../assets/images/icon-external-link-12x12@2x.png";
|
||||
@ -10,18 +12,24 @@ const baseClass = "preview-data-modal";
|
||||
interface IPreviewPayloadModalProps {
|
||||
onCancel: () => void;
|
||||
}
|
||||
interface IJsonPayload {
|
||||
timestamp: string;
|
||||
vulnerability: IVulnerability;
|
||||
}
|
||||
|
||||
const PreviewPayloadModal = ({
|
||||
onCancel,
|
||||
}: IPreviewPayloadModalProps): JSX.Element => {
|
||||
const json = {
|
||||
const { isFreeTier } = useContext(AppContext);
|
||||
|
||||
const json: IJsonPayload = {
|
||||
timestamp: "0000-00-00T00:00:00Z",
|
||||
vulnerability: {
|
||||
cve: "CVE-2014-9471",
|
||||
details_link: "https://nvd.nist.gov/vuln/detail/CVE-2014-9471",
|
||||
epss_probability: 0.7, // Premium feature only
|
||||
cvss_score: 5.7, // Premium feature only
|
||||
cisa_known_exploit: true, // Premium feature only
|
||||
epss_probability: 0.7,
|
||||
cvss_score: 5.7,
|
||||
cisa_known_exploit: true,
|
||||
hosts_affected: [
|
||||
{
|
||||
id: 1,
|
||||
@ -37,6 +45,13 @@ const PreviewPayloadModal = ({
|
||||
},
|
||||
};
|
||||
|
||||
if (isFreeTier) {
|
||||
// Premium only features
|
||||
delete json.vulnerability.epss_probability;
|
||||
delete json.vulnerability.cvss_score;
|
||||
delete json.vulnerability.cisa_known_exploit;
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal title={"Example payload"} onExit={onCancel} className={baseClass}>
|
||||
<div className={`${baseClass}__preview-modal`}>
|
||||
|
Loading…
Reference in New Issue
Block a user