Merge branch '1.0.0' into master

This commit is contained in:
Frikky
2020-07-27 19:36:58 +09:00
committed by GitHub
14 changed files with 526 additions and 363 deletions
+13 -3
View File
@@ -101,7 +101,7 @@ class AppBase:
except requests.exceptions.ConnectionError as e: except requests.exceptions.ConnectionError as e:
print("Connectionerror: %s" % e) print("Connectionerror: %s" % e)
action_result["result"] = "Bad setup during startup: %d" % e action_result["result"] = "Bad setup during startup: %s" % e
self.send_result(action_result, headers, stream_path) self.send_result(action_result, headers, stream_path)
return return
@@ -288,7 +288,7 @@ class AppBase:
# Do stuff here. # Do stuff here.
innervalue = parse_nested_param(data, maxDepth(data)-0) innervalue = parse_nested_param(data, maxDepth(data)-0)
outervalue = parse_nested_param(data, maxDepth(data)-1) outervalue = parse_nested_param(data, maxDepth(data)-1)
print("INNER: ", outervalue) print("INNER: ", innervalue)
print("OUTER: ", outervalue) print("OUTER: ", outervalue)
if outervalue != innervalue: if outervalue != innervalue:
@@ -710,7 +710,17 @@ class AppBase:
continue continue
#print(destinationvalue) #print(destinationvalue)
if not run_validation(sourcevalue, condition["condition"]["value"], destinationvalue): # NEGATE
validation = run_validation(sourcevalue, condition["condition"]["value"], destinationvalue)
# Configuration = negated because of WorkflowAppActionParam..
try:
if condition["condition"]["configuration"]:
validation = not validation
except KeyError:
pass
if not validation:
self.logger.info("Failed condition check for %s %s %s." % (sourcevalue, condition["condition"]["value"], destinationvalue)) self.logger.info("Failed condition check for %s %s %s." % (sourcevalue, condition["condition"]["value"], destinationvalue))
return False, "Failed condition: %s %s %s" % (sourcevalue, condition["condition"]["value"], destinationvalue) return False, "Failed condition: %s %s %s" % (sourcevalue, condition["condition"]["value"], destinationvalue)
+1 -1
View File
@@ -398,7 +398,7 @@ func makePythoncode(swagger *openapi3.Swagger, name, url, method string, paramet
verifyAddin, verifyAddin,
) )
log.Printf("%s", data) //log.Printf("%s", data)
return functionname, data return functionname, data
} }
+14 -4
View File
@@ -662,7 +662,7 @@ func handleApiAuthentication(resp http.ResponseWriter, request *http.Request) (U
if len(Userdata.Username) > 0 { if len(Userdata.Username) > 0 {
return Userdata, nil return Userdata, nil
} else { } else {
return Userdata, errors.New("User is invalid") return Userdata, errors.New(fmt.Sprintf("User is invalid - no username found: %#v", Userdata))
} }
} }
@@ -1605,8 +1605,11 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
} }
// This is a long check to see if an inactive admin can access the site // This is a long check to see if an inactive admin can access the site
parsedAdmin := "false"
if !userInfo.Active { if !userInfo.Active {
if userInfo.Role == "admin" { if userInfo.Role == "admin" {
parsedAdmin = "true"
ctx := context.Background() ctx := context.Background()
q := datastore.NewQuery("Users") q := datastore.NewQuery("Users")
var users []User var users []User
@@ -1672,7 +1675,14 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
Expires: expiration, Expires: expiration,
}) })
returnData := fmt.Sprintf(`{"success": true, "cookies": [{"key": "session_token", "value": "%s", "expiration": %d}]}`, userInfo.Session, expiration.Unix()) returnData := fmt.Sprintf(`
{
"success": true,
"admin": %s,
"orgs": [{"name": "Shuffle", "id": "123", "role": "admin"}],
"selected_org": {"name": "Shuffle", "id": "123", "role": "admin"},
"cookies": [{"key": "session_token", "value": "%s", "expiration": %d}]
}`, parsedAdmin, userInfo.Session, expiration.Unix())
resp.WriteHeader(200) resp.WriteHeader(200)
resp.Write([]byte(returnData)) resp.Write([]byte(returnData))
@@ -6134,7 +6144,7 @@ func handleAppHotload(location string) error {
} }
//log.Printf("Reading app folder: %#v", dir) //log.Printf("Reading app folder: %#v", dir)
err = iterateAppGithubFolders(fs, dir, "", "") err = iterateAppGithubFolders(fs, dir, "", "", false)
if err != nil { if err != nil {
log.Printf("Err: %s", err) log.Printf("Err: %s", err)
return err return err
@@ -6345,7 +6355,7 @@ func runInit(ctx context.Context) {
//iterateAppGithubFolders(fs, dir, "", "testing") //iterateAppGithubFolders(fs, dir, "", "testing")
// FIXME: Get all the apps? // FIXME: Get all the apps?
iterateAppGithubFolders(fs, dir, "", "") iterateAppGithubFolders(fs, dir, "", "", false)
// Hotloads locally // Hotloads locally
location := os.Getenv("APP_HOTLOAD_FOLDER") location := os.Getenv("APP_HOTLOAD_FOLDER")
+28 -14
View File
@@ -94,6 +94,7 @@ type AuthenticationUsage struct {
} }
// An app inside Shuffle // An app inside Shuffle
// Source string `json:"source" datastore:"soure" yaml:"source"` - downloadlocation
type WorkflowApp struct { type WorkflowApp struct {
Name string `json:"name" yaml:"name" required:true datastore:"name"` Name string `json:"name" yaml:"name" required:true datastore:"name"`
IsValid bool `json:"is_valid" yaml:"is_valid" required:true datastore:"is_valid"` IsValid bool `json:"is_valid" yaml:"is_valid" required:true datastore:"is_valid"`
@@ -4221,9 +4222,10 @@ func loadSpecificApps(resp http.ResponseWriter, request *http.Request) {
// Field1 & 2 can be a lot of things.. // Field1 & 2 can be a lot of things..
type tmpStruct struct { type tmpStruct struct {
URL string `json:"url"` URL string `json:"url"`
Field1 string `json:"field_1"` Field1 string `json:"field_1"`
Field2 string `json:"field_2"` Field2 string `json:"field_2"`
ForceUpdate bool `json:"force_update"`
} }
//log.Printf("Body: %s", string(body)) //log.Printf("Body: %s", string(body))
@@ -4265,7 +4267,13 @@ func loadSpecificApps(resp http.ResponseWriter, request *http.Request) {
log.Printf("FAiled reading folder: %s", err) log.Printf("FAiled reading folder: %s", err)
} }
_ = r _ = r
iterateAppGithubFolders(fs, dir, "", "")
if tmpBody.ForceUpdate {
log.Printf("Running with force update!")
} else {
log.Printf("Updating apps with updates")
}
iterateAppGithubFolders(fs, dir, "", "", tmpBody.ForceUpdate)
} else if strings.Contains(tmpBody.URL, "s3") { } else if strings.Contains(tmpBody.URL, "s3") {
//https://docs.aws.amazon.com/sdk-for-go/api/service/s3/ //https://docs.aws.amazon.com/sdk-for-go/api/service/s3/
@@ -4490,8 +4498,13 @@ func iterateWorkflowGithubFolders(fs billy.Filesystem, dir []os.FileInfo, extra
} }
// Onlyname is used to // Onlyname is used to
func iterateAppGithubFolders(fs billy.Filesystem, dir []os.FileInfo, extra string, onlyname string) error { func iterateAppGithubFolders(fs billy.Filesystem, dir []os.FileInfo, extra string, onlyname string, forceUpdate bool) error {
var err error var err error
allapps := []WorkflowApp{}
// It's here to prevent getting them in every iteration
ctx := context.Background()
for _, file := range dir { for _, file := range dir {
if len(onlyname) > 0 && file.Name() != onlyname { if len(onlyname) > 0 && file.Name() != onlyname {
continue continue
@@ -4508,7 +4521,7 @@ func iterateAppGithubFolders(fs billy.Filesystem, dir []os.FileInfo, extra strin
} }
// Go routine? Hmm, this can be super quick I guess // Go routine? Hmm, this can be super quick I guess
err = iterateAppGithubFolders(fs, dir, tmpExtra, "") err = iterateAppGithubFolders(fs, dir, tmpExtra, "", forceUpdate)
if err != nil { if err != nil {
log.Printf("Error reading folder: %s", err) log.Printf("Error reading folder: %s", err)
continue continue
@@ -4591,12 +4604,12 @@ func iterateAppGithubFolders(fs billy.Filesystem, dir []os.FileInfo, extra strin
fmt.Sprintf("%s:%s_%s", baseDockerName, newName, workflowapp.AppVersion), fmt.Sprintf("%s:%s_%s", baseDockerName, newName, workflowapp.AppVersion),
} }
ctx := context.Background() if len(allapps) == 0 {
allapps, err := getAllWorkflowApps(ctx) allapps, err = getAllWorkflowApps(ctx)
if err != nil { if err != nil {
log.Printf("Failed getting apps to verify: %s", err) log.Printf("Failed getting apps to verify: %s", err)
continue continue
//return err }
} }
// Make an option to override existing apps? // Make an option to override existing apps?
@@ -4607,7 +4620,7 @@ func iterateAppGithubFolders(fs billy.Filesystem, dir []os.FileInfo, extra strin
if app.Name == workflowapp.Name && app.AppVersion == workflowapp.AppVersion { if app.Name == workflowapp.Name && app.AppVersion == workflowapp.AppVersion {
// FIXME: Check if there's a new APP_SDK as well. // FIXME: Check if there's a new APP_SDK as well.
// Skip this check if app_sdk is new. // Skip this check if app_sdk is new.
if app.Hash == md5 && app.Hash != "" { if app.Hash == md5 && app.Hash != "" && !forceUpdate {
skip = true skip = true
break break
} }
@@ -4617,7 +4630,7 @@ func iterateAppGithubFolders(fs billy.Filesystem, dir []os.FileInfo, extra strin
} }
} }
if skip { if skip && !forceUpdate {
continue continue
} }
@@ -4677,6 +4690,7 @@ func iterateAppGithubFolders(fs billy.Filesystem, dir []os.FileInfo, extra strin
if len(removeApps) > 0 { if len(removeApps) > 0 {
for _, item := range removeApps { for _, item := range removeApps {
log.Printf("Removing duplicate: %s", item)
err = DeleteKey(ctx, "workflowapp", item) err = DeleteKey(ctx, "workflowapp", item)
if err != nil { if err != nil {
log.Printf("Failed deleting %s", item) log.Printf("Failed deleting %s", item)
+2 -7
View File
@@ -11,22 +11,18 @@ import Webhooks from "./views/Webhooks";
import Workflows from "./views/Workflows"; import Workflows from "./views/Workflows";
import EditWebhook from "./views/EditWebhook"; import EditWebhook from "./views/EditWebhook";
import AngularWorkflow from "./views/AngularWorkflow"; import AngularWorkflow from "./views/AngularWorkflow";
// import ForgotPassword from "./views/ForgotPassword";
// import ForgotPasswordLink from "./components/ForgotPasswordLink";
import Header from './components/Header'; import Header from './components/Header';
import Apps from './views/Apps'; import Apps from './views/Apps';
import AppCreator from './views/AppCreator'; import AppCreator from './views/AppCreator';
import Contact from './views/Contact'; import Contact from './views/Contact';
import Oauth2 from './views/Oauth2'; import Oauth2 from './views/Oauth2';
// import About from "./views/About";
// import Post from "./views/Post";
import Dashboard from "./views/Dashboard"; import Dashboard from "./views/Dashboard";
import AdminSetup from "./views/AdminSetup"; import AdminSetup from "./views/AdminSetup";
import Admin from "./views/Admin"; import Admin from "./views/Admin";
import Docs from "./views/Docs"; import Docs from "./views/Docs";
// import RegisterLink from "./views/RegisterLink";
// import LandingPage from "./views/Landingpage";
import LandingPageNew from "./views/LandingpageNew"; import LandingPageNew from "./views/LandingpageNew";
import LoginPage from "./views/LoginPage"; import LoginPage from "./views/LoginPage";
import SettingsPage from "./views/SettingsPage"; import SettingsPage from "./views/SettingsPage";
@@ -165,4 +161,3 @@ const App = (message, props) => {
}; };
export default App; export default App;
+34 -4
View File
@@ -6,6 +6,9 @@ import {Link} from 'react-router-dom';
import List from '@material-ui/core/List'; import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem'; import ListItem from '@material-ui/core/ListItem';
import MenuItem from '@material-ui/core/MenuItem';
import Select from '@material-ui/core/Select';
import Button from '@material-ui/core/Button'; import Button from '@material-ui/core/Button';
import HomeIcon from '@material-ui/icons/Home'; import HomeIcon from '@material-ui/icons/Home';
import PolymerIcon from '@material-ui/icons/Polymer'; import PolymerIcon from '@material-ui/icons/Polymer';
@@ -17,7 +20,8 @@ const hoverColor = "#f85a3e"
const hoverOutColor = "#e8eaf6" const hoverOutColor = "#e8eaf6"
const Header = props => { const Header = props => {
const { globalUrl, isLoggedIn, removeCookie, homePage, isLoaded } = props;
const { globalUrl, isLoggedIn, removeCookie, homePage, isLoaded } = props;
const [HomeHoverColor, setHomeHoverColor] = useState(hoverOutColor); const [HomeHoverColor, setHomeHoverColor] = useState(hoverOutColor);
const [SoarHoverColor, setSoarHoverColor] = useState(hoverOutColor); const [SoarHoverColor, setSoarHoverColor] = useState(hoverOutColor);
@@ -100,7 +104,7 @@ const Header = props => {
// Handle top bar or something // Handle top bar or something
const loginTextBrowser = !isLoggedIn ? const loginTextBrowser = !isLoggedIn ?
<div style={{display: "flex"}}> <div style={{display: "flex"}}>
<List style={{display: "flex", flexDirect: "row"}} component="nav"> <List style={{display: "flex", flexDirect: "row"}} component="nav">
<ListItem style={{textAlign: "center", marginLeft: "0px"}}> <ListItem style={{textAlign: "center", marginLeft: "0px"}}>
@@ -192,6 +196,32 @@ const Header = props => {
</Button> </Button>
</Link> </Link>
</ListItem> </ListItem>
{userdata === undefined || userdata.orgs.length <= 1 ? null :
<ListItem>
<Select
SelectDisplayProps={{
style: {
marginLeft: 10,
}
}}
value={userdata.selected_org}
fullWidth
style={{backgroundColor: surfaceColor, color: "white", height: "50px"}}
onChange={(e) => {
console.log("SET ORG TO ", e.target.value)
}}
>
{userdata.orgs.map(data => {
return (
<MenuItem key={data.id} style={{backgroundColor: inputColor, color: "white"}} value={data}>
{data.name}
</MenuItem>
)
})}
</Select>
</ListItem>
}
</List> </List>
</div> </div>
</div> </div>
@@ -287,7 +317,7 @@ const Header = props => {
<div> <div>
{loadedCheck} {loadedCheck}
</div> </div>
); )
}; }
export default Header; export default Header;
+362 -268
View File
@@ -1,7 +1,9 @@
import React, { useEffect } from 'react'; import React, { useEffect} from 'react';
import { Link } from 'react-router-dom'; import {Link} from 'react-router-dom';
import Paper from '@material-ui/core/Paper'; import Paper from '@material-ui/core/Paper';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import Switch from '@material-ui/core/Switch';
import Select from '@material-ui/core/Select'; import Select from '@material-ui/core/Select';
import MenuItem from '@material-ui/core/MenuItem'; import MenuItem from '@material-ui/core/MenuItem';
import List from '@material-ui/core/List'; import List from '@material-ui/core/List';
@@ -26,7 +28,6 @@ const Admin = (props) => {
const { globalUrl } = props; const { globalUrl } = props;
const theme = useTheme(); const theme = useTheme();
const [firstRequest, setFirstRequest] = React.useState(true); const [firstRequest, setFirstRequest] = React.useState(true);
const [modalUser, setModalUser] = React.useState({}); const [modalUser, setModalUser] = React.useState({});
const [modalOpen, setModalOpen] = React.useState(false); const [modalOpen, setModalOpen] = React.useState(false);
@@ -57,20 +58,20 @@ const Admin = (props) => {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
}) })
.then(response => .then(response =>
response.json().then(responseJson => { response.json().then(responseJson => {
console.log("RESP: ", responseJson) console.log("RESP: ", responseJson)
if (responseJson["success"] === false) { if (responseJson["success"] === false) {
alert.error("Failed stopping schedule") alert.error("Failed stopping schedule")
} else { } else {
getAppAuthentication() getAppAuthentication()
alert.success("Successfully stopped schedule!") alert.success("Successfully stopped schedule!")
} }
}), }),
) )
.catch(error => { .catch(error => {
console.log("Error in userdata: ", error) console.log("Error in userdata: ", error)
}); });
} }
const deleteSchedule = (data) => { const deleteSchedule = (data) => {
@@ -106,6 +107,7 @@ const Admin = (props) => {
const onPasswordChange = () => { const onPasswordChange = () => {
const data = { "username": selectedUser.username, "newpassword": newPassword } const data = { "username": selectedUser.username, "newpassword": newPassword }
const url = globalUrl + '/api/v1/users/passwordchange'; const url = globalUrl + '/api/v1/users/passwordchange';
fetch(url, { fetch(url, {
mode: 'cors', mode: 'cors',
method: 'POST', method: 'POST',
@@ -141,24 +143,24 @@ const Admin = (props) => {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
}) })
.then(response => { .then(response => {
if (response.status === 200) { if (response.status === 200) {
getUsers() getUsers()
} }
return response.json() return response.json()
}) })
.then((responseJson) => { .then((responseJson) => {
if (!responseJson.success && responseJson.reason !== undefined) { if (!responseJson.success && responseJson.reason !== undefined) {
alert.error("Failed to deactivate user: " + responseJson.reason) alert.error("Failed to deactivate user: "+responseJson.reason)
} else { } else {
alert.success("Deactivated user " + data.id) alert.success("Deactivated user "+data.id)
} }
}) })
.catch(error => { .catch(error => {
console.log("Error in userdata: ", error) console.log("Error in userdata: ", error)
}); });
} }
const submitUser = (data) => { const submitUser = (data) => {
@@ -790,250 +792,342 @@ const Admin = (props) => {
) )
})} })}
</List> </List>
</div > </div>
: null : null
const schedulesView = curTab === 3 ? const schedulesView = curTab === 3 ?
<div> <div>
<div style={{ marginTop: 20, marginBottom: 20, }}> <div style={{marginTop: 20, marginBottom: 20,}}>
<h2 style={{ display: "inline", }}>Schedules</h2> <h2 style={{display: "inline",}}>Schedules</h2>
<span style={{ marginLeft: 25 }}>Schedules used in Workflows. Makes locating and control easier.</span> <span style={{marginLeft: 25}}>Schedules used in Workflows. Makes locating and control easier.</span>
</div> </div>
<Divider style={{ marginTop: 20, marginBottom: 20, backgroundColor: theme.palette.inputColor }} /> <Divider style={{marginTop: 20, marginBottom: 20, backgroundColor: inputColor}}/>
<List> <List>
<ListItem> <ListItem>
<ListItemText <ListItemText
primary="Interval (seconds)" primary="Interval (seconds)"
style={{ maxWidth: 200 }} style={{maxWidth: 200}}
/> />
<ListItemText <ListItemText
primary="Argument" primary="Argument"
style={{ maxWidth: 400, overflow: "hidden" }} style={{maxWidth: 400, overflow: "hidden"}}
/> />
<ListItemText <ListItemText
primary="Actions" primary="Actions"
/> />
</ListItem> </ListItem>
{schedules === undefined || schedules === null ? null : schedules.map(schedule => { {schedules === undefined || schedules === null ? null : schedules.map(schedule => {
return ( return (
<ListItem> <ListItem>
<ListItemText <ListItemText
style={{ maxWidth: 200 }} style={{maxWidth: 200}}
primary={schedule.seconds} primary={schedule.seconds}
/>
<ListItemText
primary={schedule.argument}
style={{ maxWidth: 400, overflow: "hidden" }}
/>
<ListItemText>
<Button
style={{}}
variant="contained"
color="primary"
onClick={() => deleteSchedule(schedule)}
>
Delete
</Button>
</ListItemText>
</ListItem>
)
})}
</List>
</div>
: null
const authenticationView = curTab === 1 ?
<div>
<div style={{ marginTop: 20, marginBottom: 20, }}>
<h2 style={{ display: "inline", }}>App Authentication</h2>
<span style={{ marginLeft: 25 }}>Control the authentication options for individual apps. <b>Actions can be destructive!</b></span>
</div>
<Divider style={{ marginTop: 20, marginBottom: 20, backgroundColor: theme.palette.inputColor }} />
<List>
<ListItem>
<ListItemText
primary="Icon"
style={{ minWidth: 150, maxWidth: 150 }}
/>
<ListItemText
primary="Label"
style={{ minWidth: 250, maxWidth: 250 }}
/>
<ListItemText
primary="App Name"
style={{ minWidth: 150, maxWidth: 150 }}
/>
<ListItemText
primary="Workflows"
style={{ minWidth: 150, maxWidth: 150, overflow: "hidden" }}
/>
<ListItemText
primary="Action amount"
style={{ minWidth: 150, maxWidth: 150, overflow: "hidden" }}
/>
<ListItemText
primary="Fields"
style={{ minWidth: 200, maxWidth: 200, overflow: "hidden" }}
/>
<ListItemText
primary="Actions"
/>
</ListItem>
{authentication === undefined ? null : authentication.map(data => {
return (
<ListItem>
<ListItemText
primary={<img alt="" src={data.app.large_image} style={{ maxWidth: 50, }} />}
style={{ minWidth: 150, maxWidth: 150 }}
/> />
<ListItemText <ListItemText
primary={data.label} primary={schedule.argument}
style={{ minWidth: 250, maxWidth: 250 }} style={{maxWidth: 400, overflow: "hidden"}}
/> />
<ListItemText <ListItemText>
primary={data.app.name} <Button
style={{ minWidth: 150, maxWidth: 150 }} style={{}}
/> variant="contained"
<ListItemText color="primary"
primary={data.usage.length} onClick={() => deleteSchedule(schedule)}
style={{ minWidth: 150, maxWidth: 150, overflow: "hidden" }} >
/> Delete
<ListItemText
primary={data.node_count}
style={{ minWidth: 150, maxWidth: 150, overflow: "hidden" }}
/>
<ListItemText
primary={data.fields.map(data => {
return data.key
}).join(", ")}
style={{ minWidth: 200, maxWidth: 200, overflow: "hidden" }}
/>
<ListItemText>
<Button
style={{}}
variant="outlined"
color="primary"
onClick={() => {
deleteAuthentication(data)
}}
>
Delete
</Button> </Button>
</ListItemText> </ListItemText>
</ListItem> </ListItem>
) )
})} })}
</List> </List>
</div>
: null
const environmentView = curTab === 2 ?
<div>
<div style={{ marginTop: 20, marginBottom: 20, }}>
<h2 style={{ display: "inline", }}>Environments</h2>
<span style={{ marginLeft: 25 }}>Decides what Orborus environment to execute an action in a workflow in.</span>
</div> </div>
<Button : null
style={{}}
variant="contained" const authenticationView = curTab === 1 ?
color="primary" <div>
onClick={() => setModalOpen(true)} <div style={{marginTop: 20, marginBottom: 20,}}>
> <h2 style={{display: "inline",}}>App Authentication</h2>
Add environment <span style={{marginLeft: 25}}>Control the authentication options for individual apps. <b>Actions can be destructive!</b></span>
</div>
<Divider style={{marginTop: 20, marginBottom: 20, backgroundColor: inputColor}}/>
<List>
<ListItem>
<ListItemText
primary="Icon"
style={{minWidth: 150, maxWidth: 150}}
/>
<ListItemText
primary="Label"
style={{minWidth: 250, maxWidth: 250}}
/>
<ListItemText
primary="App Name"
style={{minWidth: 150, maxWidth: 150}}
/>
<ListItemText
primary="Workflows"
style={{minWidth: 150, maxWidth: 150, overflow: "hidden"}}
/>
<ListItemText
primary="Action amount"
style={{minWidth: 150, maxWidth: 150, overflow: "hidden"}}
/>
<ListItemText
primary="Fields"
style={{minWidth: 200, maxWidth: 200, overflow: "hidden"}}
/>
<ListItemText
primary="Actions"
/>
</ListItem>
{authentication === undefined ? null : authentication.map(data => {
return (
<ListItem>
<ListItemText
primary=<img alt="" src={data.app.large_image} style={{maxWidth: 50,}} />
style={{minWidth: 150, maxWidth: 150}}
/>
<ListItemText
primary={data.label}
style={{minWidth: 250, maxWidth: 250}}
/>
<ListItemText
primary={data.app.name}
style={{minWidth: 150, maxWidth: 150}}
/>
<ListItemText
primary={data.usage.length}
style={{minWidth: 150, maxWidth: 150, overflow: "hidden"}}
/>
<ListItemText
primary={data.node_count}
style={{minWidth: 150, maxWidth: 150, overflow: "hidden"}}
/>
<ListItemText
primary={data.fields.map(data => {
return data.key
}).join(", ")}
style={{minWidth: 200, maxWidth: 200, overflow: "hidden"}}
/>
<ListItemText>
<Button
style={{}}
variant="outlined"
color="primary"
onClick={() => {
deleteAuthentication(data)
}}
>
Delete
</Button>
</ListItemText>
</ListItem>
)
})}
</List>
</div>
: null
const environmentView = curTab === 2 ?
<div>
<div style={{marginTop: 20, marginBottom: 20,}}>
<h2 style={{display: "inline",}}>Environments</h2>
<span style={{marginLeft: 25}}>Decides what Orborus environment to execute an action in a workflow in.</span>
</div>
<Button
style={{}}
variant="contained"
color="primary"
onClick={() => setModalOpen(true)}
>
Add environment
</Button> </Button>
<Button <Button
style={{ marginLeft: 5, }} style={{marginLeft: 5, }}
variant="contained" variant="contained"
color="primary" color="primary"
onClick={() => getEnvironments()} onClick={() => getEnvironments()}
> >
<CachedIcon /> <CachedIcon />
</Button> </Button>
<Divider style={{ marginTop: 20, marginBottom: 20, backgroundColor: theme.palette.inputColor }} /> <Divider style={{marginTop: 20, marginBottom: 20, backgroundColor: inputColor}}/>
<List> <List>
<ListItem> <ListItem>
<ListItemText <ListItemText
primary="Name" primary="Name"
style={{ minWidth: 150, maxWidth: 150 }} style={{minWidth: 150, maxWidth: 150}}
/> />
<ListItemText <ListItemText
primary="Orborus running (TBD)" primary="Orborus running (TBD)"
style={{ minWidth: 200, maxWidth: 200 }} style={{minWidth: 200, maxWidth: 200}}
/> />
<ListItemText <ListItemText
primary="Actions" primary="Actions"
style={{ minWidth: 150, maxWidth: 150 }} style={{minWidth: 150, maxWidth: 150}}
/> />
</ListItem> </ListItem>
{environments === undefined ? null : environments.map(environment => { {environments === undefined ? null : environments.map(environment => {
return ( return (
<ListItem> <ListItem>
<ListItemText <ListItemText
primary={environment.Name} primary={environment.Name}
style={{ minWidth: 150, maxWidth: 150, overflow: "hidden" }} style={{minWidth: 150, maxWidth: 150, overflow: "hidden"}}
/> />
<ListItemText <ListItemText
primary={"TBD"} primary={"TBD"}
style={{ minWidth: 200, maxWidth: 200, overflow: "hidden" }} style={{minWidth: 200, maxWidth: 200, overflow: "hidden"}}
/> />
<ListItemText> <ListItemText>
<Button type="outlined" style={{ borderRadius: "0px" }} onClick={() => deleteEnvironment(environment.Name)} color="primary">Delete</Button> <Button variant="outlined" style={{borderRadius: "0px"}} onClick={() => deleteEnvironment(environment.Name)} color="primary">Delete</Button>
</ListItemText> </ListItemText>
</ListItem> </ListItem>
) )
})} })}
</List> </List>
</div> </div>
: null : null
// primary={environment.Registered ? "true" : "false"} const organizationsTab = curTab === 5 ?
<div>
<div style={{marginTop: 20, marginBottom: 20,}}>
<h2 style={{display: "inline",}}>Organizations</h2>
<span style={{marginLeft: 25}}>Global admin: control organizations</span>
</div>
<Button
style={{}}
variant="contained"
color="primary"
onClick={() => setModalOpen(true)}
>
Add organization
</Button>
<Divider style={{marginTop: 20, marginBottom: 20, backgroundColor: inputColor}}/>
<List>
<ListItem>
<ListItemText
primary="Name"
style={{minWidth: 150, maxWidth: 150}}
/>
<ListItemText
primary="Orborus running (TBD)"
style={{minWidth: 200, maxWidth: 200}}
/>
<ListItemText
primary="Actions"
style={{minWidth: 150, maxWidth: 150}}
/>
</ListItem>
<ListItem>
<ListItemText
primary="Enabled"
style={{minWidth: 150, maxWidth: 150}}
/>
<ListItemText
primary="false"
style={{minWidth: 200, maxWidth: 200}}
/>
<ListItemText
primary=<Switch checked={false} onChange={() => {console.log("INVERT")}} />
style={{minWidth: 150, maxWidth: 150}}
/>
</ListItem>
</List>
</div>
: null
const setConfig = (event, newValue) => { const hybridTab = curTab === 4 ?
if (newValue === 1) { <div>
getAppAuthentication() <div style={{marginTop: 20, marginBottom: 20,}}>
} else if (newValue === 2) { <h2 style={{display: "inline",}}>Hybrid</h2>
getEnvironments() <span style={{marginLeft: 25}}></span>
} else if (newValue === 3) { </div>
getSchedules() <Divider style={{marginTop: 20, marginBottom: 20, backgroundColor: inputColor}}/>
<List>
<ListItem>
<ListItemText
primary="Name"
style={{minWidth: 150, maxWidth: 150}}
/>
<ListItemText
primary="Orborus running (TBD)"
style={{minWidth: 200, maxWidth: 200}}
/>
<ListItemText
primary="Actions"
style={{minWidth: 150, maxWidth: 150}}
/>
</ListItem>
<ListItem>
<ListItemText
primary="Enabled"
style={{minWidth: 150, maxWidth: 150}}
/>
<ListItemText
primary="false"
style={{minWidth: 200, maxWidth: 200}}
/>
<ListItemText
primary=<Switch checked={false} onChange={() => {console.log("INVERT")}} />
style={{minWidth: 150, maxWidth: 150}}
/>
</ListItem>
</List>
</div>
: null
// primary={environment.Registered ? "true" : "false"}
const setConfig = (event, newValue) => {
if (newValue === 1) {
getAppAuthentication()
} else if (newValue === 2) {
getEnvironments()
} else if (newValue === 3) {
getSchedules()
}
setModalUser({})
setCurTab(newValue)
} }
setModalUser({}) const iconStyle = {marginRight: 10}
setCurTab(newValue) const data =
<div style={{minWidth: 1366, margin: "auto"}}>
<Paper style={paperStyle}>
<Tabs
value={curTab}
indicatorColor="primary"
onChange={setConfig}
aria-label="disabled tabs example"
>
<Tab label=<span><AccessibilityNewIcon style={iconStyle} />Users</span> />
<Tab label=<span><LockIcon style={iconStyle} />App Authentication</span>/>
<Tab label=<span><EcoIcon style={iconStyle} />Environments</span>/>
<Tab label=<span><ScheduleIcon style={iconStyle} />Schedules</span> />
{window.location.protocol == "http:" && window.location.port === "3000" ? <Tab label=<span><CloudIcon style={iconStyle} /> Hybrid</span>/> : null}
{window.location.protocol == "http:" && window.location.port === "3000" ? <Tab label=<span><BusinessIcon style={iconStyle} /> Organizations</span>/> : null}
</Tabs>
<Divider style={{marginTop: 0, marginBottom: 10, backgroundColor: "rgb(91, 96, 100)"}} />
<div style={{padding: 15}}>
{authenticationView}
{usersView}
{environmentView}
{schedulesView}
{hybridTab}
{organizationsTab}
</div>
</Paper>
</div>
return (
<div>
{modalView}
{editUserModal}
{editAuthenticationModal}
{data}
</div>
)
} }
const data = export default Admin
<div style={{ minWidth: 1366, margin: "auto" }}>
<Paper style={paperStyle}>
<Tabs
value={curTab}
indicatorColor="primary"
textColor="white"
onChange={setConfig}
aria-label="disabled tabs example"
>
<Tab label="Users" />
<Tab label="App Authentication" />
<Tab label="Environments" />
<Tab label="Schedules" />
</Tabs>
<Divider style={{ marginTop: 0, marginBottom: 10, backgroundColor: "rgb(91, 96, 100)" }} />
<div style={{ padding: 15 }}>
{authenticationView}
{usersView}
{environmentView}
{schedulesView}
</div>
</Paper>
</div>
return (
<div>
{modalView}
{editUserModal}
{editAuthenticationModal}
{data}
</div>
)
}
export default Admin;
+18 -13
View File
@@ -949,6 +949,10 @@ const AngularWorkflow = (props) => {
if (curaction.selectedAuthentication === null || curaction.selectedAuthentication === undefined || curaction.selectedAuthentication.length === "") { if (curaction.selectedAuthentication === null || curaction.selectedAuthentication === undefined || curaction.selectedAuthentication.length === "") {
curaction.selectedAuthentication = {} curaction.selectedAuthentication = {}
} }
} else {
curaction.authentication = []
curaction.authentication_id = ""
curaction.selectedAuthentication = {}
} }
setSelectedApp(curapp) setSelectedApp(curapp)
@@ -2997,7 +3001,7 @@ const AngularWorkflow = (props) => {
paddingLeft: 10, paddingLeft: 10,
minHeight: "100%", minHeight: "100%",
zIndex: 1000, zIndex: 1000,
resize: "horizontal", resize: "vertical",
overflow: "auto", overflow: "auto",
} }
@@ -3512,14 +3516,6 @@ const AngularWorkflow = (props) => {
<div style={{flex: "10"}}> <div style={{flex: "10"}}>
<b>{data.name} </b> <b>{data.name} </b>
</div> </div>
<Tooltip color="primary" title="Static data" placement="top">
<div style={{cursor: "pointer", color: staticcolor}} onClick={(e) => {
e.preventDefault()
changeActionParameterVariant("STATIC_VALUE")
}}>
<CreateIcon />
</div>
</Tooltip>
</div> </div>
{datafield} {datafield}
</div> </div>
@@ -3552,11 +3548,21 @@ const AngularWorkflow = (props) => {
<FormControl> <FormControl>
<DialogTitle><div style={{color:"white"}}>Condition</div></DialogTitle> <DialogTitle><div style={{color:"white"}}>Condition</div></DialogTitle>
<DialogContent style={{display: "flex"}}> <DialogContent style={{display: "flex"}}>
<Tooltip color="primary" title={conditionValue.configuration ? "Negated" : "Default"} placement="top">
<Button color="primary" variant={conditionValue.configuration ? "contained" : "outlined"} style={{margin: "auto", height: 50, marginBottom: 0, marginRight: 5}} onClick={(e) => {
console.log("VALUE: ", conditionValue.configuration)
conditionValue.configuration = !conditionValue.configuration
setConditionValue(conditionValue)
setUpdate("condition "+conditionValue.configuration)
}}>
{conditionValue.configuration ? "!" : "="}
</Button>
</Tooltip>
<div style={{flex: "2"}}> <div style={{flex: "2"}}>
<AppConditionHandler tmpdata={sourceValue} setData={setSourceValue} type={"source"} /> <AppConditionHandler tmpdata={sourceValue} setData={setSourceValue} type={"source"} />
</div> </div>
<div style={{flex: "1", margin: "auto", marginBottom: "0px"}}> <div style={{flex: "1", margin: "auto", marginBottom: 0, marginLeft: 5, marginRight: 5,}}>
<Button color="primary" variant="outlined" style={{height: "50px",}} fullWidth aria-haspopup="true" onClick={(e) => {setVariableAnchorEl(e.currentTarget)}}> <Button color="primary" variant="outlined" style={{height: "50px",}} fullWidth aria-haspopup="true" onClick={(e) => {setVariableAnchorEl(e.currentTarget)}}>
{conditionValue.value} {conditionValue.value}
</Button> </Button>
<Menu <Menu
@@ -3620,8 +3626,7 @@ const AngularWorkflow = (props) => {
setVariableAnchorEl(null) setVariableAnchorEl(null)
}} key={"less than"}>less than</MenuItem> }} key={"less than"}>less than</MenuItem>
</Menu> </Menu>
</div>
</div>
<div style={{flex: "2"}}> <div style={{flex: "2"}}>
<AppConditionHandler tmpdata={destinationValue} setData={setDestinationValue} type={"destination"} /> <AppConditionHandler tmpdata={destinationValue} setData={setDestinationValue} type={"destination"} />
</div> </div>
+15 -8
View File
@@ -286,7 +286,7 @@ const Apps = (props) => {
} }
return ( return (
<Paper square style={paperAppStyle} onClick={() => { <Paper square key={data.id} style={paperAppStyle} onClick={() => {
if (selectedApp.id !== data.id) { if (selectedApp.id !== data.id) {
setSelectedApp(data) setSelectedApp(data)
console.log(data) console.log(data)
@@ -515,7 +515,7 @@ const Apps = (props) => {
newActionname = newActionname.replace("_", " ") newActionname = newActionname.replace("_", " ")
newActionname = newActionname.charAt(0).toUpperCase()+newActionname.substring(1) newActionname = newActionname.charAt(0).toUpperCase()+newActionname.substring(1)
return ( return (
<MenuItem style={{backgroundColor: inputColor, color: "white"}} value={data}> <MenuItem key={data.name} style={{backgroundColor: inputColor, color: "white"}} value={data}>
{newActionname} {newActionname}
</MenuItem> </MenuItem>
@@ -540,7 +540,7 @@ const Apps = (props) => {
const circleSize = 10 const circleSize = 10
return ( return (
<MenuItem style={{backgroundColor: inputColor, color: "white"}} value={data}> <MenuItem key={data.name} style={{backgroundColor: inputColor, color: "white"}} value={data}>
<div style={{width: circleSize, height: circleSize, borderRadius: circleSize / 2, backgroundColor: itemColor, marginRight: "10px"}}/> <div style={{width: circleSize, height: circleSize, borderRadius: circleSize / 2, backgroundColor: itemColor, marginRight: "10px"}}/>
{data.name} {data.name}
@@ -743,7 +743,7 @@ const Apps = (props) => {
null null
// Load data e.g. from github // Load data e.g. from github
const getSpecificApps = (url) => { const getSpecificApps = (url, forceUpdate) => {
setValidation(true) setValidation(true)
setIsLoading(true) setIsLoading(true)
@@ -761,6 +761,8 @@ const Apps = (props) => {
parsedData["field_2"] = field2 parsedData["field_2"] = field2
} }
parsedData["force_update"] = forceUpdate
alert.success("Getting specific apps from your URL.") alert.success("Getting specific apps from your URL.")
var cors = "cors" var cors = "cors"
fetch(globalUrl+"/api/v1/apps/get_existing", { fetch(globalUrl+"/api/v1/apps/get_existing", {
@@ -977,8 +979,8 @@ const Apps = (props) => {
window.location.href = "/apps/new?id="+appValidation window.location.href = "/apps/new?id="+appValidation
} }
const handleGithubValidation = () => { const handleGithubValidation = (forceUpdate) => {
getSpecificApps(openApi) getSpecificApps(openApi, forceUpdate)
setLoadAppsModalOpen(false) setLoadAppsModalOpen(false)
} }
@@ -1034,7 +1036,7 @@ const Apps = (props) => {
> >
<DialogTitle> <DialogTitle>
<div style={{color: "rgba(255,255,255,0.9)"}}> <div style={{color: "rgba(255,255,255,0.9)"}}>
Load from github repo Load from github repo
</div> </div>
</DialogTitle> </DialogTitle>
<DialogContent style={{color: "rgba(255,255,255,0.65)"}}> <DialogContent style={{color: "rgba(255,255,255,0.65)"}}>
@@ -1098,7 +1100,12 @@ const Apps = (props) => {
Cancel Cancel
</Button> </Button>
<Button style={{borderRadius: "0px"}} disabled={openApi.length === 0 || !openApi.includes("http")} onClick={() => { <Button style={{borderRadius: "0px"}} disabled={openApi.length === 0 || !openApi.includes("http")} onClick={() => {
handleGithubValidation() handleGithubValidation(true)
}} color="primary">
Force update
</Button>
<Button variant="outlined" style={{float: "left", borderRadius: "0px"}} disabled={openApi.length === 0 || !openApi.includes("http")} onClick={() => {
handleGithubValidation(false)
}} color="primary"> }} color="primary">
Submit Submit
</Button> </Button>
+1
View File
@@ -163,6 +163,7 @@ const LoginDialog = props => {
// <DialogTitle>{formtitle}</DialogTitle> // <DialogTitle>{formtitle}</DialogTitle>
console.log("THEME: ", theme.palette.surfaceColor)
const basedata = const basedata =
<div style={bodyDivStyle}> <div style={bodyDivStyle}>
<Paper style={{ <Paper style={{
+15 -27
View File
@@ -7,23 +7,11 @@ import {Link} from 'react-router-dom';
import TextField from '@material-ui/core/TextField'; import TextField from '@material-ui/core/TextField';
import { useAlert } from "react-alert"; import { useAlert } from "react-alert";
import { useTheme } from '@material-ui/core/styles';
//const tmpdata = {
// "username": "frikky",
// "firstname": "fred",
// "lastname": "ode",
// "title": "topkek",
// "companyname": "company here",
// "email": "your email pls",
// "phone": "PHONE!!",
//}
// FIXME - add fetch for data fields
// FIXME - remove tmpdata
// FIXME: Use isLoggedIn :)
const Settings = (props) => { const Settings = (props) => {
const { globalUrl, isLoaded, userdata, surfaceColor, inputColor } = props; const { globalUrl, isLoaded, userdata, } = props;
const theme = useTheme();
const alert = useAlert() const alert = useAlert()
const [username, setUsername] = useState(""); const [username, setUsername] = useState("");
@@ -61,7 +49,7 @@ const Settings = (props) => {
paddingRight: "30px", paddingRight: "30px",
paddingBottom: "30px", paddingBottom: "30px",
paddingTop: "30px", paddingTop: "30px",
backgroundColor: surfaceColor, backgroundColor: theme.palette.surfaceColor,
display: "flex", display: "flex",
flexDirection: "column" flexDirection: "column"
} }
@@ -190,7 +178,7 @@ const Settings = (props) => {
<h2>APIKEY</h2> <h2>APIKEY</h2>
<Link to="/docs/API#authentication" style={{textDecoration: "none", color: "#f85a3e"}}>What is the API key used for?</Link> <Link to="/docs/API#authentication" style={{textDecoration: "none", color: "#f85a3e"}}>What is the API key used for?</Link>
<TextField <TextField
style={{backgroundColor: inputColor, flex: "1"}} style={{backgroundColor: theme.palette.inputColor, flex: "1"}}
InputProps={{ InputProps={{
style:{ style:{
height: "50px", height: "50px",
@@ -218,7 +206,7 @@ const Settings = (props) => {
<h2>Settings</h2> <h2>Settings</h2>
<div style={{flex: "1", display: "flex", flexDirection: "row"}}> <div style={{flex: "1", display: "flex", flexDirection: "row"}}>
<TextField <TextField
style={{backgroundColor: inputColor, flex: "1"}} style={{backgroundColor: theme.palette.inputColor, flex: "1"}}
InputProps={{ InputProps={{
style:{ style:{
height: "50px", height: "50px",
@@ -240,7 +228,7 @@ const Settings = (props) => {
</div> </div>
<div style={{flex: "1", display: "flex", flexDirection: "row"}}> <div style={{flex: "1", display: "flex", flexDirection: "row"}}>
<TextField <TextField
style={{backgroundColor: inputColor, flex: "1", marginRight: "15px"}} style={{backgroundColor: theme.palette.inputColor, flex: "1", marginRight: "15px"}}
InputProps={{ InputProps={{
style:{ style:{
height: "50px", height: "50px",
@@ -260,7 +248,7 @@ const Settings = (props) => {
onChange={e => setFirstname(e.target.value)} onChange={e => setFirstname(e.target.value)}
/> />
<TextField <TextField
style={{backgroundColor: inputColor, flex: "1", marginLeft: "15px"}} style={{backgroundColor: theme.palette.inputColor, flex: "1", marginLeft: "15px"}}
InputProps={{ InputProps={{
style:{ style:{
height: "50px", height: "50px",
@@ -282,7 +270,7 @@ const Settings = (props) => {
</div> </div>
<div style={{flex: "1", display: "flex", flexDirection: "row"}}> <div style={{flex: "1", display: "flex", flexDirection: "row"}}>
<TextField <TextField
style={{backgroundColor: inputColor, flex: "1", marginRight: "15px",}} style={{backgroundColor: theme.palette.inputColor, flex: "1", marginRight: "15px",}}
InputProps={{ InputProps={{
style:{ style:{
height: "50px", height: "50px",
@@ -302,7 +290,7 @@ const Settings = (props) => {
onChange={e => setTitle(e.target.value)} onChange={e => setTitle(e.target.value)}
/> />
<TextField <TextField
style={{backgroundColor: inputColor, flex: "1", marginLeft: "15px"}} style={{backgroundColor: theme.palette.inputColor, flex: "1", marginLeft: "15px"}}
InputProps={{ InputProps={{
style:{ style:{
height: "50px", height: "50px",
@@ -324,7 +312,7 @@ const Settings = (props) => {
</div> </div>
<div style={{flex: "1", display: "flex", flexDirection: "row"}}> <div style={{flex: "1", display: "flex", flexDirection: "row"}}>
<TextField <TextField
style={{backgroundColor: inputColor, flex: "1", marginRight: "15px",}} style={{backgroundColor: theme.palette.inputColor, flex: "1", marginRight: "15px",}}
InputProps={{ InputProps={{
style:{ style:{
height: "50px", height: "50px",
@@ -344,7 +332,7 @@ const Settings = (props) => {
onChange={e => setEmail(e.target.value)} onChange={e => setEmail(e.target.value)}
/> />
<TextField <TextField
style={{backgroundColor: inputColor, flex: "1", marginLeft: "15px",}} style={{backgroundColor: theme.palette.inputColor, flex: "1", marginLeft: "15px",}}
InputProps={{ InputProps={{
style:{ style:{
height: "50px", height: "50px",
@@ -379,7 +367,7 @@ const Settings = (props) => {
<h2>Password</h2> <h2>Password</h2>
<div style={{flex: "1", display: "flex", flexDirection: "row"}}> <div style={{flex: "1", display: "flex", flexDirection: "row"}}>
<TextField <TextField
style={{backgroundColor: inputColor, flex: "1"}} style={{backgroundColor: theme.palette.inputColor, flex: "1"}}
InputProps={{ InputProps={{
style:{ style:{
height: "50px", height: "50px",
@@ -400,7 +388,7 @@ const Settings = (props) => {
</div> </div>
<div style={{flex: "1", display: "flex", flexDirection: "row"}}> <div style={{flex: "1", display: "flex", flexDirection: "row"}}>
<TextField <TextField
style={{backgroundColor: inputColor, flex: "1", marginRight: "15px",}} style={{backgroundColor: theme.palette.inputColor, flex: "1", marginRight: "15px",}}
InputProps={{ InputProps={{
style:{ style:{
height: "50px", height: "50px",
@@ -419,7 +407,7 @@ const Settings = (props) => {
onChange={e => setNewPassword(e.target.value)} onChange={e => setNewPassword(e.target.value)}
/> />
<TextField <TextField
style={{backgroundColor: inputColor, flex: "1", marginLeft: "15px",}} style={{backgroundColor: theme.palette.inputColor, flex: "1", marginLeft: "15px",}}
InputProps={{ InputProps={{
style:{ style:{
height: "50px", height: "50px",
+1 -1
View File
@@ -563,7 +563,7 @@ const Workflows = (props) => {
} }
return ( return (
<Paper square style={resultPaperAppStyle} onClick={() => {}}> <Paper key={data.id} square style={resultPaperAppStyle} onClick={() => {}}>
<div style={{marginLeft: "10px", marginTop: "5px", marginBottom: "5px", marginRight: "5px", width: boxWidth, backgroundColor: boxColor}}> <div style={{marginLeft: "10px", marginTop: "5px", marginBottom: "5px", marginRight: "5px", width: boxWidth, backgroundColor: boxColor}}>
</div> </div>
<Grid container style={{margin: "10px 10px 10px 10px", flex: "1"}}> <Grid container style={{margin: "10px 10px 10px 10px", flex: "1"}}>
+15 -13
View File
@@ -78,10 +78,11 @@ func init() {
// Skip random containers. Only handle things related to Shuffle. // Skip random containers. Only handle things related to Shuffle.
for _, container := range containers { for _, container := range containers {
found := false found := false
//log.Printf("Running? %#v", container)
if container.State != "running" { // Bad states - it might just be created sometimes, leading to now netowkr
continue //if container.State == "restarting" || container.State == "paused" || container.State == "exited" || container.State == "dead" {
} // continue
//}
for _, name := range container.Names { for _, name := range container.Names {
if !strings.Contains(strings.ToLower(name), containerIdentifier) { if !strings.Contains(strings.ToLower(name), containerIdentifier) {
@@ -120,17 +121,10 @@ func deployWorker(image string, identifier string, env []string) {
}, },
} }
// ROFL: https://docker-py.readthedocs.io/en/1.4.0/volumes/
config := &container.Config{
Image: image,
Env: env,
}
// Look for Shuffle network and set it // Look for Shuffle network and set it
// FIXME: Move this out of here and have it be a global setting. During init?
networkConfig := &network.NetworkingConfig{} networkConfig := &network.NetworkingConfig{}
if len(shuffleNetwork) > 0 { if len(shuffleNetwork) > 0 {
log.Printf("Starting worker with network %s", shuffleNetwork)
networkConfig = &network.NetworkingConfig{ networkConfig = &network.NetworkingConfig{
EndpointsConfig: map[string]*network.EndpointSettings{ EndpointsConfig: map[string]*network.EndpointSettings{
shuffleNetwork: { shuffleNetwork: {
@@ -139,7 +133,15 @@ func deployWorker(image string, identifier string, env []string) {
}, },
} }
env = append(env, fmt.Sprintf("DOCKER_NETWORK", shuffleNetwork)) env = append(env, fmt.Sprintf("DOCKER_NETWORK=%s", shuffleNetwork))
} else {
log.Printf("Starting worker WITHOUT any specified network: %s", shuffleNetwork)
}
// ROFL: https://docker-py.readthedocs.io/en/1.4.0/volumes/
config := &container.Config{
Image: image,
Env: env,
} }
//test := &network.EndpointSettings{ //test := &network.EndpointSettings{
+7
View File
@@ -1107,6 +1107,13 @@ func main() {
} }
} }
shuffleNetwork := os.Getenv("DOCKER_NETWORK")
if len(shuffleNetwork) > 0 {
log.Printf("Running with Docker network %s", shuffleNetwork)
} else {
log.Printf("No docker network specified for Worker.")
}
// WORKER_TESTING_WORKFLOW should be a workflow ID // WORKER_TESTING_WORKFLOW should be a workflow ID
authorization := "" authorization := ""
executionId := "" executionId := ""