Moved Action Parsing out of AngularWorkflow. Should be reusable in App explorer UI
This commit is contained in:
@@ -6085,11 +6085,6 @@ func initHandlers() {
|
|||||||
panic(fmt.Sprintf("DBclient error during init: %s", err))
|
panic(fmt.Sprintf("DBclient error during init: %s", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
//dbclient, err := shuffle.GetDatastoreClient(ctx, gceProject)
|
|
||||||
//if err != nil {
|
|
||||||
// panic(fmt.Sprintf("Error setting datastore connector: %s", err))
|
|
||||||
//}
|
|
||||||
|
|
||||||
_ = shuffle.RunInit(*dbclient, storage.Client{}, gceProject, "onprem", true)
|
_ = shuffle.RunInit(*dbclient, storage.Client{}, gceProject, "onprem", true)
|
||||||
log.Printf("Finished Shuffle database init")
|
log.Printf("Finished Shuffle database init")
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ const Workflow = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (action.errors !== undefined && action.errors !== null && action.errors.length > 0) {
|
if (action.errors !== undefined && action.errors !== null && action.errors.length > 0) {
|
||||||
console.log("Node has errors!: ", action.errors)
|
//console.log("Node has errors!: ", action.errors)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newaction.must_authenticate) {
|
if (newaction.must_authenticate) {
|
||||||
@@ -103,19 +103,23 @@ const Workflow = (props) => {
|
|||||||
for (var key in appAuthentication) {
|
for (var key in appAuthentication) {
|
||||||
const auth = appAuthentication[key]
|
const auth = appAuthentication[key]
|
||||||
if (auth.app.name === app.name && auth.active) {
|
if (auth.app.name === app.name && auth.active) {
|
||||||
console.log("Found auth: ", auth)
|
//console.log("Found auth: ", auth)
|
||||||
authenticationOptions.push(auth)
|
authenticationOptions.push(auth)
|
||||||
newaction.authenticationId = auth.id
|
newaction.authenticationId = auth.id
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("APPAUTH: ", app.authentication, action)
|
|
||||||
if (newaction.authenticationId === null || newaction.authenticationId === undefined || newaction.authenticationId.length === "") {
|
if (newaction.authenticationId === null || newaction.authenticationId === undefined || newaction.authenticationId.length === "") {
|
||||||
console.log("FAILED to authentication node!")
|
//console.log("FAILED to authenticate node!")
|
||||||
newactions.push(newaction)
|
|
||||||
|
if (newactions.find(tmpaction => tmpaction.app_id === newaction.app_id && tmpaction.app_name === newaction.app_name) !== undefined) {
|
||||||
|
console.log("Action already found.")
|
||||||
|
} else {
|
||||||
|
newactions.push(newaction)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("Skipping node as it's already authenticated.")
|
//console.log("Skipping node as it's already authenticated.")
|
||||||
newaction.authentication = authenticationOptions
|
newaction.authentication = authenticationOptions
|
||||||
workflow.actions[key] = newaction
|
workflow.actions[key] = newaction
|
||||||
}
|
}
|
||||||
@@ -157,16 +161,12 @@ const Workflow = (props) => {
|
|||||||
setConfigureWorkflowModalOpen(false)
|
setConfigureWorkflowModalOpen(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("VARIABLES: ", requiredVariables)
|
|
||||||
console.log("ACTIONS: ", newactions)
|
|
||||||
setRequiredTriggers(requiredTriggers)
|
setRequiredTriggers(requiredTriggers)
|
||||||
setRequiredVariables(requiredVariables)
|
setRequiredVariables(requiredVariables)
|
||||||
setRequiredActions(newactions)
|
setRequiredActions(newactions)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("AUTH: ", appAuthentication)
|
|
||||||
if (appAuthentication.length !== previousAuth.length) {
|
if (appAuthentication.length !== previousAuth.length) {
|
||||||
console.log("APP AUTH CHANGED!")
|
|
||||||
var newactions = []
|
var newactions = []
|
||||||
for (var actionkey in requiredActions) {
|
for (var actionkey in requiredActions) {
|
||||||
var newaction = requiredActions[actionkey]
|
var newaction = requiredActions[actionkey]
|
||||||
@@ -175,7 +175,6 @@ const Workflow = (props) => {
|
|||||||
for (var key in appAuthentication) {
|
for (var key in appAuthentication) {
|
||||||
const auth = appAuthentication[key]
|
const auth = appAuthentication[key]
|
||||||
if (auth.app.name === app.name && auth.active) {
|
if (auth.app.name === app.name && auth.active) {
|
||||||
console.log("FOUND AUTH FOR: ", auth.app.name)
|
|
||||||
newaction.auth_done = true
|
newaction.auth_done = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -193,10 +192,7 @@ const Workflow = (props) => {
|
|||||||
const TriggerSection = (props) => {
|
const TriggerSection = (props) => {
|
||||||
const {trigger} = props
|
const {trigger} = props
|
||||||
|
|
||||||
console.log(trigger)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<ListItemAvatar>
|
<ListItemAvatar>
|
||||||
<Avatar variant="rounded">
|
<Avatar variant="rounded">
|
||||||
@@ -275,7 +271,6 @@ const Workflow = (props) => {
|
|||||||
/>
|
/>
|
||||||
*/}
|
*/}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,16 +338,13 @@ const Workflow = (props) => {
|
|||||||
<ListItemText
|
<ListItemText
|
||||||
primary={action.app_name}
|
primary={action.app_name}
|
||||||
secondary={action.app_version}
|
secondary={action.app_version}
|
||||||
style={{minWidth: 175, maxWidth: 175, marginLeft: 10}}
|
style={{}}
|
||||||
/>
|
/>
|
||||||
{action.must_authenticate ?
|
{action.must_authenticate ?
|
||||||
action.auth_done ?
|
action.auth_done ?
|
||||||
<div>
|
<Button color="primary" variant="outlined" onClick={() => {}}>
|
||||||
<Button color="primary" variant="outlined" onClick={() => {
|
Authenticated
|
||||||
}}>
|
</Button>
|
||||||
Finished
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
:
|
:
|
||||||
selectedAction.app_name === action.app_name ?
|
selectedAction.app_name === action.app_name ?
|
||||||
<CircularProgress />
|
<CircularProgress />
|
||||||
@@ -377,8 +369,6 @@ const Workflow = (props) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(requiredActions)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Typography variant="h6">{workflow.name}</Typography>
|
<Typography variant="h6">{workflow.name}</Typography>
|
||||||
@@ -401,11 +391,13 @@ const Workflow = (props) => {
|
|||||||
{requiredVariables.length > 0 ?
|
{requiredVariables.length > 0 ?
|
||||||
<span>
|
<span>
|
||||||
<Typography variant="body1" style={{marginTop: 10}}>Variables</Typography>
|
<Typography variant="body1" style={{marginTop: 10}}>Variables</Typography>
|
||||||
{requiredVariables.map((data, index) => {
|
<List>
|
||||||
return (
|
{requiredVariables.map((data, index) => {
|
||||||
<VariableSection key={index} variable={data} />
|
return (
|
||||||
)
|
<VariableSection key={index} variable={data} />
|
||||||
})}
|
)
|
||||||
|
})}
|
||||||
|
</List>
|
||||||
</span>
|
</span>
|
||||||
: null}
|
: null}
|
||||||
|
|
||||||
@@ -413,21 +405,25 @@ const Workflow = (props) => {
|
|||||||
{requiredTriggers.length > 0 ?
|
{requiredTriggers.length > 0 ?
|
||||||
<span>
|
<span>
|
||||||
<Typography variant="body1" style={{marginTop: 10}}>Triggers</Typography>
|
<Typography variant="body1" style={{marginTop: 10}}>Triggers</Typography>
|
||||||
{requiredTriggers.map((data, index) => {
|
<List>
|
||||||
return (
|
{requiredTriggers.map((data, index) => {
|
||||||
<TriggerSection key={index} trigger={data} />
|
return (
|
||||||
)
|
<TriggerSection key={index} trigger={data} />
|
||||||
})}
|
)
|
||||||
|
})}
|
||||||
|
</List>
|
||||||
</span>
|
</span>
|
||||||
: null }
|
: null }
|
||||||
<div style={{textAlign: "center", display: "flex", marginTop: 20, }}>
|
<div style={{textAlign: "center", display: "flex", marginTop: 20, }}>
|
||||||
<ButtonGroup style={{margin: "auto",}}>
|
<ButtonGroup style={{margin: "auto",}}>
|
||||||
|
{/*
|
||||||
<Button color="primary" variant={"outlined"} style={{
|
<Button color="primary" variant={"outlined"} style={{
|
||||||
}} onClick={() => {
|
}} onClick={() => {
|
||||||
setConfigureWorkflowModalOpen(false)
|
setConfigureWorkflowModalOpen(false)
|
||||||
}}>
|
}}>
|
||||||
Skip
|
Skip
|
||||||
</Button>
|
</Button>
|
||||||
|
*/}
|
||||||
<Button color="primary" variant={"contained"} style={{
|
<Button color="primary" variant={"contained"} style={{
|
||||||
}} onClick={() => {
|
}} onClick={() => {
|
||||||
saveWorkflow(workflow)
|
saveWorkflow(workflow)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,57 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { createMuiTheme } from '@material-ui/core/styles';
|
||||||
|
|
||||||
|
const theme = createMuiTheme({
|
||||||
|
palette: {
|
||||||
|
primary: {
|
||||||
|
main: "#f85a3e"
|
||||||
|
},
|
||||||
|
secondary: {
|
||||||
|
main: '#e8eaf6',
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
secondary: "rgba(255,255,255,0.7)",
|
||||||
|
},
|
||||||
|
surfaceColor: "#27292d",
|
||||||
|
inputColor: "#383B40",
|
||||||
|
borderRadius: 5,
|
||||||
|
textFieldStyle: {
|
||||||
|
backgroundColor: "#383B40",
|
||||||
|
borderRadius: 5,
|
||||||
|
},
|
||||||
|
innerTextfieldStyle: {
|
||||||
|
color: "white",
|
||||||
|
minHeight: 50,
|
||||||
|
marginLeft: "5px",
|
||||||
|
maxWidth: "95%",
|
||||||
|
fontSize: "1em",
|
||||||
|
borderRadius: 5,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
typography: {
|
||||||
|
"fontFamily": `"Roboto", "Helvetica", "Arial", sans-serif`,
|
||||||
|
useNextVariants: true,
|
||||||
|
h1: {
|
||||||
|
fontSize: 40,
|
||||||
|
},
|
||||||
|
h4: {
|
||||||
|
fontSize: 30,
|
||||||
|
fontWeight: 500,
|
||||||
|
},
|
||||||
|
h6: {
|
||||||
|
fontSize: 22,
|
||||||
|
},
|
||||||
|
body1: {
|
||||||
|
fontSize: 18,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
overrides: {
|
||||||
|
MuiMenu: {
|
||||||
|
list: {
|
||||||
|
backgroundColor: "#383B40",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default theme;
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user