Added extra authentication checker to workflow configuration popup

This commit is contained in:
frikky
2021-05-12 12:40:45 +02:00
parent 26b76ad3a1
commit 5dca18edf9
3 changed files with 34 additions and 14 deletions
+18 -3
View File
@@ -2,6 +2,7 @@ import React, {useState} from 'react';
import { InputAdornment, Tooltip, TextField, CircularProgress, ButtonGroup, Button, Avatar, ListItemAvatar, Typography, List, ListItem, ListItemText} from '@material-ui/core'; import { InputAdornment, Tooltip, TextField, CircularProgress, ButtonGroup, Button, Avatar, ListItemAvatar, Typography, List, ListItem, ListItemText} from '@material-ui/core';
import {FavoriteBorder as FavoriteBorderIcon} from '@material-ui/icons'; import {FavoriteBorder as FavoriteBorderIcon} from '@material-ui/icons';
import { FixName } from "../views/Apps.jsx";
// Handles workflow updates on first open to highlight the issues of the workflow // Handles workflow updates on first open to highlight the issues of the workflow
// Variables // Variables
@@ -88,8 +89,22 @@ const Workflow = (props) => {
newaction.must_activate = true newaction.must_activate = true
} else { } else {
if (action.authentication_id === "" && app.authentication.required === true) { if (action.authentication_id === "" && app.authentication.required === true) {
newaction.must_authenticate = true // Check if configuration is filled or not
newaction.action_ids.push(action.id) var filled = true
for (var key in action.parameters) {
if (action.parameters[key].configuration) {
console.log("Found config: ", action.parameters[key])
if (action.parameters[key].value === null || action.parameters[key].value.length === 0) {
filled = false
break
}
}
}
if (!filled) {
newaction.must_authenticate = true
newaction.action_ids.push(action.id)
}
} }
newaction.app = app newaction.app = app
@@ -339,7 +354,7 @@ const Workflow = (props) => {
</Avatar> </Avatar>
</ListItemAvatar> </ListItemAvatar>
<ListItemText <ListItemText
primary={action.app_name} primary={FixName(action.app_name)}
secondary={action.app_version} secondary={action.app_version}
style={{}} style={{}}
/> />
+9 -11
View File
@@ -6554,6 +6554,15 @@ const AngularWorkflow = (props) => {
</Button> </Button>
</span> </span>
</Tooltip> </Tooltip>
<Tooltip color="secondary" title="Undo" placement="top-start">
<span>
<Button disabled={history.length === 0} color="primary" style={{height: 50, marginLeft: 10, }} variant="outlined" onClick={(event) => {
handleHistoryUndo(history)
}}>
<UndoIcon />
</Button>
</span>
</Tooltip>
<Tooltip color="secondary" title="Remove selected item (del)" placement="top-start"> <Tooltip color="secondary" title="Remove selected item (del)" placement="top-start">
<span> <span>
<Button color="primary" disabled={workflow.public} style={{height: 50, marginLeft: 10, }} variant="outlined" onClick={() => { <Button color="primary" disabled={workflow.public} style={{height: 50, marginLeft: 10, }} variant="outlined" onClick={() => {
@@ -6575,17 +6584,6 @@ const AngularWorkflow = (props) => {
</Tooltip> </Tooltip>
{/* <FileMenu /> */} {/* <FileMenu /> */}
{workflow.configuration !== null && workflow.configuration !== undefined && workflow.configuration.exit_on_error !== undefined ? <WorkflowMenu /> : null} {workflow.configuration !== null && workflow.configuration !== undefined && workflow.configuration.exit_on_error !== undefined ? <WorkflowMenu /> : null}
{history.length > 0 ?
<Tooltip color="secondary" title="Undo" placement="top-start">
<span>
<Button color="primary" style={{height: 50, marginLeft: 10, }} variant="outlined" onClick={(event) => {
handleHistoryUndo(history)
}}>
<UndoIcon />
</Button>
</span>
</Tooltip>
: null}
</div> </div>
</div> </div>
) )
+7
View File
@@ -20,6 +20,13 @@ const chipStyle = {
backgroundColor: "#3d3f43", height: 30, marginRight: 5, paddingLeft: 5, paddingRight: 5, height: 28, cursor: "pointer", borderColor: "#3d3f43", color: "white", backgroundColor: "#3d3f43", height: 30, marginRight: 5, paddingLeft: 5, paddingRight: 5, height: 28, cursor: "pointer", borderColor: "#3d3f43", color: "white",
} }
// Fixes names by making them uppercase and such
// Used for labels. A lot of places don't use this yet
export const FixName = (name) => {
const newAppname = (name.charAt(0).toUpperCase()+name.substring(1)).replaceAll("_", " ")
return newAppname
}
// Parses JSON data into keys that can be used everywhere :) // Parses JSON data into keys that can be used everywhere :)
export const GetParsedPaths = (inputdata, basekey) => { export const GetParsedPaths = (inputdata, basekey) => {
const splitkey = " > " const splitkey = " > "