A lot of things
This commit is contained in:
@@ -40,12 +40,12 @@ cytoscape.use(edgehandles);
|
||||
export const findSpecificApp = (framework, inputcategory) => {
|
||||
// Get the frameworkinfo for the org and fill in
|
||||
if (framework === undefined || framework === null) {
|
||||
console.log("findSpecificApp: framework is null")
|
||||
//console.log("findSpecificApp: framework is null")
|
||||
return null
|
||||
}
|
||||
|
||||
if (inputcategory === undefined || inputcategory === null) {
|
||||
console.log("findSpecificApp: category is null")
|
||||
//console.log("findSpecificApp: category is null")
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -118,8 +118,8 @@ export const findSpecificApp = (framework, inputcategory) => {
|
||||
}
|
||||
|
||||
return {
|
||||
name: "EDR :default",
|
||||
large_image: parsedDatatypeImages["EDR & AV"],
|
||||
name: "IAM :default",
|
||||
large_image: parsedDatatypeImages["IAM"],
|
||||
count: 0,
|
||||
description: "",
|
||||
id: "",
|
||||
@@ -654,7 +654,7 @@ const AppFramework = (props) => {
|
||||
|
||||
|
||||
const handleLoadNextSuggestion = (frameworkData) => {
|
||||
console.log("Should check for next apps to load from App suggestion model")
|
||||
//console.log("Should check for next apps to load from App suggestion model")
|
||||
//fetch(globalUrl + "/api/v1/workflows/usecases", {
|
||||
//credentials: "include",
|
||||
//cors: "no-cors",
|
||||
@@ -720,7 +720,7 @@ const AppFramework = (props) => {
|
||||
}
|
||||
|
||||
const showRecommendations = (changed, frameworkData) => {
|
||||
console.log("Inside recommendation loader")
|
||||
//console.log("Inside recommendation loader")
|
||||
setChangedApp(changed)
|
||||
handleLoadNextSuggestion(frameworkData)
|
||||
|
||||
@@ -761,7 +761,7 @@ const AppFramework = (props) => {
|
||||
//console.log("APptype, changed, framework: ", apptype.toLowerCase(), alternativeChanged.toLowerCase(), changed.toLowerCase(), frameworkData)
|
||||
if (changed.toLowerCase() === apptype.toLowerCase() || changed.toLowerCase().includes(apptype.toLowerCase()) || alternativeChanged.toLowerCase() === apptype.toLowerCase() || alternativeChanged.toLowerCase().includes(apptype.toLowerCase())) {
|
||||
potential = true
|
||||
console.log("Potential: !", apptype)
|
||||
//console.log("Potential: !", apptype)
|
||||
|
||||
if (frameworkData[apptype] !== undefined && frameworkData[apptype].name !== undefined && frameworkData[apptype].name !== null && frameworkData[apptype].name.length > 0) {
|
||||
usecase.items[itemtype].app = frameworkData[apptype]
|
||||
@@ -819,10 +819,10 @@ const AppFramework = (props) => {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
console.log("No usecase to try to match it to (usecase.usecase_references in UsecaseSearch)")
|
||||
//console.log("No usecase to try to match it to (usecase.usecase_references in UsecaseSearch)")
|
||||
}
|
||||
|
||||
console.log("Usecase: ", usecase)
|
||||
//console.log("Usecase: ", usecase)
|
||||
if (matches.length === usecase.items.length) {
|
||||
usecase.color = "#c51152"
|
||||
usecase.type = usecaseTypes[key].name
|
||||
@@ -833,8 +833,8 @@ const AppFramework = (props) => {
|
||||
}
|
||||
|
||||
// FIXME: Check if a usecase has already been handled
|
||||
console.log("")
|
||||
console.log("GOT USECASES: ", showusecases)
|
||||
//console.log("")
|
||||
//console.log("GOT USECASES: ", showusecases)
|
||||
|
||||
// FIXME: Just showing one usecase at a time for now
|
||||
if (showusecases.length > 0) {
|
||||
@@ -894,38 +894,37 @@ const AppFramework = (props) => {
|
||||
parsedUsecase.process.push(edge.data)
|
||||
}
|
||||
|
||||
fetch(globalUrl + "/api/v1/workflows/usecases", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
},
|
||||
body: JSON.stringify(parsedUsecase),
|
||||
credentials: "include",
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status !== 200) {
|
||||
console.log("Status not 200 for framework!");
|
||||
}
|
||||
fetch(globalUrl + "/api/v1/workflows/usecases", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
},
|
||||
body: JSON.stringify(parsedUsecase),
|
||||
credentials: "include",
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status !== 200) {
|
||||
console.log("Status not 200 for framework!");
|
||||
}
|
||||
|
||||
return response.json();
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
toast("Failed updating: " + responseJson.reason)
|
||||
} else {
|
||||
toast("Failed to update framework for your org.")
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
toast("Failed updating: " + responseJson.reason)
|
||||
} else {
|
||||
toast("Updated usecase.")
|
||||
toast("Failed to update framework for your org.")
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
toast(error.toString());
|
||||
//setFrameworkLoaded(true)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
toast("Updated usecase.")
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
toast(error.toString());
|
||||
})
|
||||
}
|
||||
|
||||
const activateApp = (appid) => {
|
||||
fetch(globalUrl+"/api/v1/apps/"+appid+"/activate", {
|
||||
@@ -957,45 +956,54 @@ const AppFramework = (props) => {
|
||||
}
|
||||
|
||||
const setFrameworkItem = (data) => {
|
||||
console.log("Setting framework item: ", data, isCloud)
|
||||
if (!isCloud) {
|
||||
activateApp(data.id)
|
||||
}
|
||||
|
||||
fetch(globalUrl + "/api/v1/apps/frameworkConfiguration", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
credentials: "include",
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status !== 200) {
|
||||
console.log("Status not 200 for framework!");
|
||||
}
|
||||
fetch(globalUrl + "/api/v1/apps/frameworkConfiguration", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
credentials: "include",
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status !== 200) {
|
||||
console.log("Status not 200 for framework!");
|
||||
}
|
||||
|
||||
return response.json();
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
toast("Failed updating: " + responseJson.reason)
|
||||
} else {
|
||||
toast("Failed to update framework for your org.")
|
||||
return response.json();
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
toast("Failed getting appframework: " + responseJson.reason)
|
||||
} else {
|
||||
toast("Failed to update framework for your org.")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (data.id === "remove") {
|
||||
frameworkData[data.type] = {}
|
||||
frameworkData[data.type.toLowerCase()] = {}
|
||||
} else {
|
||||
frameworkData[data.type] = data
|
||||
frameworkData[data.type.toLowerCase()] = data
|
||||
}
|
||||
|
||||
//setFrameworkLoaded(true)
|
||||
//setFrameworkData(responseJson)
|
||||
})
|
||||
.catch((error) => {
|
||||
toast(error.toString());
|
||||
//setFrameworkLoaded(true)
|
||||
})
|
||||
}
|
||||
setDiscoveryData({})
|
||||
if (setFrameworkData !== undefined) {
|
||||
setFrameworkData(frameworkData)
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
toast(error.toString());
|
||||
//setFrameworkLoaded(true)
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!window.location.pathname.includes("usecases")) {
|
||||
@@ -1058,7 +1066,6 @@ const AppFramework = (props) => {
|
||||
frameworkData[keys[key]] = submitValue
|
||||
}
|
||||
|
||||
console.log("Frameworkdata: ", frameworkData)
|
||||
setFrameworkData(frameworkData)
|
||||
|
||||
if (discoveryData.large_image !== undefined && discoveryData.large_image !== null && discoveryData.large_image.includes("storage.googleapis.com")) {
|
||||
@@ -1076,8 +1083,6 @@ const AppFramework = (props) => {
|
||||
|
||||
|
||||
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
|
||||
|
||||
|
||||
const imgSize = 50;
|
||||
var parsedFrameworkData = frameworkData === undefined ? {} : frameworkData
|
||||
|
||||
@@ -1263,7 +1268,7 @@ const AppFramework = (props) => {
|
||||
|
||||
var parsedStyle2 = {
|
||||
"ghost": "yes",
|
||||
"border-width": "7px",
|
||||
"border-width": "7px",
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1399,7 +1404,6 @@ const AppFramework = (props) => {
|
||||
|
||||
const onNodeSelect = (event) => {
|
||||
var data = event.target.data();
|
||||
console.log("Node: ", data)
|
||||
if (data.id === "SHUFFLE") {
|
||||
event.target.unselect()
|
||||
return
|
||||
@@ -1465,6 +1469,15 @@ const AppFramework = (props) => {
|
||||
|
||||
const foundMiddleImage = userdata !== undefined && userdata !== null && userdata.active_org !== undefined && userdata.active_org.image !== undefined && userdata.active_org.image !== null && userdata.active_org.image !== "" ? userdata.active_org.image : '/images/Shuffle_logo.png'
|
||||
|
||||
const siemcheck = parsedFrameworkData.SIEM.large_image === undefined || (parsedFrameworkData.SIEM.name !== undefined && parsedFrameworkData.SIEM.name !== null && parsedFrameworkData.SIEM.name.includes(":default"))
|
||||
const iamcheck = parsedFrameworkData.IAM.large_image === undefined || (parsedFrameworkData.IAM.name !== undefined && parsedFrameworkData.IAM.name !== null && parsedFrameworkData.IAM.name.includes(":default"))
|
||||
const casescheck = parsedFrameworkData.Cases.large_image === undefined || (parsedFrameworkData.Cases.name !== undefined && parsedFrameworkData.Cases.name !== null && parsedFrameworkData.Cases.name.includes(":default"))
|
||||
const assetscheck = parsedFrameworkData.Assets.large_image === undefined || (parsedFrameworkData.Assets.name !== undefined && parsedFrameworkData.Assets.name !== null && parsedFrameworkData.Assets.name.includes(":default"))
|
||||
const intelcheck = parsedFrameworkData.Intel.large_image === undefined || (parsedFrameworkData.Intel.name !== undefined && parsedFrameworkData.Intel.name !== null && parsedFrameworkData.Intel.name.includes(":default"))
|
||||
const commscheck = parsedFrameworkData.Comms.large_image === undefined || (parsedFrameworkData.Comms.name !== undefined && parsedFrameworkData.Comms.name !== null && parsedFrameworkData.Comms.name.includes(":default"))
|
||||
const edrcheck = parsedFrameworkData["EDR & AV"].large_image === undefined || (parsedFrameworkData["EDR & AV"].name !== undefined && parsedFrameworkData["EDR & AV"].name !== null && parsedFrameworkData["EDR & AV"].name.includes(":default"))
|
||||
const networkcheck = parsedFrameworkData.Network.large_image === undefined || (parsedFrameworkData.Network.name !== undefined && parsedFrameworkData.Network.name !== null && parsedFrameworkData.Network.name.includes(":default"))
|
||||
|
||||
|
||||
const fontSize = `${12*scale}px`
|
||||
const defaultSize = `${85*scale}px`
|
||||
@@ -1484,11 +1497,11 @@ const AppFramework = (props) => {
|
||||
name: parsedFrameworkData.Cases.name === undefined ? "" : parsedFrameworkData.Cases.name,
|
||||
description: parsedFrameworkData.Cases.description === undefined ? "" : parsedFrameworkData.Cases.description,
|
||||
app_id: parsedFrameworkData.Cases.id === undefined ? "" : parsedFrameworkData.Cases.id,
|
||||
text_margin_y: parsedFrameworkData.Cases.large_image === undefined ? textMarginDefault : textMarginImage,
|
||||
margin_x: parsedFrameworkData.Cases.large_image === undefined ? `${32*scale}px` : "0px",
|
||||
margin_y: parsedFrameworkData.Cases.large_image === undefined ? `${19*scale}px` : `0px`,
|
||||
width: parsedFrameworkData.Cases.large_image === undefined ? iconSize : defaultSize,
|
||||
height: parsedFrameworkData.Cases.large_image === undefined ? iconSize : defaultSize,
|
||||
text_margin_y: casescheck ? textMarginDefault : textMarginImage,
|
||||
margin_x: casescheck ? `${32*scale}px` : "0px",
|
||||
margin_y: casescheck ? `${19*scale}px` : `0px`,
|
||||
width: casescheck ? iconSize : defaultSize,
|
||||
height: casescheck ? iconSize : defaultSize,
|
||||
large_image: parsedFrameworkData.Cases.large_image === undefined ? parsedDatatypeImages["CASES"] : parsedFrameworkData.Cases.large_image,
|
||||
|
||||
label: securityFramework[0].text.toUpperCase(),
|
||||
@@ -1501,6 +1514,7 @@ const AppFramework = (props) => {
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
group: "nodes",
|
||||
data: {
|
||||
font_size: fontSize,
|
||||
@@ -1512,11 +1526,11 @@ const AppFramework = (props) => {
|
||||
name: parsedFrameworkData.IAM.name === undefined ? "" : parsedFrameworkData.IAM.name,
|
||||
description: parsedFrameworkData.IAM.description === undefined ? "" : parsedFrameworkData.IAM.description,
|
||||
app_id: parsedFrameworkData.IAM.id === undefined ? "" : parsedFrameworkData.IAM.id,
|
||||
text_margin_y: parsedFrameworkData.IAM.large_image === undefined ? textMarginDefault : textMarginImage,
|
||||
margin_x: parsedFrameworkData.IAM.large_image === undefined ? `${32*scale}px` : "0px",
|
||||
margin_y: parsedFrameworkData.IAM.large_image === undefined ? `${19*scale}px` : `0px`,
|
||||
width: parsedFrameworkData.IAM.large_image === undefined ? iconSize : defaultSize,
|
||||
height: parsedFrameworkData.IAM.large_image === undefined ? iconSize : defaultSize,
|
||||
text_margin_y: iamcheck ? textMarginDefault : textMarginImage,
|
||||
margin_x: iamcheck ? `${32*scale}px` : "0px",
|
||||
margin_y: iamcheck ? `${19*scale}px` : `0px`,
|
||||
width: iamcheck ? iconSize : defaultSize,
|
||||
height: iamcheck ? iconSize : defaultSize,
|
||||
large_image: parsedFrameworkData.IAM.large_image === undefined ? parsedDatatypeImages["IAM"] : parsedFrameworkData.IAM.large_image,
|
||||
|
||||
label: securityFramework[3].text.toUpperCase(),
|
||||
@@ -1540,11 +1554,11 @@ const AppFramework = (props) => {
|
||||
name: parsedFrameworkData.Assets.name === undefined ? "" : parsedFrameworkData.Assets.name,
|
||||
description: parsedFrameworkData.Assets.description === undefined ? "" : parsedFrameworkData.Assets.description,
|
||||
app_id: parsedFrameworkData.Assets.id === undefined ? "" : parsedFrameworkData.Assets.id,
|
||||
text_margin_y: parsedFrameworkData.Assets.large_image === undefined ? textMarginDefault : textMarginImage,
|
||||
margin_x: parsedFrameworkData.Assets.large_image === undefined ? `${32*scale}px` : "0px",
|
||||
margin_y: parsedFrameworkData.Assets.large_image === undefined ? `${19*scale}px` : `0px`,
|
||||
width: parsedFrameworkData.Assets.large_image === undefined ? iconSize : defaultSize,
|
||||
height: parsedFrameworkData.Assets.large_image === undefined ? iconSize : defaultSize,
|
||||
text_margin_y: assetscheck ? textMarginDefault : textMarginImage,
|
||||
margin_x: assetscheck ? `${32*scale}px` : "0px",
|
||||
margin_y: assetscheck ? `${19*scale}px` : `0px`,
|
||||
width: assetscheck ? iconSize : defaultSize,
|
||||
height: assetscheck ? iconSize : defaultSize,
|
||||
large_image: parsedFrameworkData.Assets.large_image === undefined ? parsedDatatypeImages["ASSETS"] : parsedFrameworkData.Assets.large_image,
|
||||
|
||||
label: securityFramework[2].text.toUpperCase(),
|
||||
@@ -1568,11 +1582,11 @@ const AppFramework = (props) => {
|
||||
name: parsedFrameworkData.Intel.name === undefined ? "" : parsedFrameworkData.Intel.name,
|
||||
description: parsedFrameworkData.Intel.description === undefined ? "" : parsedFrameworkData.Intel.description,
|
||||
app_id: parsedFrameworkData.Intel.id === undefined ? "" : parsedFrameworkData.Intel.id,
|
||||
text_margin_y: parsedFrameworkData.Intel.large_image === undefined ? textMarginDefault : textMarginImage,
|
||||
margin_x: parsedFrameworkData.Intel.large_image === undefined ? `${32*scale}px` : "0px",
|
||||
margin_y: parsedFrameworkData.Intel.large_image === undefined ? `${19*scale}px` : `0px`,
|
||||
width: parsedFrameworkData.Intel.large_image === undefined ? iconSize : defaultSize,
|
||||
height: parsedFrameworkData.Intel.large_image === undefined ? iconSize : defaultSize,
|
||||
text_margin_y: intelcheck ? textMarginDefault : textMarginImage,
|
||||
margin_x: intelcheck ? `${32*scale}px` : "0px",
|
||||
margin_y: intelcheck ? `${19*scale}px` : `0px`,
|
||||
width: intelcheck ? iconSize : defaultSize,
|
||||
height: intelcheck ? iconSize : defaultSize,
|
||||
large_image: parsedFrameworkData.Intel.large_image === undefined ? parsedDatatypeImages["INTEL"] : parsedFrameworkData.Intel.large_image,
|
||||
|
||||
label: securityFramework[4].text.toUpperCase(),
|
||||
@@ -1596,11 +1610,11 @@ const AppFramework = (props) => {
|
||||
name: parsedFrameworkData.Comms.name === undefined ? "" : parsedFrameworkData.Comms.name,
|
||||
description: parsedFrameworkData.Comms.description === undefined ? "" : parsedFrameworkData.Comms.description,
|
||||
app_id: parsedFrameworkData.Comms.id === undefined ? "" : parsedFrameworkData.Comms.id,
|
||||
text_margin_y: parsedFrameworkData.Comms.large_image === undefined ? textMarginDefault : textMarginImage,
|
||||
margin_x: parsedFrameworkData.Comms.large_image === undefined ? `${32*scale}px` : "0px",
|
||||
margin_y: parsedFrameworkData.Comms.large_image === undefined ? `${19*scale}px` : `0px`,
|
||||
width: parsedFrameworkData.Comms.large_image === undefined ? iconSize : defaultSize,
|
||||
height: parsedFrameworkData.Comms.large_image === undefined ? iconSize : defaultSize,
|
||||
text_margin_y: commscheck ? textMarginDefault : textMarginImage,
|
||||
margin_x: commscheck ? `${32*scale}px` : "0px",
|
||||
margin_y: commscheck ? `${19*scale}px` : `0px`,
|
||||
width: commscheck ? iconSize : defaultSize,
|
||||
height: commscheck ? iconSize : defaultSize,
|
||||
large_image: parsedFrameworkData.Comms.large_image === undefined ? parsedDatatypeImages["COMMS"] : parsedFrameworkData.Comms.large_image,
|
||||
|
||||
label: securityFramework[5].text.toUpperCase(),
|
||||
@@ -1624,11 +1638,11 @@ const AppFramework = (props) => {
|
||||
name: parsedFrameworkData["EDR & AV"].name === undefined ? "" : parsedFrameworkData["EDR & AV"].name,
|
||||
description: parsedFrameworkData["EDR & AV"].description === undefined ? "" : parsedFrameworkData["EDR & AV"].description,
|
||||
app_id: parsedFrameworkData["EDR & AV"].id === undefined ? "" : parsedFrameworkData["EDR & AV"].id,
|
||||
text_margin_y: parsedFrameworkData["EDR & AV"].large_image === undefined ? textMarginDefault : textMarginImage,
|
||||
margin_x: parsedFrameworkData["EDR & AV"].large_image === undefined ? `${32*scale}px` : "0px",
|
||||
margin_y: parsedFrameworkData["EDR & AV"].large_image === undefined ? `${19*scale}px` : `0px`,
|
||||
width: parsedFrameworkData["EDR & AV"].large_image === undefined ? iconSize : defaultSize,
|
||||
height: parsedFrameworkData["EDR & AV"].large_image === undefined ? iconSize : defaultSize,
|
||||
text_margin_y: edrcheck ? textMarginDefault : textMarginImage,
|
||||
margin_x: edrcheck ? `${32*scale}px` : "0px",
|
||||
margin_y: edrcheck ? `${19*scale}px` : `0px`,
|
||||
width: edrcheck ? iconSize : defaultSize,
|
||||
height: edrcheck ? iconSize : defaultSize,
|
||||
large_image: parsedFrameworkData["EDR & AV"].large_image === undefined ? parsedDatatypeImages["EDR & AV"] : parsedFrameworkData["EDR & AV"].large_image,
|
||||
|
||||
label: securityFramework[7].text.toUpperCase(),
|
||||
@@ -1652,11 +1666,11 @@ const AppFramework = (props) => {
|
||||
name: parsedFrameworkData.Network.name === undefined ? "" : parsedFrameworkData.Network.name,
|
||||
description: parsedFrameworkData.Network.description === undefined ? "" : parsedFrameworkData.Network.description,
|
||||
app_id: parsedFrameworkData.Network.id === undefined ? "" : parsedFrameworkData.Network.id,
|
||||
text_margin_y: parsedFrameworkData.Network.large_image === undefined ? textMarginDefault : textMarginImage,
|
||||
margin_x: parsedFrameworkData.Network.large_image === undefined ? `${32*scale}px` : "0px",
|
||||
margin_y: parsedFrameworkData.Network.large_image === undefined ? `${19*scale}px` : `0px`,
|
||||
width: parsedFrameworkData.Network.large_image === undefined ? iconSize : defaultSize,
|
||||
height: parsedFrameworkData.Network.large_image === undefined ? iconSize : defaultSize,
|
||||
text_margin_y: networkcheck ? textMarginDefault : textMarginImage,
|
||||
margin_x: networkcheck ? `${32*scale}px` : "0px",
|
||||
margin_y: networkcheck ? `${19*scale}px` : `0px`,
|
||||
width: networkcheck ? iconSize : defaultSize,
|
||||
height: networkcheck ? iconSize : defaultSize,
|
||||
large_image: parsedFrameworkData.Network.large_image === undefined ? parsedDatatypeImages["NETWORK"] : parsedFrameworkData.Network.large_image,
|
||||
label: securityFramework[6].text.toUpperCase(),
|
||||
id: securityFramework[6].text.toUpperCase(),
|
||||
@@ -1679,11 +1693,11 @@ const AppFramework = (props) => {
|
||||
name: parsedFrameworkData.SIEM.name === undefined ? "" : parsedFrameworkData.SIEM.name,
|
||||
description: parsedFrameworkData.SIEM.description === undefined ? "" : parsedFrameworkData.SIEM.description,
|
||||
app_id: parsedFrameworkData.SIEM.id === undefined ? "" : parsedFrameworkData.SIEM.id,
|
||||
text_margin_y: parsedFrameworkData.SIEM.large_image === undefined ? textMarginDefault : textMarginImage,
|
||||
margin_x: parsedFrameworkData.SIEM.large_image === undefined ? `${32*scale}px` : "0px",
|
||||
margin_y: parsedFrameworkData.SIEM.large_image === undefined ? `${19*scale}px` : `0px`,
|
||||
width: parsedFrameworkData.SIEM.large_image === undefined ? iconSize : defaultSize,
|
||||
height: parsedFrameworkData.SIEM.large_image === undefined ? iconSize : defaultSize,
|
||||
text_margin_y: siemcheck ? textMarginDefault : textMarginImage,
|
||||
margin_x: siemcheck ? `${32*scale}px` : "0px",
|
||||
margin_y: siemcheck ? `${19*scale}px` : `0px`,
|
||||
width: siemcheck ? iconSize : defaultSize,
|
||||
height: siemcheck ? iconSize : defaultSize,
|
||||
large_image: parsedFrameworkData.SIEM.large_image === undefined ? parsedDatatypeImages["SIEM"] : parsedFrameworkData.SIEM.large_image,
|
||||
label: securityFramework[1].text.toUpperCase(),
|
||||
id: securityFramework[1].text.toUpperCase(),
|
||||
@@ -1988,6 +2002,7 @@ const AppFramework = (props) => {
|
||||
const bgColor = color === undefined || color === null || color.length === 0 ? theme.palette.surfaceColor : color
|
||||
return (
|
||||
<div style={{margin: "auto", backgroundColor: bgColor, position: "relative", }}>
|
||||
{/*
|
||||
<div style={{position: "absolute"}}>
|
||||
|
||||
<SuggestedWorkflows
|
||||
@@ -1999,9 +2014,11 @@ const AppFramework = (props) => {
|
||||
inputSearch={changedApp}
|
||||
apps={apps}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{injectedApps.map((apps, appindex) => {
|
||||
</div>
|
||||
*/}
|
||||
|
||||
{/*injectedApps.map((apps, appindex) => {
|
||||
var categoryTop = 100
|
||||
var categoryLeft = 100
|
||||
|
||||
@@ -2028,8 +2045,11 @@ const AppFramework = (props) => {
|
||||
return null
|
||||
}
|
||||
|
||||
const scale = 0.9
|
||||
const offsetTop = -70
|
||||
const offsetLeft = 0
|
||||
return (
|
||||
<div key={appindex} style={{display: "flex", position: "absolute", top: categoryTop, left: categoryLeft, zIndex: 10010, }}>
|
||||
<div key={appindex} style={{display: "flex", position: "absolute", top: categoryTop+offsetTop, left: categoryLeft+offsetLeft, zIndex: 10010, }}>
|
||||
{apps.map((app, appIndex) => {
|
||||
return (
|
||||
<Chip
|
||||
@@ -2059,7 +2079,6 @@ const AppFramework = (props) => {
|
||||
}
|
||||
|
||||
if (setFrameworkData !== undefined) {
|
||||
console.log("Setting frameworkdata")
|
||||
// Find discoveryData.id
|
||||
var keys = []
|
||||
for (const [key, value] of Object.entries(frameworkData)) {
|
||||
@@ -2088,7 +2107,7 @@ const AppFramework = (props) => {
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
})*/}
|
||||
|
||||
{showOptions === false ? null :
|
||||
<div style={{textAlign: "center",}}>
|
||||
|
||||
@@ -37,7 +37,7 @@ import {
|
||||
} from '@mui/material';
|
||||
|
||||
const AppSearchButtons = (props) => {
|
||||
const { userdata, globalUrl, appFramework, moreButton, finishedApps, appType, totalApps, index, onNodeSelect, setDiscoveryData, appName, AppImage, setDefaultSearch, discoveryData, checkLogin, setMissing, } = props
|
||||
const { userdata, globalUrl, appFramework, moreButton, finishedApps, appType, totalApps, index, onNodeSelect, setDiscoveryData, appName, AppImage, setDefaultSearch, discoveryData, checkLogin, setMissing, getAppFramework, } = props
|
||||
|
||||
const ref = useRef()
|
||||
let navigate = useNavigate();
|
||||
@@ -48,8 +48,6 @@ const AppSearchButtons = (props) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (newSelectedApp !== undefined && setMissing != undefined) {
|
||||
console.log("AppSearchButtons: setMissing is defined!")
|
||||
|
||||
const submitAppFramework = {
|
||||
"description": newSelectedApp.description,
|
||||
"id": newSelectedApp.objectID,
|
||||
@@ -60,11 +58,17 @@ const AppSearchButtons = (props) => {
|
||||
|
||||
setFrameworkItem(submitAppFramework)
|
||||
setMissing(newSelectedApp)
|
||||
|
||||
if (getAppFramework !== undefined) {
|
||||
setTimeout(() => {
|
||||
getAppFramework()
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
}, [newSelectedApp])
|
||||
|
||||
if (appType === undefined) {
|
||||
console.log("Apptype is required in AppSearchButtons")
|
||||
//console.log("Apptype is required in AppSearchButtons")
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,10 +77,8 @@ const ConfigureWorkflow = (props) => {
|
||||
const [checkStarted, setCheckStarted] = React.useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("Required actions: ", requiredActions)
|
||||
//console.log("Configure Workflow: Required actions: ", requiredActions)
|
||||
if (requiredActions.length === 0) {
|
||||
console.log("No more actions? Set parent to done?")
|
||||
|
||||
if (setConfigurationFinished !== undefined) {
|
||||
setConfigurationFinished(true)
|
||||
}
|
||||
@@ -731,6 +729,7 @@ const ConfigureWorkflow = (props) => {
|
||||
|
||||
parsedName = (parsedName.charAt(0).toUpperCase() + parsedName.slice(1)).replaceAll("_", " ");
|
||||
|
||||
console.log("AUTH Action: ", action)
|
||||
return (
|
||||
<ListItem
|
||||
style={{padding: 0, display: "flex", flexDirection: "column", }}
|
||||
|
||||
@@ -146,8 +146,6 @@ const EditWorkflow = (props) => {
|
||||
|
||||
const newWorkflow = isEditing === true ? false : true
|
||||
const priority = userdata === undefined || userdata === null ? null : userdata.priorities.find(prio => prio.type === "usecase" && prio.active === true)
|
||||
console.log("PRIO: ", priority)
|
||||
|
||||
var upload = "";
|
||||
var total_count = 0
|
||||
|
||||
@@ -485,7 +483,7 @@ const EditWorkflow = (props) => {
|
||||
|
||||
</DialogContent>
|
||||
|
||||
<DialogActions style={{paddingRight: 100, }}>
|
||||
<DialogActions style={{paddingRight: 100, marginBottom: 100, }}>
|
||||
<Button
|
||||
style={{}}
|
||||
onClick={() => {
|
||||
|
||||
@@ -1040,22 +1040,28 @@ const ParsedAction = (props) => {
|
||||
};
|
||||
|
||||
|
||||
const returnHelperText = (name, value) => {
|
||||
if (name === undefined || value === undefined) {
|
||||
return ""
|
||||
}
|
||||
|
||||
var helperText = ""
|
||||
//console.log("DATA: ", name, value)
|
||||
if (name.includes("url")) {
|
||||
if (value.includes("localhost") || value.includes("127.0.0.1")) {
|
||||
helperText = "Can't use localhost. Please change to an external IP or hostname."
|
||||
}
|
||||
}
|
||||
|
||||
return helperText
|
||||
const returnHelperText = (name, value) => {
|
||||
if (name === undefined || value === undefined || name === null || value === null || name === "" || value === "") {
|
||||
//console.log("RETURNING EMPTY")
|
||||
return ""
|
||||
}
|
||||
|
||||
var helperText = ""
|
||||
//console.log("DATA: ", name, value)
|
||||
if (name.includes("url")) {
|
||||
if (value.includes("localhost") || value.includes("127.0.0.1")) {
|
||||
helperText = "Can't use localhost. Please change to your external IP."
|
||||
}
|
||||
}
|
||||
|
||||
// Helpertext for openapi fields
|
||||
//if (helperText === "" && name === "body" && selectedApp.generated && selectedApp.activated) {
|
||||
// helperText = <span style={{color: "white", marginBottom: 5, marginleft: 5}}>
|
||||
//}
|
||||
|
||||
return helperText
|
||||
}
|
||||
|
||||
//console.log("AUTH: ", authenticationType)
|
||||
if (authenticationType !== undefined && authenticationType !== null && authenticationType.type === "oauth2") {
|
||||
/*
|
||||
@@ -1297,17 +1303,13 @@ const ParsedAction = (props) => {
|
||||
}
|
||||
|
||||
var placeholder = "Value";
|
||||
if (
|
||||
data.example !== undefined &&
|
||||
data.example !== null &&
|
||||
data.example.length > 0
|
||||
) {
|
||||
if (data.example !== undefined && data.example !== null && data.example.length > 0) {
|
||||
|
||||
placeholder = data.example;
|
||||
|
||||
if (data.name === "url" && data.value !== undefined && data.value !== null && data.value.length === 0) {
|
||||
data.value = data.example;
|
||||
}
|
||||
|
||||
// In case of data.example
|
||||
if (data.value === undefined || data.value === null) {
|
||||
data.value = ""
|
||||
@@ -1642,7 +1644,6 @@ const ParsedAction = (props) => {
|
||||
),
|
||||
}}
|
||||
multiline={data.name.startsWith("${") && data.name.endsWith("}") ? true : multiline}
|
||||
helperText={returnHelperText(data.name, data.value)}
|
||||
onClick={() => {
|
||||
/*
|
||||
setExpansionModalOpen(false);
|
||||
@@ -1680,18 +1681,7 @@ const ParsedAction = (props) => {
|
||||
//changeActionParameterCodemirror(event, count, data)
|
||||
changeActionParameter(event, count, data);
|
||||
}}
|
||||
helperText={baseHelperText.length > 0 ? baseHelperText :
|
||||
selectedApp.generated &&
|
||||
selectedApp.activated &&
|
||||
data.name === "body" ? (
|
||||
<span
|
||||
style={{ color: "white", marginBottom: 5, marginleft: 5 }}
|
||||
>
|
||||
{openApiHelperText}
|
||||
</span>
|
||||
) : data.name.startsWith("${") && data.name.endsWith("}") ?
|
||||
null : null
|
||||
}
|
||||
helperText={returnHelperText(data.name, data.value)}
|
||||
onBlur={(event) => {
|
||||
baseHelperText = calculateHelpertext(event.target.value)
|
||||
if (setLastSaved !== undefined) {
|
||||
|
||||
@@ -75,9 +75,15 @@ const RuntimeDebugger = (props) => {
|
||||
|
||||
setTotalCount(0)
|
||||
|
||||
var starttime = ""
|
||||
var endtime = ""
|
||||
var count = 0
|
||||
var starttime = startTime === undefined || startTime === null || startTime === "" ? "" : new Date(startTime).toISOString()
|
||||
var endtime = endTime === undefined || endTime === null || endTime == "" ? "" : new Date(endTime).toISOString()
|
||||
try {
|
||||
starttime = startTime === undefined || startTime === null || startTime === "" ? "" : new Date(startTime).toISOString()
|
||||
endtime = endTime === undefined || endTime === null || endTime == "" ? "" : new Date(endTime).toISOString()
|
||||
} catch (e) {
|
||||
toast("Invalid date format", { type: "error" })
|
||||
}
|
||||
|
||||
var maxworkflows = 5
|
||||
|
||||
@@ -88,6 +94,11 @@ const RuntimeDebugger = (props) => {
|
||||
}
|
||||
|
||||
const workflowId = workflows[key].id
|
||||
|
||||
if (workflowId === undefined || workflowId === null || workflowId === "") {
|
||||
continue
|
||||
}
|
||||
|
||||
// Fetch the data for the workflow
|
||||
var url = `${globalUrl}/api/v1/workflows/${workflowId}/executions/count`
|
||||
if (starttime !== "") {
|
||||
@@ -133,7 +144,6 @@ const RuntimeDebugger = (props) => {
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
console.log("Setting total count: ", count)
|
||||
setTotalCount(count)
|
||||
}, maxworkflows*300)
|
||||
}
|
||||
@@ -578,7 +588,7 @@ const RuntimeDebugger = (props) => {
|
||||
onClick={() => {
|
||||
window.open(`${globalUrl}/api/v1/workflows/search/${params.row.id}`, "_blank")
|
||||
}}
|
||||
disabled={!userdata.support}
|
||||
disabled={userdata.region_url !== "https://shuffler.io"}
|
||||
>
|
||||
<InsightsIcon fontSize="small" />
|
||||
</IconButton>
|
||||
|
||||
@@ -29,7 +29,7 @@ import WorkflowTemplatePopup2 from "./WorkflowTemplatePopup.jsx";
|
||||
import ConfigureWorkflow from "../components/ConfigureWorkflow.jsx";
|
||||
|
||||
const WorkflowTemplatePopup = (props) => {
|
||||
const { userdata, appFramework, globalUrl, img1, srcapp, img2, dstapp, title, description, visualOnly, apps, isLoggedIn, isHomePage } = props;
|
||||
const { userdata, appFramework, globalUrl, img1, srcapp, img2, dstapp, title, description, visualOnly, apps, isLoggedIn, isHomePage, getAppFramework, } = props;
|
||||
|
||||
const [isActive, setIsActive] = useState(false);
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
@@ -39,17 +39,39 @@ const WorkflowTemplatePopup = (props) => {
|
||||
const [workflow, setWorkflow] = useState({});
|
||||
const [showLoginButton, setShowLoginButton] = useState(false);
|
||||
const [appAuthentication, setAppAuthentication] = React.useState(undefined);
|
||||
|
||||
const [missingSource, setMissingSource] = React.useState(undefined)
|
||||
const [missingDestination, setMissingDestination] = React.useState(undefined);
|
||||
|
||||
const [configurationFinished, setConfigurationFinished] = React.useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
}, [missingSource, missingDestination])
|
||||
|
||||
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
|
||||
const [appSetupDone, setAppSetupDone] = React.useState(false)
|
||||
|
||||
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
|
||||
let navigate = useNavigate();
|
||||
useEffect(() => {
|
||||
if (modalOpen !== true) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!srcapp.includes(":default") && !dstapp.includes(":default")) {
|
||||
if (appSetupDone === false && setAppSetupDone !== undefined) {
|
||||
setAppSetupDone(true)
|
||||
}
|
||||
|
||||
getGeneratedWorkflow()
|
||||
}
|
||||
|
||||
if (missingSource !== undefined && missingDestination !== undefined) {
|
||||
if (appSetupDone === false && setAppSetupDone !== undefined) {
|
||||
setAppSetupDone(true)
|
||||
}
|
||||
}
|
||||
|
||||
if (getAppFramework !== undefined) {
|
||||
setTimeout(() => {
|
||||
getAppFramework()
|
||||
}, 500)
|
||||
}
|
||||
}, [modalOpen, missingSource, missingDestination])
|
||||
|
||||
|
||||
const imagestyleWrapper = {
|
||||
height: 40,
|
||||
@@ -310,8 +332,6 @@ const WorkflowTemplatePopup = (props) => {
|
||||
}
|
||||
|
||||
const url = isCloud ? `${globalUrl}/api/v1/workflows/merge` : `https://shuffler.io/api/v1/workflows/merge`
|
||||
//const url = `https://shuffler.io/api/v1/workflows/merge`
|
||||
|
||||
fetch(url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -370,6 +390,16 @@ const WorkflowTemplatePopup = (props) => {
|
||||
})
|
||||
}
|
||||
|
||||
if (modalOpen === true && !srcapp.includes(":default") && !dstapp.includes(":default")) {
|
||||
if (appSetupDone === false && setAppSetupDone !== undefined) {
|
||||
setAppSetupDone(true)
|
||||
}
|
||||
|
||||
if (workflow.id === undefined && workflowLoading === false && errorMessage === "") {
|
||||
getGeneratedWorkflow()
|
||||
}
|
||||
}
|
||||
|
||||
const isFinished = () => {
|
||||
// Look for configuration fields being done in the current modal
|
||||
// 1. Start by finding the modal
|
||||
@@ -388,6 +418,10 @@ const WorkflowTemplatePopup = (props) => {
|
||||
}
|
||||
|
||||
const ModalView = () => {
|
||||
if (modalOpen === false) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
anchor={"left"}
|
||||
@@ -475,9 +509,9 @@ const WorkflowTemplatePopup = (props) => {
|
||||
</div>
|
||||
}
|
||||
|
||||
{(missingSource !== undefined || missingDestination !== undefined) ?
|
||||
{(appSetupDone === false && missingSource !== undefined || missingDestination !== undefined) ?
|
||||
<Typography variant="body1" style={{marginTop: 75, marginBottom: 10, }}>
|
||||
{"Find relevevant Apps for this Usecase"}
|
||||
{"Find relevant Apps for this Usecase"}
|
||||
</Typography>
|
||||
: null}
|
||||
|
||||
@@ -491,6 +525,8 @@ const WorkflowTemplatePopup = (props) => {
|
||||
AppImage={missingSource.image}
|
||||
|
||||
setMissing={setMissingSource}
|
||||
|
||||
getAppFramework={getAppFramework}
|
||||
/>
|
||||
</div>
|
||||
: null}
|
||||
@@ -505,6 +541,8 @@ const WorkflowTemplatePopup = (props) => {
|
||||
AppImage={missingDestination.image}
|
||||
|
||||
setMissing={setMissingDestination}
|
||||
|
||||
getAppFramework={getAppFramework}
|
||||
/>
|
||||
</div>
|
||||
: null}
|
||||
|
||||
Reference in New Issue
Block a user