Authentication fixes to workflow imports
This commit is contained in:
@@ -1585,7 +1585,8 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Have a good way of tracking errors. ID's or similar.
|
// FIXME: Have a good way of tracking errors. ID's or similar.
|
||||||
if !action.IsValid {
|
if !action.IsValid && len(action.Errors) > 0 {
|
||||||
|
log.Printf("Node %s is invalid and needs to be remade. Errors: %s", action.Label, strings.Join(action.Errors, "\n"))
|
||||||
resp.WriteHeader(401)
|
resp.WriteHeader(401)
|
||||||
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Node %s is invalid and needs to be remade."}`, action.Label)))
|
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Node %s is invalid and needs to be remade."}`, action.Label)))
|
||||||
return
|
return
|
||||||
@@ -1792,10 +1793,16 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !authFound {
|
if !authFound {
|
||||||
log.Printf("App auth %s doesn't exist", action.AuthenticationId)
|
log.Printf("App auth %s doesn't exist. Setting error", action.AuthenticationId)
|
||||||
resp.WriteHeader(401)
|
workflow.Errors = append(workflow.Errors, fmt.Sprintf("App authentication for %s doesn't exist!", action.AppName))
|
||||||
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "App auth %s doesn't exist"}`, action.AuthenticationId)))
|
workflow.IsValid = false
|
||||||
return
|
|
||||||
|
action.Errors = append(action.Errors, "App authentication doesn't exist")
|
||||||
|
action.IsValid = false
|
||||||
|
action.AuthenticationId = ""
|
||||||
|
//resp.WriteHeader(401)
|
||||||
|
//resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "App auth %s doesn't exist"}`, action.AuthenticationId)))
|
||||||
|
//return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2421,9 +2428,9 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
|
|||||||
|
|
||||||
for _, authparam := range curAuth.Fields {
|
for _, authparam := range curAuth.Fields {
|
||||||
if param.Name == authparam.Key {
|
if param.Name == authparam.Key {
|
||||||
log.Printf("Name: %s - value: %s", param.Name, param.Value)
|
|
||||||
param.Value = authparam.Value
|
param.Value = authparam.Value
|
||||||
log.Printf("Name: %s - value: %s\n", param.Name, param.Value)
|
//log.Printf("Name: %s - value: %s", param.Name, param.Value)
|
||||||
|
//log.Printf("Name: %s - value: %s\n", param.Name, param.Value)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -558,6 +558,10 @@ const AngularWorkflow = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Override just in this place
|
||||||
|
curworkflowAction.errors = []
|
||||||
|
curworkflowAction.isValid = true
|
||||||
|
|
||||||
newActions.push(curworkflowAction)
|
newActions.push(curworkflowAction)
|
||||||
} else if (type === "TRIGGER") {
|
} else if (type === "TRIGGER") {
|
||||||
//console.log("TRIGGER")
|
//console.log("TRIGGER")
|
||||||
@@ -2258,6 +2262,7 @@ const AngularWorkflow = (props) => {
|
|||||||
|
|
||||||
const ParsedAppPaper = (props) => {
|
const ParsedAppPaper = (props) => {
|
||||||
const app = props.app
|
const app = props.app
|
||||||
|
const [hover, setHover] = React.useState(false)
|
||||||
|
|
||||||
// FIXME - add label to apps, as this might be slow with A LOT of apps
|
// FIXME - add label to apps, as this might be slow with A LOT of apps
|
||||||
var newAppname = app.name
|
var newAppname = app.name
|
||||||
@@ -2268,6 +2273,10 @@ const AngularWorkflow = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const image = "url("+app.large_image+")"
|
const image = "url("+app.large_image+")"
|
||||||
|
const newAppStyle = JSON.parse(JSON.stringify(paperAppStyle))
|
||||||
|
const pixelSize = !hover ? "2px" : "4px"
|
||||||
|
newAppStyle.borderLeft = app.is_valid ? `${pixelSize} solid green` : `${pixelSize} solid orange`
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Draggable
|
<Draggable
|
||||||
@@ -2280,10 +2289,8 @@ const AngularWorkflow = (props) => {
|
|||||||
y: 0,
|
y: 0,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Paper square style={paperAppStyle} >
|
<Paper square style={newAppStyle} onMouseOver={() => {setHover(true)}} onMouseOut={() => {setHover(false)}}>
|
||||||
<div style={{marginLeft: "10px", marginTop: "5px", marginBottom: "5px", width: "2px", backgroundColor: "orange", marginRight: "5px"}}>
|
<Grid container style={{margin: "10px 10px 10px 15px", flex: "10"}}>
|
||||||
</div>
|
|
||||||
<Grid container style={{margin: "10px 10px 10px 10px", flex: "10"}}>
|
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<div style={{borderRadius: borderRadius, height: 80, width: 80, backgroundImage: image, backgroundSize: "cover", backgroundRepeat: "no-repeat"}} />
|
<div style={{borderRadius: borderRadius, height: 80, width: 80, backgroundImage: image, backgroundSize: "cover", backgroundRepeat: "no-repeat"}} />
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -5838,7 +5845,7 @@ const AngularWorkflow = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleSubmitCheck = () => {
|
const handleSubmitCheck = () => {
|
||||||
console.log(authenticationOption)
|
console.log("NEW AUTH: ", authenticationOption)
|
||||||
if (authenticationOption.label.length === 0) {
|
if (authenticationOption.label.length === 0) {
|
||||||
alert.info("Label can't be empty")
|
alert.info("Label can't be empty")
|
||||||
return
|
return
|
||||||
@@ -5869,6 +5876,8 @@ const AngularWorkflow = (props) => {
|
|||||||
console.log("FIELDS: ", newFields)
|
console.log("FIELDS: ", newFields)
|
||||||
newAuthOption.fields = newFields
|
newAuthOption.fields = newFields
|
||||||
setNewAppAuth(newAuthOption)
|
setNewAppAuth(newAuthOption)
|
||||||
|
appAuthentication.push(newAuthOption)
|
||||||
|
setAppAuthentication(appAuthentication)
|
||||||
setUpdate(authenticationOption.id)
|
setUpdate(authenticationOption.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user