Added App Auth name editing and dynamic auth during workflow run

This commit is contained in:
Frikky
2023-12-18 13:40:39 +01:00
parent c3dc377f7f
commit 8cfba1ac30
4 changed files with 61 additions and 11 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ require (
github.com/gorilla/mux v1.8.0 github.com/gorilla/mux v1.8.0
github.com/h2non/filetype v1.1.3 github.com/h2non/filetype v1.1.3
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0
github.com/shuffle/shuffle-shared v0.5.31 github.com/shuffle/shuffle-shared v0.5.44
golang.org/x/crypto v0.14.0 golang.org/x/crypto v0.14.0
google.golang.org/api v0.125.0 google.golang.org/api v0.125.0
google.golang.org/grpc v1.55.0 google.golang.org/grpc v1.55.0
+2
View File
@@ -426,6 +426,8 @@ github.com/shuffle/shuffle-shared v0.5.30 h1:ORWjQU3UJhdZY5mRsAoR2hvftNcJmiEekNK
github.com/shuffle/shuffle-shared v0.5.30/go.mod h1:X613gbo0dT3fnYvXDRwjQZyLC+T49T2nSQOrCV5QMlI= github.com/shuffle/shuffle-shared v0.5.30/go.mod h1:X613gbo0dT3fnYvXDRwjQZyLC+T49T2nSQOrCV5QMlI=
github.com/shuffle/shuffle-shared v0.5.31 h1:OV4IIfKWWFW66WjGvyXOmmsSz3p8pW9L1ge1mDo8ftM= github.com/shuffle/shuffle-shared v0.5.31 h1:OV4IIfKWWFW66WjGvyXOmmsSz3p8pW9L1ge1mDo8ftM=
github.com/shuffle/shuffle-shared v0.5.31/go.mod h1:X613gbo0dT3fnYvXDRwjQZyLC+T49T2nSQOrCV5QMlI= github.com/shuffle/shuffle-shared v0.5.31/go.mod h1:X613gbo0dT3fnYvXDRwjQZyLC+T49T2nSQOrCV5QMlI=
github.com/shuffle/shuffle-shared v0.5.44 h1:6WiFPIsij+IWvXY7vzVX7cUicb+PYOzhTbWF/gDmYeU=
github.com/shuffle/shuffle-shared v0.5.44/go.mod h1:X613gbo0dT3fnYvXDRwjQZyLC+T49T2nSQOrCV5QMlI=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
+57 -10
View File
@@ -748,11 +748,20 @@ If you're interested, please let me know a time that works for you, or set up a
.then((response) => .then((response) =>
response.json().then((responseJson) => { response.json().then((responseJson) => {
if (responseJson["success"] === false) { if (responseJson["success"] === false) {
toast("Failed changing authentication"); // Check if .reason exists
if (responseJson.reason !== undefined) {
toast("Failed changing authentication: " + responseJson.reason);
} else {
toast("Failed changing authentication");
}
} else { } else {
//toast("Successfully password!") //toast("Successfully password!")
setSelectedUserModalOpen(false); setSelectedUserModalOpen(false);
getAppAuthentication(); getAppAuthentication();
setSelectedAuthentication({});
setSelectedAuthenticationModalOpen(false);
} }
}) })
) )
@@ -813,7 +822,8 @@ If you're interested, please let me know a time that works for you, or set up a
const data = { const data = {
id: id, id: id,
action: parentAction !== undefined && parentAction !== null ? parentAction : "assign_everywhere", action: parentAction !== undefined && parentAction !== null ? parentAction : "assign_everywhere",
}; }
const url = globalUrl + "/api/v1/apps/authentication/" + id + "/config"; const url = globalUrl + "/api/v1/apps/authentication/" + id + "/config";
fetch(url, { fetch(url, {
@@ -1798,17 +1808,53 @@ If you're interested, please let me know a time that works for you, or set up a
> >
<DialogTitle> <DialogTitle>
<span style={{ color: "white" }}> <span style={{ color: "white" }}>
Edit authentication for {selectedAuthentication.app.name} ( Edit authentication for {selectedAuthentication.app.name.replaceAll("_", " ")} (
{selectedAuthentication.label}) {selectedAuthentication.label})
</span> </span>
<Typography variant="body1" color="textSecondary" style={{marginTop: 10}}>
You can not see the previous values for an authentication while editing. This is to keep your data secure. You can overwrite one- or multiple fields at a time.
</Typography>
</DialogTitle> </DialogTitle>
<DialogContent> <DialogContent>
<Typography style={{ marginBottom: 0, marginTop: 10 }}>
Authentication Label
</Typography>
<TextField
style={{
backgroundColor: theme.palette.inputColor,
marginTop: 0,
}}
InputProps={{
style: {
height: 50,
color: "white",
},
}}
color="primary"
required
fullWidth={true}
placeholder={selectedAuthentication.label}
defaultValue={selectedAuthentication.label}
type="text"
margin="normal"
variant="outlined"
onChange={(e) => {
selectedAuthentication.label = e.target.value
}}
/>
<Divider />
{selectedAuthentication.fields.map((data, index) => { {selectedAuthentication.fields.map((data, index) => {
var fieldname = data.key.replaceAll("_", " ")
if (fieldname.endsWith(" basic")) {
fieldname = fieldname.substring(0, fieldname.length - 6)
}
//console.log("DATA: ", data, selectedAuthentication) //console.log("DATA: ", data, selectedAuthentication)
return ( return (
<div key={index}> <div key={index}>
<Typography style={{ marginBottom: 0, marginTop: 10 }}> <Typography style={{ marginBottom: 0, marginTop: 10 }}>
{data.key} {fieldname}
</Typography> </Typography>
<TextField <TextField
style={{ style={{
@@ -1824,7 +1870,7 @@ If you're interested, please let me know a time that works for you, or set up a
color="primary" color="primary"
required required
fullWidth={true} fullWidth={true}
placeholder={data.key} placeholder={fieldname}
type="text" type="text"
id={`authentication-${index}`} id={`authentication-${index}`}
margin="normal" margin="normal"
@@ -1851,9 +1897,11 @@ If you're interested, please let me know a time that works for you, or set up a
style={{ borderRadius: "0px" }} style={{ borderRadius: "0px" }}
onClick={() => { onClick={() => {
var error = false; var error = false;
var fails = 0
for (var key in authenticationFields) { for (var key in authenticationFields) {
const item = authenticationFields[key]; const item = authenticationFields[key];
if (item.value.length === 0) { if (item.value.length === 0) {
fails += 1
console.log("ITEM: ", item); console.log("ITEM: ", item);
//var currentnode = cy.getElementById(data.id) //var currentnode = cy.getElementById(data.id)
var textfield = document.getElementById( var textfield = document.getElementById(
@@ -1866,14 +1914,13 @@ If you're interested, please let me know a time that works for you, or set up a
} }
} }
if (error) { if (error && fails === authenticationFields.length) {
toast("All fields must have a new value"); toast("Updating auth with new name only")
saveAuthentication(selectedAuthentication);
} else { } else {
toast("Saving new version of this authentication"); toast("Saving new version of this authentication");
selectedAuthentication.fields = authenticationFields; selectedAuthentication.fields = authenticationFields;
saveAuthentication(selectedAuthentication); saveAuthentication(selectedAuthentication);
setSelectedAuthentication({});
setSelectedAuthenticationModalOpen(false);
} }
}} }}
color="primary" color="primary"
@@ -3732,7 +3779,7 @@ If you're interested, please let me know a time that works for you, or set up a
}} }}
/> />
<ListItemText <ListItemText
primary={data.app.name} primary={data.app.name.replaceAll("_", " ")}
style={{ minWidth: 175, maxWidth: 175, marginLeft: 10 }} style={{ minWidth: 175, maxWidth: 175, marginLeft: 10 }}
/> />
{/* {/*
+1
View File
@@ -1824,6 +1824,7 @@ const AngularWorkflow = (defaultprops) => {
setExecutionModalOpen(true); setExecutionModalOpen(true);
setExecutionModalView(1); setExecutionModalView(1);
start(); start();
navigate(`/workflows/${props.match.params.key}?execution_id=${responseJson.execution_id}`)
}) })
.catch((error) => { .catch((error) => {
//toast(error.toString()); //toast(error.toString());