Merge branch '2.0.0' into flipBranchDirection

This commit is contained in:
Frikky
2024-07-31 19:51:48 +02:00
committed by GitHub
23 changed files with 1839 additions and 411 deletions
+124 -17
View File
@@ -3,12 +3,13 @@ import { toast } from 'react-toastify';
import { makeStyles, createStyles } from "@mui/styles";
import theme from '../theme.jsx';
import { useNavigate, Link, useParams } from "react-router-dom";
import { validateJson, GetIconInfo } from "../views/Workflows.jsx";
import { GetParsedPaths } from "../views/Apps.jsx";
import { sortByKey } from "../views/AngularWorkflow.jsx";
import { NestedMenuItem } from "mui-nested-menu";
import { parsedDatatypeImages } from "../components/AppFramework.jsx";
import { green, yellow, red } from "../views/AngularWorkflow.jsx"
//import { useAlert
import {
@@ -174,7 +175,9 @@ const ParsedAction = (props) => {
setAiQueryModalOpen,
} = props;
let navigate = useNavigate();
const classes = useStyles();
const [hideBody, setHideBody] = React.useState(true)
const [activateHidingBodyButton, setActivateHidingBodyButton] = React.useState(false)
const [appActionName, setAppActionName] = React.useState(selectedAction?.label);
@@ -201,6 +204,34 @@ const ParsedAction = (props) => {
}, [expansionModalOpen])
useEffect(() => {
if (selectedActionEnvironment === undefined || selectedActionEnvironment === null || Object.keys(selectedActionEnvironment).length === 0) {
if (environments !== undefined && environments !== null && environments.length > 0) {
if (selectedAction.environment !== undefined && selectedAction.environment !== null) {
const foundenv = environments.find(env => env.id === selectedAction.environment || selectedAction.environment === env.Name)
if (foundenv !== undefined && foundenv !== null) {
setSelectedActionEnvironment(foundenv)
}
}
}
}
}, [])
useEffect(() => {
setParamValues(selectedAction.parameters.map((param) => {
return {
name: param.name,
value: param.value,
}
}))
},[
selectedAction, selectedApp,setNewSelectedAction, workflow,
])
useEffect(() => {
if (selectedAction.parameters === null || selectedAction.parameters === undefined) {
return
@@ -624,6 +655,7 @@ const ParsedAction = (props) => {
setParamUpdate(event.target.value);
changeActionParameter(event, count, data)
}
const calculateHelpertext = (input_data) => {
var helperText = ""
var looperText = ""
@@ -1935,6 +1967,7 @@ const ParsedAction = (props) => {
}}
labelId="select-app-auth"
value={
selectedAction.authentication_id === "authgroups" ? "authgroups" :
Object.getOwnPropertyNames(selectedAction.selectedAuthentication).length === 0
? "No selection"
: selectedAction.selectedAuthentication
@@ -1951,18 +1984,48 @@ const ParsedAction = (props) => {
selectedAction.authentication_id = "";
for (let [key,keyval] in Object.entries(selectedAction.parameters)) {
//console.log(selectedAction.parameters[key])
if (selectedAction.parameters[key].configuration) {
selectedAction.parameters[key].value = "";
if (selectedAction.parameters[key].example !== undefined && selectedAction.parameters[key].example !== null && selectedAction.parameters[key].example !== "") {
if (selectedAction.parameters[key].example.toLowerCase().includes("api") || selectedAction.parameters[key].example.toLowerCase().includes("key") || selectedAction.parameters[key].example.toLowerCase().includes("pass")) {
selectedAction.parameters[key].value = ""
} else {
selectedAction.parameters[key].value = selectedAction.parameters[key].example
}
} else {
selectedAction.parameters[key].value = ""
}
}
}
setSelectedAction(selectedAction);
setUpdate(Math.random());
} else if (e.target.value === "authgroups") {
if (authGroups !== undefined && authGroups !== null && authGroups.length === 0) {
toast("No auth groups created. Opening window to create one")
setTimeout(() => {
window.open("/admin?tab=app_auth", "_blank")
}, 2500)
} else {
selectedAction.selectedAuthentication = {};
selectedAction.authentication_id = "authgroups"
for (let [key,keyval] in Object.entries(selectedAction.parameters)) {
//console.log(selectedAction.parameters[key])
if (selectedAction.parameters[key].configuration) {
selectedAction.parameters[key].value = "authgroup controlled"
}
}
setSelectedAction(selectedAction)
setUpdate(Math.random())
}
} else {
selectedAction.selectedAuthentication = e.target.value;
selectedAction.authentication_id = e.target.value.id;
setSelectedAction(selectedAction);
setUpdate(Math.random());
setSelectedAction(selectedAction)
setUpdate(Math.random())
}
}}
style={{
@@ -2018,6 +2081,19 @@ const ParsedAction = (props) => {
</MenuItem>
);
})}
<Divider style={{marginTop: 10, marginBottom: 10, }}/>
<MenuItem
style={{
backgroundColor: theme.palette.inputColor,
color: "white",
}}
value="authgroups"
>
<em>Auth Groups</em>
</MenuItem>
</Select>
{/*
@@ -2048,6 +2124,7 @@ const ParsedAction = (props) => {
</div>
) : null}
{showEnvironment !== undefined && showEnvironment && environments.length > 1 && !isIntegration ? (
<div style={{ marginTop: "20px" }}>
<Typography style={{color: "rgba(255,255,255,0.7)"}}>Environment</Typography>
@@ -2056,10 +2133,7 @@ const ParsedAction = (props) => {
disableScrollLock: true,
}}
value={
selectedActionEnvironment === undefined || selectedActionEnvironment === null ||
selectedActionEnvironment.Name === undefined || selectedActionEnvironment.Name === null
? isCloud ? "Cloud" : "Shuffle"
: selectedActionEnvironment.Name
selectedActionEnvironment === undefined || selectedActionEnvironment === null || selectedActionEnvironment.Name === undefined || selectedActionEnvironment.Name === null ? isCloud ? "Cloud" : "Shuffle" : selectedActionEnvironment.Name
}
SelectDisplayProps={{
style: {
@@ -2076,7 +2150,7 @@ const ParsedAction = (props) => {
workflow.actions[actionkey].environment = env.Name
}
setWorkflow(workflow)
toast("Set environment for ALL actions to " + env.Name)
toast.success("Set environment for ALL actions to " + env.Name)
}}
style={{
backgroundColor: theme.palette.inputColor,
@@ -2087,9 +2161,11 @@ const ParsedAction = (props) => {
>
{environments.map((data, index) => {
if (data.archived === true) {
return null;
return null
}
const isRunning = data.running_ip !== ""
return (
<MenuItem
key={data.Name}
@@ -2099,6 +2175,27 @@ const ParsedAction = (props) => {
}}
value={data.Name}
>
{data.Name === "cloud" || data.Name === "Cloud" ? null : !isRunning ?
<a href={`/admin?tab=environments&env=${data.Name}`} target="_blank" style={{textDecoration: "none",}}>
<Tooltip title={"Click to configure the environment"} placement="top">
<Chip
style={{marginLeft: 0, padding: 0, marginRight: 10, cursor: "pointer", backgroundColor: red, }}
label={"Stopped"}
variant="outlined"
color="secondary"
onClick={(e) => {
e.preventDefault()
e.stopPropagation()
window.open(`/admin?tab=environments&env=${data.Name}`, "_blank", "noopener,noreferrer")
}}
/>
</Tooltip>
</a>
: null}
{data.default === true ?
<Chip
style={{marginLeft: 0, padding: 0, marginRight: 10, cursor: "pointer",}}
@@ -2107,12 +2204,22 @@ const ParsedAction = (props) => {
color="secondary"
/>
: null}
{data.Name}
</MenuItem>
);
})}
</Select>
</div>
{/*selectedActionEnvironment.running_ip === "" && selectedActionEnvironment.Name !== "Cloud" && selectedActionEnvironment.Name !== "cloud" ?
<a href={`/admin?tab=environment&env=${selectedActionEnvironment.Name}`} target="_blank" style={{textDecoration: "none", color: "#f85a3e",}}>
<Typography style={{}}>
Configure the environment
</Typography>
</a>
: null*/}
</div>
) : null}
{workflow.execution_variables !== undefined &&
workflow.execution_variables !== null &&
@@ -2739,6 +2846,10 @@ const ParsedAction = (props) => {
return null
}
if (data.value === "authgroup controlled") {
return null
}
// selectedAction.selectedAuthentication = e.target.value
// selectedAction.authentication_id = e.target.value.id
if (
@@ -4141,11 +4252,7 @@ const ParsedAction = (props) => {
onClose={() => {
setShowAutocomplete(false);
if (
!selectedActionParameters[count].value[
selectedActionParameters[count].value.length - 1
] === "."
) {
if (!selectedActionParameters[count].value[selectedActionParameters[count].value.length - 1] === ".") {
setShowDropdown(false);
}