Fixed issues with string and json parsing in SDK

This commit is contained in:
frikky
2021-04-02 21:57:02 +02:00
parent ab5c0d82b9
commit 63db013438
10 changed files with 177 additions and 58 deletions
+73 -29
View File
@@ -474,6 +474,39 @@ const Admin = (props) => {
});
}
const inviteUser = (data) => {
console.log("INPUT: ", data)
setLoginInfo("")
// Just use this one?
var data = { "username": data.Username, "type": "invite", "org_id": selectedOrganization.id}
var baseurl = globalUrl
const url = baseurl + '/api/v1/users/register_org';
fetch(url, {
method: 'POST',
credentials: "include",
body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json',
},
})
.then(response =>
response.json().then(responseJson => {
if (responseJson["success"] === false) {
setLoginInfo("Error: " + responseJson.reason)
} else {
setLoginInfo("")
setModalOpen(false)
getUsers()
}
}),
)
.catch(error => {
console.log("Error in userdata: ", error)
});
}
const submitUser = (data) => {
console.log("INPUT: ", data)
setLoginInfo("")
@@ -1689,6 +1722,11 @@ const Admin = (props) => {
{curTab === 1 ? "Add user" : "Add environment"}
</span></DialogTitle>
<DialogContent>
{curTab === 1 && isCloud ?
<Typography variant="body1" style={{marginBottom: 10}}>
We'll send an email to invite them to your organization.
</Typography>
: null}
{curTab === 1 ?
<div>
Username
@@ -1712,32 +1750,36 @@ const Admin = (props) => {
variant="outlined"
onChange={(event) => changeModalData("Username", event.target.value)}
/>
Password
<TextField
color="primary"
style={{ backgroundColor: theme.palette.inputColor }}
InputProps={{
style: {
height: "50px",
color: "white",
fontSize: "1em",
},
}}
required
fullWidth={true}
autoComplete="password"
type="password"
placeholder="********"
id="pwfield"
margin="normal"
variant="outlined"
onChange={(event) => changeModalData("Password", event.target.value)}
/>
{isCloud ? null :
<span>
Password
<TextField
color="primary"
style={{ backgroundColor: theme.palette.inputColor }}
InputProps={{
style: {
height: "50px",
color: "white",
fontSize: "1em",
},
}}
required
fullWidth={true}
autoComplete="password"
type="password"
placeholder="********"
id="pwfield"
margin="normal"
variant="outlined"
onChange={(event) => changeModalData("Password", event.target.value)}
/>
</span>
}
</div>
: curTab === 3 ?
: curTab === 5 ?
<div>
Environment Name
<TextField
<TextField
color="primary"
style={{ backgroundColor: theme.palette.inputColor }}
autoFocus
@@ -1766,8 +1808,12 @@ const Admin = (props) => {
</Button>
<Button variant="contained" style={{ borderRadius: "0px" }} onClick={() => {
if (curTab === 1) {
submitUser(modalUser)
} else if (curTab === 3) {
if (isCloud) {
inviteUser(modalUser)
} else {
submitUser(modalUser)
}
} else if (curTab === 5) {
submitEnvironment(modalUser)
}
}} color="primary">
@@ -2353,9 +2399,7 @@ const Admin = (props) => {
style={{minWidth: 110, maxWidth: 110, overflow: "hidden"}}
/>
<ListItemText
primary={data.fields.map(data => {
return data.key
}).join(", ")}
primary={data.fields === null || data.fields === undefined ? "" : data.fields.map(data => {return data.key}).join(", ")}
style={{minWidth: 200, maxWidth: 200, overflow: "hidden"}}
/>
<ListItemText>
@@ -2651,7 +2695,7 @@ const Admin = (props) => {
<Tab label=<span><LockIcon style={iconStyle} />App Authentication</span>/>
<Tab label=<span><DescriptionIcon style={iconStyle} />Files</span> />
<Tab label=<span><ScheduleIcon style={iconStyle} />Schedules</span> />
{isCloud ? null : <Tab label=<span><EcoIcon style={iconStyle} />Environments</span>/>}
{/*isCloud ? null : <Tab label=<span><EcoIcon style={iconStyle} />Environments</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}
{window.location.protocol === "http:" && window.location.port === "3000" ? <Tab label=<span><LockIcon style={iconStyle} />Categories</span>/> : null}
+2 -1
View File
@@ -501,7 +501,8 @@ const AppCreator = (props) => {
}
if (!allowedfunctions.includes(method.toUpperCase())) {
alert.info("Skipped method (not allowed) "+method)
console.log("Invalid method: ", method, "data: ", methodvalue)
alert.info("Skipped method (not allowed): "+method)
continue
}
+48 -2
View File
@@ -166,6 +166,7 @@ const Workflows = (props) => {
const [newWorkflowTags, setNewWorkflowTags] = React.useState([]);
const [update, setUpdate] = React.useState("test");
const [deleteModalOpen, setDeleteModalOpen] = React.useState(false);
const [publishModalOpen, setPublishModalOpen] = React.useState(false);
const [editingWorkflow, setEditingWorkflow] = React.useState({})
const [executionLoading, setExecutionLoading] = React.useState(false)
const [importLoading, setImportLoading] = React.useState(false)
@@ -246,6 +247,49 @@ const Workflows = (props) => {
findWorkflow(newfilters)
}
const publishModal = publishModalOpen ?
<Dialog
open={publishModalOpen}
onClose={() => {
setPublishModalOpen(false)
setSelectedWorkflow({})
}}
PaperProps={{
style: {
backgroundColor: surfaceColor,
color: "white",
minWidth: 500,
padding: 50,
},
}}
>
<DialogTitle style={{marginBottom: 0, }}>
<div style={{textAlign: "center", color: "rgba(255,255,255,0.9)"}}>
Are you sure you want to PUBLISH this workflow?
</div>
</DialogTitle>
<DialogContent style={{color: "rgba(255,255,255,0.65)", textAlign: "center"}}>
<div>
<Typography variant="body1" style={{marginBottom: 20,}}>
Before publishing, we will sanitize all inputs, remove references to you, randomize ID's and remove your authentication.
</Typography>
</div>
<Button variant="contained" style={{}} onClick={() => {
publishWorkflow(selectedWorkflow)
setPublishModalOpen(false)
}} color="primary">
Yes
</Button>
<Button style={{}} onClick={() => {
setPublishModalOpen(false)
}} color="primary">
No
</Button>
</DialogContent>
</Dialog>
: null
const deleteModal = deleteModalOpen ?
<Dialog
open={deleteModalOpen}
@@ -263,7 +307,7 @@ const Workflows = (props) => {
>
<DialogTitle>
<div style={{textAlign: "center", color: "rgba(255,255,255,0.9)"}}>
Are you sure? <div/>Other workflows relying on this one may stop working
Are you sure you want to delete this workflow? <div/>Other workflows relying on this one may stop working
</div>
</DialogTitle>
<DialogContent style={{color: "rgba(255,255,255,0.65)", textAlign: "center"}}>
@@ -888,7 +932,8 @@ const Workflows = (props) => {
{"Change details"}
</MenuItem>
<MenuItem style={{backgroundColor: inputColor, color: "white"}} onClick={() => {
publishWorkflow(data)
setSelectedWorkflow(data)
setPublishModalOpen(true)
}} key={"publish"}>
<CloudUploadIcon style={{marginLeft: 0, marginRight: 8}}/>
{"Publish Workflow"}
@@ -1830,6 +1875,7 @@ const Workflows = (props) => {
</Dropzone>
{modalView}
{deleteModal}
{publishModal}
{workflowDownloadModalOpen}
</div>
: