Fixed labeling mechanism to work for apps most places

This commit is contained in:
frikky
2023-03-28 19:28:24 +02:00
parent d8778e3257
commit 2ce53cf10d
4 changed files with 143 additions and 108 deletions
@@ -1151,7 +1151,6 @@ const CodeEditor = (props) => {
</div> </div>
} }
<span style={{ <span style={{
border: `2px solid red`,
borderRadius: theme.palette.borderRadius, borderRadius: theme.palette.borderRadius,
position: "relative", position: "relative",
}}> }}>
File diff suppressed because one or more lines are too long
+43 -15
View File
@@ -234,17 +234,17 @@ export const appCategories = [
"name": "SIEM", "name": "SIEM",
"color": "#FFC107", "color": "#FFC107",
"icon": "siem", "icon": "siem",
"action_labels": ["List Alerts", "Search", "Create detection", "Add hash to lookup_list",], "action_labels": ["Search", "List Alerts", "Close Alert", "Create detection", "Add to lookup list",],
}, { }, {
"name": "Eradication", "name": "Eradication",
"color": "#FFC107", "color": "#FFC107",
"icon": "eradication", "icon": "eradication",
"action_labels": ["List Alerts", "Update Alert", "Create detection", "Block hash", "Search Hosts", "Isolate host"], "action_labels": ["List Alerts", "Close Alert", "Create detection", "Block hash", "Search Hosts", "Isolate host", "Unisolate host"],
}, { }, {
"name": "Cases", "name": "Cases",
"color": "#FFC107", "color": "#FFC107",
"icon": "cases", "icon": "cases",
"action_labels": ["List tickets", "Get ticket", "Create ticket", "Update ticket",], "action_labels": ["List tickets", "Get ticket", "Create ticket", "Close ticket", "Add comment", "Update ticket",],
}, { }, {
"name": "Assets", "name": "Assets",
"color": "#FFC107", "color": "#FFC107",
@@ -254,12 +254,12 @@ export const appCategories = [
"name": "Intel", "name": "Intel",
"color": "#FFC107", "color": "#FFC107",
"icon": "intel", "icon": "intel",
"action_labels": ["Get IOC", "Search IOC", "Create IOC", "Update IOC", "Delete IOC", "Add IOC",], "action_labels": ["Get IOC", "Search IOC", "Create IOC", "Update IOC", "Delete IOC",],
}, { }, {
"name": "IAM", "name": "IAM",
"color": "#FFC107", "color": "#FFC107",
"icon": "iam", "icon": "iam",
"action_labels": ["Get Identity", "Get Asset", "Search Identity", "Reset Password", "Disable user", ], "action_labels": ["Reset Password", "Enable user", "Disable user", "Get Identity", "Get Asset", "Search Identity", ],
}, { }, {
"name": "Network", "name": "Network",
"color": "#FFC107", "color": "#FFC107",
@@ -574,10 +574,7 @@ const AppCreator = (defaultprops) => {
setContact(data.info.contact); setContact(data.info.contact);
} }
if ( if (data.info["x-categories"] !== undefined && data.info["x-categories"].length > 0) {
data.info["x-categories"] !== undefined &&
data.info["x-categories"].length > 0
) {
if (typeof data.info["x-categories"] === "array") { if (typeof data.info["x-categories"] === "array") {
} else { } else {
} }
@@ -4125,6 +4122,8 @@ const AppCreator = (defaultprops) => {
body: "", body: "",
errors: [], errors: [],
method: actionNonBodyRequest[0], method: actionNonBodyRequest[0],
action_label: "No Label",
required_bodyfields: [],
}); });
setActionsModalOpen(true); setActionsModalOpen(true);
}} }}
@@ -4139,7 +4138,7 @@ const AppCreator = (defaultprops) => {
const LoopActions = (props) => { const LoopActions = (props) => {
const { filteredActions } = props; const { filteredActions } = props;
//console.log("Actions: ", filteredActions) console.log("Actions: ", filteredActions)
if (filteredActions === null || filteredActions === undefined || filteredActions.length === 0) { if (filteredActions === null || filteredActions === undefined || filteredActions.length === 0) {
return null return null
} }
@@ -4147,6 +4146,7 @@ const AppCreator = (defaultprops) => {
return ( return (
<div> <div>
{filteredActions.slice(0, actionAmount).map((data, index) => { {filteredActions.slice(0, actionAmount).map((data, index) => {
//console.log("Found action: ", data)
return ( return (
<ActionPaper key={index} index={index} data={data} /> <ActionPaper key={index} index={index} data={data} />
) )
@@ -4195,11 +4195,8 @@ const AppCreator = (defaultprops) => {
setNewWorkflowCategories([e.target.value]); setNewWorkflowCategories([e.target.value]);
setUpdate("added " + e.target.value); setUpdate("added " + e.target.value);
}} }}
value={ value={newWorkflowCategories.length === 0 ? "Select a category" : newWorkflowCategories[0]}
newWorkflowCategories.length === 0
? "Select a category"
: newWorkflowCategories[0]
}
style={{ backgroundColor: inputColor, color: "white", height: "50px" }} style={{ backgroundColor: inputColor, color: "white", height: "50px" }}
> >
{categories.map((data, index) => { {categories.map((data, index) => {
@@ -4835,6 +4832,37 @@ const AppCreator = (defaultprops) => {
) : null} ) : null}
<div> <div>
<LoopActions filteredActions={filteredActions} /> <LoopActions filteredActions={filteredActions} />
{ actions.length === 0 || filteredActions.length === 0 ?
<Button
color="primary"
style={{ borderRadius: 0, marginTop: 15, marginBottom: 10, }}
variant={actions.length === 0 ? "contained" : "outlined"}
onClick={(e) => {
actions.push({
name: "Change Me",
description: "",
url: "",
file_field: "",
headers: "",
queries: [],
paths: [],
body: "",
errors: [],
method: actionNonBodyRequest[0],
action_label: "No Label",
required_bodyfields: [],
});
console.log("Added: ", actions)
setActions(actions)
setFilteredActions(actions)
setActionAmount(50);
setUpdate(Math.random());
}}
>
New action
</Button>
: null}
{/* {/*
<div style={{ display: "flex" }}> <div style={{ display: "flex" }}>
<Button <Button
+3
View File
@@ -3875,6 +3875,9 @@ const Workflows = (props) => {
setNewWorkflow={setNewWorkflow} setNewWorkflow={setNewWorkflow}
appFramework={appFramework} appFramework={appFramework}
isEditing={isEditing} isEditing={isEditing}
workflows={workflows}
setWorkflows={setWorkflows}
/> />
: null} : null}
{/*<div style={{zIndex: 1, position: "fixed", bottom: 110, right: 110, display: "flex", }}> {/*<div style={{zIndex: 1, position: "fixed", bottom: 110, right: 110, display: "flex", }}>