Added file category listing with new app options to work with detections in the future
This commit is contained in:
@@ -123,6 +123,7 @@ const openApiFieldDesc = "Generated by OpenAPI body example";
|
||||
const ParsedAction = (props) => {
|
||||
const {
|
||||
workflow,
|
||||
files,
|
||||
setWorkflow,
|
||||
setAction,
|
||||
setSelectedAction,
|
||||
@@ -1300,6 +1301,7 @@ const ParsedAction = (props) => {
|
||||
data.value = data.example;
|
||||
}
|
||||
|
||||
|
||||
if (data.value.length === 0) {
|
||||
if (data.name.toLowerCase() === "headers") {
|
||||
console.log("Should show headers field instead with + and -!")
|
||||
@@ -1878,6 +1880,14 @@ const ParsedAction = (props) => {
|
||||
|
||||
// Basic helpertext
|
||||
|
||||
if (data.name.toLowerCase() === "file_category") {
|
||||
//selectedActionParameters[count].options.length > 0
|
||||
console.log("FileS: ", files)
|
||||
if (files.namespaces !== undefined && files.namespaces !== null && files.namespaces.length > 0) {
|
||||
data.options = files.namespaces
|
||||
}
|
||||
}
|
||||
|
||||
//const keywords = ["len", "lower", "upper", "trim", "split", "length", "number", "parse", "join"]
|
||||
if (
|
||||
selectedActionParameters[count].schema !== undefined &&
|
||||
@@ -1942,16 +1952,22 @@ const ParsedAction = (props) => {
|
||||
}
|
||||
*/
|
||||
} else if (
|
||||
selectedActionParameters[count].options !== undefined &&
|
||||
(data.options !== undefined &&
|
||||
data.options !== null &&
|
||||
data.options.length > 0)
|
||||
||
|
||||
(selectedActionParameters[count].options !== undefined &&
|
||||
selectedActionParameters[count].options !== null &&
|
||||
selectedActionParameters[count].options.length > 0
|
||||
selectedActionParameters[count].options.length > 0)
|
||||
) {
|
||||
const parsedoptions = data.options !== undefined ? data.options : selectedActionParameters[count].options
|
||||
|
||||
if (selectedActionParameters[count].value === "") {
|
||||
// && selectedActionParameters[count].required) {
|
||||
// Rofl, dirty workaround :)
|
||||
const e = {
|
||||
target: {
|
||||
value: selectedActionParameters[count].options[0],
|
||||
value: parsedoptions.options[0],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1982,7 +1998,7 @@ const ParsedAction = (props) => {
|
||||
borderRadius: theme.palette.borderRadius,
|
||||
}}
|
||||
>
|
||||
{selectedActionParameters[count].options.map(
|
||||
{parsedoptions.map(
|
||||
(data, index) => {
|
||||
const split_data = data.split("||");
|
||||
var viewed_data = data;
|
||||
@@ -2014,6 +2030,7 @@ const ParsedAction = (props) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// Shows nested list of nodes > their JSON lists
|
||||
const ActionlistWrapper = (props) => {
|
||||
const handleMenuClose = () => {
|
||||
|
||||
@@ -51,7 +51,7 @@ import { useNavigate, Link, useParams } from "react-router-dom";
|
||||
|
||||
const liquidFilters = [
|
||||
{"name": "Size", "value": "size", "example": ""},
|
||||
{"name": "Date", "value": `date: "%Y%M%d"`, "example": `{{ "now" | date: "%s" }}`},
|
||||
{"name": "Date", "value": `date: "%Y%m%d"`, "example": `{{ "now" | date: "%s" }}`},
|
||||
{"name": "Escape String", "value": `{{ \"\"\"'string with weird'" quotes\"\"\" | escape_string }}`, "example": ``},
|
||||
{"name": "Flatten", "value": `flatten`, "example": `{{ [1, [1, 2], [2, 3, 4]] | flatten }}`},
|
||||
]
|
||||
|
||||
@@ -513,7 +513,7 @@ const WelcomeForm = (props) => {
|
||||
}}>
|
||||
Phishing
|
||||
</Button>
|
||||
<Button disabled={true} variant={defaultSearch === "Detection" ? "contained" : "outlined"} startIcon={<NewReleasesIcon />} style={newButtonStyle} onClick={() => {
|
||||
<Button variant={defaultSearch === "Detection" ? "contained" : "outlined"} startIcon={<NewReleasesIcon />} style={newButtonStyle} onClick={() => {
|
||||
setDefaultSearch("Detection")
|
||||
setSelectionOpen(false)
|
||||
|
||||
@@ -525,7 +525,7 @@ const WelcomeForm = (props) => {
|
||||
}}>
|
||||
Detection
|
||||
</Button>
|
||||
<Button disabled={true} variant={defaultSearch === "Response" ? "contained" : "outlined"} startIcon={<NewReleasesIcon />} style={newButtonStyle} onClick={() => {
|
||||
<Button variant={defaultSearch === "Response" ? "contained" : "outlined"} startIcon={<NewReleasesIcon />} style={newButtonStyle} onClick={() => {
|
||||
setDefaultSearch("Response")
|
||||
setSelectionOpen(false)
|
||||
|
||||
|
||||
@@ -746,7 +746,7 @@ const Admin = (props) => {
|
||||
|
||||
if (orgId.length === 0) {
|
||||
alert.error(
|
||||
"Organization ID not defined. Please contact us on https://shuffler.io if this persists logout."
|
||||
"Organization ID not defined (get deals). Please contact us on https://shuffler.io if this persists logout."
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -2693,6 +2693,22 @@ const Admin = (props) => {
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
{/*
|
||||
<Tooltip
|
||||
title={"Go to Organization document"}
|
||||
style={{}}
|
||||
aria-label={"Organization doc"}
|
||||
>
|
||||
<IconButton
|
||||
style={{ top: -10, right: 50, position: "absolute" }}
|
||||
onClick={() => {
|
||||
console.log("Should go to icon")
|
||||
}}
|
||||
>
|
||||
<FileCopyIcon style={{ color: "rgba(255,255,255,0.8)" }} />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
*/}
|
||||
<Tooltip
|
||||
title={"Copy Organization ID"}
|
||||
style={{}}
|
||||
|
||||
@@ -264,6 +264,11 @@ const AngularWorkflow = (defaultprops) => {
|
||||
const [leftViewOpen, setLeftViewOpen] = React.useState(isMobile ? false : true);
|
||||
const [leftBarSize, setLeftBarSize] = React.useState(isMobile ? 0 : 350);
|
||||
const [creatorProfile, setCreatorProfile] = React.useState({});
|
||||
const [files, setFiles] = React.useState({
|
||||
"namespaces": [
|
||||
"default",
|
||||
]
|
||||
});
|
||||
const [appGroup, setAppGroup] = React.useState([]);
|
||||
const [triggerGroup, setTriggerGroup] = React.useState([]);
|
||||
const [executionText, setExecutionText] = React.useState("");
|
||||
@@ -1677,6 +1682,43 @@ const AngularWorkflow = (defaultprops) => {
|
||||
})
|
||||
}
|
||||
|
||||
const getFiles = () => {
|
||||
fetch(globalUrl + "/api/v1/files", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
},
|
||||
credentials: "include",
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status !== 200) {
|
||||
console.log("Status not 200 for apps :O!");
|
||||
return;
|
||||
}
|
||||
|
||||
return response.json();
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.files !== undefined && responseJson.files !== null) {
|
||||
setFiles(responseJson);
|
||||
} else {
|
||||
setFiles({"namespaces": []});
|
||||
}
|
||||
|
||||
console.log("NAMESPACES: ", responseJson.namespaces);
|
||||
if (
|
||||
responseJson.namespaces !== undefined &&
|
||||
responseJson.namespaces !== null
|
||||
) {
|
||||
//setFileNamespaces(responseJson.namespaces);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
const getWorkflow = (workflow_id, sourcenode) => {
|
||||
fetch(globalUrl + "/api/v1/workflows/" + workflow_id, {
|
||||
method: "GET",
|
||||
@@ -1745,8 +1787,14 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
|
||||
setTriggerGroup(appsFound)
|
||||
}
|
||||
|
||||
} else {
|
||||
getAppAuthentication();
|
||||
getEnvironments();
|
||||
getWorkflowExecution(props.match.params.key, "");
|
||||
getAvailableWorkflows(-1);
|
||||
getSettings();
|
||||
getFiles()
|
||||
}
|
||||
|
||||
// Appends SUBFLOWS. Does NOT run during normal grabbing of workflows.
|
||||
if (sourcenode.id !== undefined) {
|
||||
@@ -4598,11 +4646,6 @@ const AngularWorkflow = (defaultprops) => {
|
||||
setFirstrequest(false);
|
||||
getWorkflow(props.match.params.key, {});
|
||||
getApps();
|
||||
getAppAuthentication();
|
||||
getEnvironments();
|
||||
getWorkflowExecution(props.match.params.key, "");
|
||||
getAvailableWorkflows(-1);
|
||||
getSettings();
|
||||
|
||||
const cursearch =
|
||||
typeof window === "undefined" || window.location === undefined
|
||||
@@ -5327,7 +5370,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
description: "O365 email trigger",
|
||||
trigger_type: "EMAIL",
|
||||
errors: null,
|
||||
is_valid: cloudSyncEnabled || isCloud ? true : false,
|
||||
is_valid: isCloud ? true : false,
|
||||
label: "Email",
|
||||
environment: "cloud",
|
||||
large_image:
|
||||
@@ -5341,7 +5384,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
description: "Gmail email trigger",
|
||||
trigger_type: "EMAIL",
|
||||
errors: null,
|
||||
is_valid: cloudSyncEnabled || isCloud ? true : false,
|
||||
is_valid: isCloud ? true : false,
|
||||
label: "Email",
|
||||
environment: "cloud",
|
||||
large_image:
|
||||
@@ -11177,6 +11220,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
|
||||
defaultReturn = <ParsedAction
|
||||
id="rightside_subactions"
|
||||
files={files}
|
||||
setShowVideo={setShowVideo}
|
||||
isCloud={isCloud}
|
||||
getParents={getParents}
|
||||
|
||||
Reference in New Issue
Block a user