Minor edits for blog posts 3

This commit is contained in:
frikky
2020-06-09 18:57:14 +02:00
parent 716443f3a5
commit 31df620d71
7 changed files with 93 additions and 89 deletions
+27 -24
View File
@@ -1560,6 +1560,7 @@ const AngularWorkflow = (props) => {
aria-controls="long-menu"
aria-haspopup="true"
onClick={menuClick}
style={{color: "white"}}
>
<MoreVertIcon />
</IconButton>
@@ -1965,7 +1966,7 @@ const AngularWorkflow = (props) => {
node.data.type = "ACTION"
node.isStartNode = action["id"] === workflow.start
return node;
return node
})
const tmpelements = [].concat(actions)
@@ -2001,8 +2002,10 @@ const AngularWorkflow = (props) => {
}
}
const handleDragStop = (e) => {
const handleDragStop = (e, app) => {
newNodeId = ""
console.log("STOP!: ", e)
console.log("APP!: ", app)
}
const appScrollStyle = {
@@ -2063,7 +2066,7 @@ const AngularWorkflow = (props) => {
return(
<Draggable
onDrag={(e) => {handleAppDrag(e, app)}}
onStop={(e) => {handleDragStop(e)}}
onStop={(e) => {handleDragStop(e, app)}}
dragging={false}
position={{
x: 0,
@@ -2703,11 +2706,11 @@ const AngularWorkflow = (props) => {
}
const setTriggerFolderWrapperMulti = event => {
const { options } = event.target;
const value = [];
const { options } = event.target
const value = []
for (let i = 0, l = options.length; i < l; i += 1) {
if (options[i].selected) {
value.push(options[i].value);
value.push(options[i].value)
}
}
@@ -2783,7 +2786,7 @@ const AngularWorkflow = (props) => {
if (splitItems.includes(value)) {
for( var i = 0; i < splitItems.length; i++){
if (splitItems[i] === value) {
splitItems.splice(i, 1);
splitItems.splice(i, 1)
}
}
@@ -2793,7 +2796,7 @@ const AngularWorkflow = (props) => {
for( var i = 0; i < splitItems.length; i++){
if (splitItems[i] === "") {
splitItems.splice(i, 1);
splitItems.splice(i, 1)
}
}
@@ -2824,7 +2827,7 @@ const AngularWorkflow = (props) => {
}
const AppConditionHandler = (props) => {
const { tmpdata, type } = props;
const { tmpdata, type } = props
if (tmpdata === undefined) {
return tmpdata
@@ -3192,8 +3195,8 @@ const AngularWorkflow = (props) => {
const EdgeSidebar = () => {
const ConditionHandler = (condition, index) => {
const [open, setOpen] = React.useState(false);
const [anchorEl, setAnchorEl] = React.useState(null);
const [open, setOpen] = React.useState(false)
const [anchorEl, setAnchorEl] = React.useState(null)
const deleteCondition = (conditionIndex) => {
console.log(selectedEdge)
@@ -3223,7 +3226,7 @@ const AngularWorkflow = (props) => {
const menuClick = (event) => {
console.log("MENU CLICK")
setOpen(!open)
setAnchorEl(event.currentTarget);
setAnchorEl(event.currentTarget)
}
return (
@@ -3363,7 +3366,7 @@ const AngularWorkflow = (props) => {
})
.catch(error => {
console.log(error.toString())
});
})
}
const getTriggerAuth = () => {
@@ -3384,7 +3387,7 @@ const AngularWorkflow = (props) => {
})
.catch(error => {
console.log(error.toString())
});
})
}
// Getting the triggers and the folders if they exist
@@ -3426,8 +3429,8 @@ const AngularWorkflow = (props) => {
})
.catch(error => {
console.log(error.toString())
});
}, 2500);
})
}, 2500)
console.log(data)
saveWorkflow(workflow)
@@ -3801,7 +3804,7 @@ const AngularWorkflow = (props) => {
})
.catch(error => {
alert.error(error.toString())
});
})
}
const startMailSub = (trigger, triggerindex) => {
@@ -3857,7 +3860,7 @@ const AngularWorkflow = (props) => {
})
.catch(error => {
alert.error(error.toString())
});
})
}
const newWebhook = (trigger) => {
@@ -3903,7 +3906,7 @@ const AngularWorkflow = (props) => {
})
.catch(error => {
console.log(error.toString())
});
})
}
const deleteWebhook = (trigger, triggerindex) => {
@@ -3942,7 +3945,7 @@ const AngularWorkflow = (props) => {
})
.catch(error => {
alert.error(error.toString())
});
})
}
const UserinputSidebar = () => {
@@ -4356,7 +4359,7 @@ const AngularWorkflow = (props) => {
}
if (Object.getOwnPropertyNames(selectedAction).length > 0 && Object.getOwnPropertyNames(selectedApp).length > 0) {
//console.time('ACTIONSTART');
//console.time('ACTIONSTART')
return(
<div style={rightsidebarStyle}>
{appApiView}
@@ -4545,7 +4548,7 @@ const AngularWorkflow = (props) => {
executionData.results.map(data => {
var showResult = data.result.trim()
showResult.split(" None").join(" \"None\"")
//showResult = replaceAll(showResult, " None", " \"None\"");
//showResult = replaceAll(showResult, " None", " \"None\"")
var jsonvalid = true
try {
JSON.parse(showResult)
@@ -4569,7 +4572,7 @@ const AngularWorkflow = (props) => {
{jsonvalid ? <ReactJson
src={JSON.parse(showResult)}
theme="solarized"
collapsed={false}
collapsed={true}
displayDataTypes={false}
name={"Results for "+data.action.label}
/>
@@ -4872,4 +4875,4 @@ const AngularWorkflow = (props) => {
)
}
export default AngularWorkflow;
export default AngularWorkflow
+7 -7
View File
@@ -147,13 +147,13 @@ const App = (message, props) => {
// This is a mess hahahah
return (
<MuiThemeProvider theme={theme}>
<CookiesProvider>
<BrowserRouter>
<Provider template={AlertTemplate} {...options}>
{includedData}
</Provider>
</BrowserRouter>
</CookiesProvider>
<CookiesProvider>
<BrowserRouter>
<Provider template={AlertTemplate} {...options}>
{includedData}
</Provider>
</BrowserRouter>
</CookiesProvider>
</MuiThemeProvider>
);
};
+34 -27
View File
@@ -372,30 +372,6 @@ const AppCreator = (props) => {
securitySchemes = data.components.securitySchemes
}
// FIXME: Have multiple authentication options?
if (securitySchemes !== undefined) {
for (const [key, value] of Object.entries(securitySchemes)) {
if (value.scheme === "bearer") {
setAuthenticationOption("Bearer auth")
break
} else if (value.type === "apiKey") {
setAuthenticationOption("API key")
value.in = value.in.charAt(0).toUpperCase() + value.in.slice(1);
setParameterLocation(value.in)
if (!apikeySelection.includes(value.in)) {
console.log("APIKEY SELECT: ", apikeySelection)
alert.error("Might be error in setting up API key authentication")
}
setParameterName(value.name)
break
} else if (value.scheme === "basic") {
setAuthenticationOption("Basic auth")
break
}
}
}
console.log(data)
@@ -451,9 +427,36 @@ const AppCreator = (props) => {
}
}
// FIXME: Have multiple authentication options?
if (securitySchemes !== undefined) {
for (const [key, value] of Object.entries(securitySchemes)) {
if (value.scheme === "bearer") {
setAuthenticationOption("Bearer auth")
break
} else if (value.type === "apiKey") {
setAuthenticationOption("API key")
value.in = value.in.charAt(0).toUpperCase() + value.in.slice(1);
setParameterLocation(value.in)
if (!apikeySelection.includes(value.in)) {
console.log("APIKEY SELECT: ", apikeySelection)
alert.error("Might be error in setting up API key authentication")
}
console.log("PARAM NAME: ", value.name)
setParameterName(value.name)
break
} else if (value.scheme === "basic") {
setAuthenticationOption("Basic auth")
break
}
}
}
setActions(newActions)
}
// Saving the app that's been configured.
const submitApp = () => {
alert.info("Uploading and building app " + name)
@@ -810,7 +813,7 @@ const AppCreator = (props) => {
id="standard-required"
margin="normal"
variant="outlined"
defaultValue={parameterName}
value={parameterName}
helperText={<div style={{color:"white", marginBottom: "2px",}}>Can't be empty. Can't contain any of the following characters: !#$%&'^+-._~|]+$</div>}
onChange={e => setParameterName(e.target.value)}
InputProps={{
@@ -926,11 +929,13 @@ const AppCreator = (props) => {
{data.method} - {url} - {data.name}
</div>
</Tooltip>
{/*
<Tooltip title="Test action" placement="bottom">
<div style={{color: "#f85a3e", cursor: "pointer", marginRight: "10px", }} onClick={() => {testAction(index)}}>
Test
</div>
</Tooltip>
*/}
<Tooltip title="Delete action" placement="bottom">
<div style={{color: "#f85a3e", cursor: "pointer"}} onClick={() => {deleteAction(index)}}>
Delete
@@ -1576,13 +1581,15 @@ const AppCreator = (props) => {
<div style={{marginTop: "25px"}}>
{actionView}
</div>
{/*
<Divider style={{marginBottom: "10px", marginTop: "30px", height: "1px", width: "100%", backgroundColor: "grey"}}/>
{testView}
*/}
<Button color="primary" variant="contained" style={{borderRadius: "0px", marginTop: "30px", height: "50px",}} onClick={() => {
submitApp()
}}>
Save
Save
</Button>
{errorCode.length > 0 ? `Error: ${errorCode}` : null}
</Paper>
+5 -4
View File
@@ -462,7 +462,8 @@ const Apps = (props) => {
<div/>
Apps interact with eachother in workflows. They are created with the app creator, using OpenAPI specification or manually in python. Use the links above to find potential apps you're looking for using OpenAPI or make one from scratch. There's 1000+ available.
<div/>
<div style={{marginTop: 20}}>
<Divider style={{height: 1, backgroundColor: dividerColor, marginTop: 20, marginBottom: 20}} />
<div style={{}}>
<Button
variant="text"
component="label"
@@ -546,7 +547,7 @@ const Apps = (props) => {
setSearchBackend(!searchBackend)}
} />}
/>
<Tooltip title={"Upload from Github"} style={{marginTop: "28px", width: "100%"}} aria-label={"Upload"}>
<Tooltip title={"Download from Github"} style={{marginTop: "28px", width: "100%"}} aria-label={"Upload"}>
<Button
variant="outlined"
component="label"
@@ -579,10 +580,10 @@ const Apps = (props) => {
handleSearchChange(event.target.value)
}}
/>
<div style={{marginTop: 15, height: "100%", paddingBottom: 150,}}>
<div style={{marginTop: 15}}>
{apps.length > 0 ?
filteredApps.length > 0 ?
<div style={{maxHeight: "75vh", overflowY: "scroll"}}>
<div style={{height: "75vh", overflowY: "scroll"}}>
{filteredApps.map(app => {
return (
appPaper(app)