Fixed bugs in appcreator

This commit is contained in:
frikky
2020-09-27 20:44:53 +02:00
parent 90f33d95b5
commit f6edb2aeb7
4 changed files with 12 additions and 8 deletions
+2 -2
View File
@@ -553,7 +553,7 @@ func generateYaml(swagger *openapi3.Swagger, newmd5 string) (*openapi3.Swagger,
}) })
} else if securitySchemes["BasicAuth"] != nil { } else if securitySchemes["BasicAuth"] != nil {
api.Authentication.Parameters = append(api.Authentication.Parameters, AuthenticationParams{ api.Authentication.Parameters = append(api.Authentication.Parameters, AuthenticationParams{
Name: "username_auth", Name: "username_basic",
Value: "", Value: "",
Example: "username", Example: "username",
Description: securitySchemes["BasicAuth"].Value.Description, Description: securitySchemes["BasicAuth"].Value.Description,
@@ -565,7 +565,7 @@ func generateYaml(swagger *openapi3.Swagger, newmd5 string) (*openapi3.Swagger,
}) })
api.Authentication.Parameters = append(api.Authentication.Parameters, AuthenticationParams{ api.Authentication.Parameters = append(api.Authentication.Parameters, AuthenticationParams{
Name: "password_auth", Name: "password_basic",
Value: "", Value: "",
Example: "*****", Example: "*****",
Description: securitySchemes["BasicAuth"].Value.Description, Description: securitySchemes["BasicAuth"].Value.Description,
+1 -1
View File
@@ -1843,7 +1843,7 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) {
if !found && param.Required { if !found && param.Required {
log.Printf("Appaction %s with required param %s doesn't exist.", action.Name, param.Name) log.Printf("Appaction %s with required param %s doesn't exist.", action.Name, param.Name)
resp.WriteHeader(401) resp.WriteHeader(401)
resp.Write([]byte(`{"success": false}`)) resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Appaction %s with required param '%s' is empty."}`, action.Name, param.Name)))
return return
} }
+7 -5
View File
@@ -5476,7 +5476,7 @@ const AngularWorkflow = (props) => {
{executionData.results === undefined || executionData.results === null || executionData.results.length === 0 && executionData.status === "EXECUTING" ? {executionData.results === undefined || executionData.results === null || executionData.results.length === 0 && executionData.status === "EXECUTING" ?
<CircularProgress /> <CircularProgress />
: :
executionData.results.map(data => { executionData.results.map((data, index) => {
if (executionData.results.length !== 1 && !showSkippedActions && (data.status === "SKIPPED" || data.status === "FAILURE")) { if (executionData.results.length !== 1 && !showSkippedActions && (data.status === "SKIPPED" || data.status === "FAILURE")) {
return null return null
} }
@@ -5504,7 +5504,7 @@ const AngularWorkflow = (props) => {
<img alt={data.action.app_name} src={curapp.large_image} style={{marginRight: 20, width: imgsize, height: imgsize, border: `2px solid ${statusColor}`}} /> <img alt={data.action.app_name} src={curapp.large_image} style={{marginRight: 20, width: imgsize, height: imgsize, border: `2px solid ${statusColor}`}} />
return ( return (
<div style={{marginBottom: 40,}}> <div key={index} style={{marginBottom: 40,}}>
<div style={{display: "flex", marginBottom: 15,}}> <div style={{display: "flex", marginBottom: 15,}}>
{actionimg} {actionimg}
<span style={{fontSize: 24, marginTop: "auto", marginBottom: "auto"}}><b>{data.action.label}</b></span> <span style={{fontSize: 24, marginTop: "auto", marginBottom: "auto"}}><b>{data.action.label}</b></span>
@@ -5806,6 +5806,7 @@ const AngularWorkflow = (props) => {
console.log(authenticationOption) console.log(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
} }
for (var key in selectedApp.authentication.parameters) { for (var key in selectedApp.authentication.parameters) {
@@ -5819,7 +5820,6 @@ const AngularWorkflow = (props) => {
selectedAction.selectedAuthentication = authenticationOption selectedAction.selectedAuthentication = authenticationOption
selectedAction.authentication.push(authenticationOption) selectedAction.authentication.push(authenticationOption)
setSelectedAction(selectedAction) setSelectedAction(selectedAction)
setUpdate(authenticationOption.id)
var newAuthOption = JSON.parse(JSON.stringify(authenticationOption)) var newAuthOption = JSON.parse(JSON.stringify(authenticationOption))
var newFields = [] var newFields = []
@@ -5834,6 +5834,7 @@ const AngularWorkflow = (props) => {
console.log("FIELDS: ", newFields) console.log("FIELDS: ", newFields)
newAuthOption.fields = newFields newAuthOption.fields = newFields
setNewAppAuth(newAuthOption) setNewAppAuth(newAuthOption)
setUpdate(authenticationOption.id)
} }
return ( return (
@@ -5842,7 +5843,6 @@ const AngularWorkflow = (props) => {
<a href="https://shuffler.io/docs/apps#authentication" style={{textDecoration: "none", color: "#f85a3e"}}>What is this?</a><div/> <a href="https://shuffler.io/docs/apps#authentication" style={{textDecoration: "none", color: "#f85a3e"}}>What is this?</a><div/>
These are required fields for authenticating with {selectedApp.name} These are required fields for authenticating with {selectedApp.name}
<div style={{marginTop: 15}}/> <div style={{marginTop: 15}}/>
{selectedApp.link.length > 0 ? <EndpointData /> : null}
<b>Name - what is this used for?</b> <b>Name - what is this used for?</b>
<TextField <TextField
style={{backgroundColor: inputColor, borderRadius: borderRadius,}} style={{backgroundColor: inputColor, borderRadius: borderRadius,}}
@@ -5862,6 +5862,7 @@ const AngularWorkflow = (props) => {
authenticationOption.label = event.target.value authenticationOption.label = event.target.value
}} }}
/> />
{selectedApp.link.length > 0 ? <div style={{marginTop: 15}}><EndpointData /></div> : null}
<Divider style={{marginTop: 15, marginBottom: 15, backgroundColor: "rgb(91, 96, 100)"}}/> <Divider style={{marginTop: 15, marginBottom: 15, backgroundColor: "rgb(91, 96, 100)"}}/>
<div style={{}}/> <div style={{}}/>
{selectedApp.authentication.parameters.map((data, index) => { {selectedApp.authentication.parameters.map((data, index) => {
@@ -5912,9 +5913,10 @@ const AngularWorkflow = (props) => {
const EndpointData = () => { const EndpointData = () => {
const [tmpVar, setTmpVar] = React.useState("") const [tmpVar, setTmpVar] = React.useState("")
return ( return (
<div> <div>
The API endpoint to use (URL) - leave this if you're unsure The API endpoint to use (URL) - predefined in the app
<TextField <TextField
style={{backgroundColor: inputColor, borderRadius: borderRadius,}} style={{backgroundColor: inputColor, borderRadius: borderRadius,}}
InputProps={{ InputProps={{
+2
View File
@@ -577,6 +577,8 @@ const AppCreator = (props) => {
} }
} }
console.log("SCHEMES: ", securitySchemes)
setActions(newActions) setActions(newActions)
setIsAppLoaded(true) setIsAppLoaded(true)
} }