Added basic #670 (intuitive loops) fix, magic formatting for code editor and small oauth2 fixes for workflows and app creator
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
docker stop shuffle-frontend
|
docker stop shuffle-frontend
|
||||||
docker rm shuffle-frontend
|
docker rm shuffle-frontend
|
||||||
docker rmi frikky/shuffle:frontend
|
#docker rmi ghcr.io/frikky/shuffle-frontend:nightly
|
||||||
|
|
||||||
echo "Running build for website"
|
echo "Running build for website"
|
||||||
#sudo npm run build
|
#sudo npm run build
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ const ParsedAction = (props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const changeActionParameter = (event, count, data) => {
|
const changeActionParameter = (event, count, data) => {
|
||||||
//console.log(event)
|
console.log("Action change: ", selectedAction, data)
|
||||||
if (data.name.startsWith("${") && data.name.endsWith("}")) {
|
if (data.name.startsWith("${") && data.name.endsWith("}")) {
|
||||||
// PARAM FIX - Gonna use the ID field, even though it's a hack
|
// PARAM FIX - Gonna use the ID field, even though it's a hack
|
||||||
const paramcheck = selectedAction.parameters.find(
|
const paramcheck = selectedAction.parameters.find(
|
||||||
@@ -638,6 +638,7 @@ const ParsedAction = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (event.target.value[event.target.value.length - 1] === "$") {
|
if (event.target.value[event.target.value.length - 1] === "$") {
|
||||||
if (!showDropdown) {
|
if (!showDropdown) {
|
||||||
setShowAutocomplete(false);
|
setShowAutocomplete(false);
|
||||||
@@ -736,8 +737,32 @@ const ParsedAction = (props) => {
|
|||||||
//console.log("CHANGING ACTION COUNT !")
|
//console.log("CHANGING ACTION COUNT !")
|
||||||
selectedActionParameters[count].value = event.target.value;
|
selectedActionParameters[count].value = event.target.value;
|
||||||
selectedAction.parameters[count].value = event.target.value;
|
selectedAction.parameters[count].value = event.target.value;
|
||||||
|
|
||||||
|
var forceUpdate = false
|
||||||
|
if (selectedAction.app_name === "Shuffle Tools" && selectedAction.name === "filter_list" && data.name === "input_list") {
|
||||||
|
//console.log("FILTER LIST!: ", event, count, data)
|
||||||
|
const parsedvalue = event.target.value
|
||||||
|
if (parsedvalue.includes("#")) {
|
||||||
|
const splitparsed = parsedvalue.split(".#.")
|
||||||
|
//console.log("Cant contain #: ", splitparsed)
|
||||||
|
if (splitparsed.length > 1) {
|
||||||
|
data.value = splitparsed[0]
|
||||||
|
|
||||||
|
selectedActionParameters[count].value = splitparsed[0]
|
||||||
|
selectedAction.parameters[count].value = splitparsed[0]
|
||||||
|
|
||||||
|
//changeActionParameter({target: {value: splitparsed[1]}},
|
||||||
|
selectedActionParameters[1].value = splitparsed[1]
|
||||||
|
selectedAction.parameters[1].value = splitparsed[1]
|
||||||
|
forceUpdate = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setSelectedAction(selectedAction);
|
setSelectedAction(selectedAction);
|
||||||
//setUpdate(Math.random())
|
if (forceUpdate) {
|
||||||
|
setUpdate(Math.random())
|
||||||
|
}
|
||||||
//setUpdate(event.target.value)
|
//setUpdate(event.target.value)
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1288,6 +1313,8 @@ const ParsedAction = (props) => {
|
|||||||
//<TextareaAutosize
|
//<TextareaAutosize
|
||||||
// <CodeMirror
|
// <CodeMirror
|
||||||
//fullWidth
|
//fullWidth
|
||||||
|
|
||||||
|
|
||||||
var datafield = (
|
var datafield = (
|
||||||
<TextField
|
<TextField
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
@@ -1887,11 +1914,12 @@ const ParsedAction = (props) => {
|
|||||||
).replaceAll("_", " ");
|
).replaceAll("_", " ");
|
||||||
|
|
||||||
if (tmpitem === "Username basic") {
|
if (tmpitem === "Username basic") {
|
||||||
tmpitem = "Username";
|
tmpitem = "Username"
|
||||||
} else if (tmpitem === "Password basic") {
|
} else if (tmpitem === "Password basic") {
|
||||||
tmpitem = "Password";
|
tmpitem = "Password"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const description =
|
const description =
|
||||||
data.description === undefined ? "" : data.description;
|
data.description === undefined ? "" : data.description;
|
||||||
const tooltipDescription = (
|
const tooltipDescription = (
|
||||||
@@ -2447,10 +2475,10 @@ const ParsedAction = (props) => {
|
|||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{selectedApp.name !== undefined &&
|
{selectedApp.name !== undefined &&
|
||||||
selectedAction.authentication !== null &&
|
selectedAction.authentication !== null &&
|
||||||
selectedAction.authentication !== undefined &&
|
selectedAction.authentication !== undefined &&
|
||||||
selectedAction.authentication.length === 0 &&
|
selectedAction.authentication.length === 0 &&
|
||||||
requiresAuthentication ? (
|
requiresAuthentication ? (
|
||||||
<div style={{ marginTop: 15 }}>
|
<div style={{ marginTop: 15 }}>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
color="primary"
|
color="primary"
|
||||||
@@ -2480,8 +2508,8 @@ const ParsedAction = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
{selectedAction.authentication !== undefined &&
|
{selectedAction.authentication !== undefined &&
|
||||||
selectedAction.authentication !== null &&
|
selectedAction.authentication !== null &&
|
||||||
selectedAction.authentication.length > 0 ? (
|
selectedAction.authentication.length > 0 ? (
|
||||||
<div style={{ marginTop: 15 }}>
|
<div style={{ marginTop: 15 }}>
|
||||||
<Typography>Authentication</Typography>
|
<Typography>Authentication</Typography>
|
||||||
<div style={{ display: "flex" }}>
|
<div style={{ display: "flex" }}>
|
||||||
|
|||||||
@@ -11291,7 +11291,7 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
color="primary"
|
color="primary"
|
||||||
title="See executions with similar results (not identical)"
|
title="See executions with similar results (not identical)"
|
||||||
placement="top"
|
placement="top"
|
||||||
style={{ zIndex: 50000, marginLeft: 20,}}
|
style={{ zIndex: 50000, marginLeft: 50,}}
|
||||||
>
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -663,10 +663,14 @@ const AppCreator = (defaultprops) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (path === "/files/{file_id}/content") {
|
||||||
|
console.log("Method: ", path, method, methodvalue)
|
||||||
|
}
|
||||||
|
|
||||||
// Typescript? I think not ;)
|
// Typescript? I think not ;)
|
||||||
if (methodvalue["requestBody"] !== undefined) {
|
if (methodvalue["requestBody"] !== undefined) {
|
||||||
console.log("Handle requestbody: ", methodvalue["requestBody"])
|
//console.log("Handle requestbody: ", methodvalue["requestBody"], method, path)
|
||||||
if (methodvalue["requestBody"]["content"] !== undefined) {
|
if (methodvalue["requestBody"]["content"] !== undefined) {
|
||||||
if (
|
if (
|
||||||
methodvalue["requestBody"]["content"]["application/json"] !==
|
methodvalue["requestBody"]["content"]["application/json"] !==
|
||||||
@@ -816,11 +820,26 @@ const AppCreator = (defaultprops) => {
|
|||||||
methodvalue["requestBody"]["content"][
|
methodvalue["requestBody"]["content"][
|
||||||
"multipart/form-data"
|
"multipart/form-data"
|
||||||
]["schema"]["properties"]["fieldname"];
|
]["schema"]["properties"]["fieldname"];
|
||||||
|
|
||||||
if (fieldname !== undefined) {
|
if (fieldname !== undefined) {
|
||||||
console.log("FIELDNAME: ", fieldname);
|
//console.log("FIELDNAME: ", fieldname);
|
||||||
newaction.file_field = fieldname["value"];
|
newaction.file_field = fieldname["value"];
|
||||||
}
|
} else {
|
||||||
}
|
for (const [subkey, subvalue] of Object.entries(methodvalue["requestBody"]["content"]["multipart/form-data"]["schema"]["properties"])) {
|
||||||
|
if (subkey.includes("file")) {
|
||||||
|
console.log("Found subkey field for file: ", path, method, methodvalue["requestBody"]["content"]["multipart/form-data"]["schema"]["properties"])
|
||||||
|
newaction.file_field = subkey
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newaction.file_field === undefined || newaction.file_field === null || newaction.file_field.length === 0) {
|
||||||
|
console.log("No file fieldname found: ", methodvalue["requestBody"]["content"]["multipart/form-data"]["schema"]["properties"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log("No type found: ", methodvalue["requestBody"]["content"]["multipart/form-data"]["schema"])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var schemas = [];
|
var schemas = [];
|
||||||
@@ -838,11 +857,11 @@ const AppCreator = (defaultprops) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
if (subvalue["example"] !== undefined && subvalue["example"] !== null) {
|
||||||
"ERROR: couldn't find schema for ",
|
newaction["body"] = subvalue["example"]
|
||||||
subvalue,
|
} else {
|
||||||
method
|
console.log("ERROR: couldn't find schema for ", subvalue, method, path);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1388,10 +1407,34 @@ const AppCreator = (defaultprops) => {
|
|||||||
) {
|
) {
|
||||||
setParameterName(value.in);
|
setParameterName(value.in);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (value.scheme === "bearer") {
|
} else if (value.scheme === "bearer") {
|
||||||
setAuthenticationOption("Bearer auth");
|
setAuthenticationOption("Bearer auth");
|
||||||
setAuthenticationRequired(true);
|
setAuthenticationRequired(true);
|
||||||
} else if (key === "Oauth2" || key === "Oauth2c") {
|
|
||||||
|
} else if (key === "ApiKeyAuth" || key === "Token") {
|
||||||
|
setAuthenticationOption("API key");
|
||||||
|
|
||||||
|
value.in = value.in.charAt(0).toUpperCase() + value.in.slice(1);
|
||||||
|
setParameterLocation(value.in);
|
||||||
|
if (!apikeySelection.includes(value.in)) {
|
||||||
|
console.log("APIKEY SELECT: ", apikeySelection);
|
||||||
|
alert.error("Might be error in setting up API key authentication");
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("PARAM NAME: ", value.name);
|
||||||
|
setParameterName(value.name);
|
||||||
|
setAuthenticationRequired(true);
|
||||||
|
|
||||||
|
} else if (value.scheme === "basic") {
|
||||||
|
setAuthenticationOption("Basic auth");
|
||||||
|
setAuthenticationRequired(true);
|
||||||
|
|
||||||
|
} else if (value.scheme === "oauth2") {
|
||||||
|
setAuthenticationOption("Oauth2");
|
||||||
|
setAuthenticationRequired(true);
|
||||||
|
|
||||||
|
} else if (value.type === "oauth2" || key === "Oauth2" || key === "Oauth2c" || (key !== undefined && key!== null && key.toLowerCase().includes("oauth2"))) {
|
||||||
//alert.info("Can't handle Oauth2 auth yet.")
|
//alert.info("Can't handle Oauth2 auth yet.")
|
||||||
setAuthenticationOption("Oauth2");
|
setAuthenticationOption("Oauth2");
|
||||||
setAuthenticationRequired(true);
|
setAuthenticationRequired(true);
|
||||||
@@ -1399,14 +1442,12 @@ const AppCreator = (defaultprops) => {
|
|||||||
//console.log("FLOW-1: ", value)
|
//console.log("FLOW-1: ", value)
|
||||||
const flowkey = value.flow === undefined ? "flows" : "flow";
|
const flowkey = value.flow === undefined ? "flows" : "flow";
|
||||||
//console.log("FLOW: ", value[flowkey])
|
//console.log("FLOW: ", value[flowkey])
|
||||||
const basekey =
|
const basekey = value[flowkey].authorizationCode !== undefined
|
||||||
value[flowkey].authorizationCode !== undefined
|
|
||||||
? "authorizationCode"
|
? "authorizationCode"
|
||||||
: "implicit";
|
: "implicit";
|
||||||
|
|
||||||
//console.log("FLOW2: ", value[flowkey][basekey])
|
//console.log("FLOW2: ", value[flowkey][basekey])
|
||||||
if (
|
if (value[flowkey] !== undefined && value[flowkey][basekey] !== undefined
|
||||||
value[flowkey] !== undefined &&
|
|
||||||
value[flowkey][basekey] !== undefined
|
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
value[flowkey][basekey].authorizationUrl !== undefined &&
|
value[flowkey][basekey].authorizationUrl !== undefined &&
|
||||||
@@ -1464,25 +1505,6 @@ const AppCreator = (defaultprops) => {
|
|||||||
basekey
|
basekey
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (key === "ApiKeyAuth" || key === "Token") {
|
|
||||||
setAuthenticationOption("API key");
|
|
||||||
|
|
||||||
value.in = value.in.charAt(0).toUpperCase() + value.in.slice(1);
|
|
||||||
setParameterLocation(value.in);
|
|
||||||
if (!apikeySelection.includes(value.in)) {
|
|
||||||
console.log("APIKEY SELECT: ", apikeySelection);
|
|
||||||
alert.error("Might be error in setting up API key authentication");
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("PARAM NAME: ", value.name);
|
|
||||||
setParameterName(value.name);
|
|
||||||
setAuthenticationRequired(true);
|
|
||||||
} else if (value.scheme === "basic") {
|
|
||||||
setAuthenticationOption("Basic auth");
|
|
||||||
setAuthenticationRequired(true);
|
|
||||||
} else if (value.scheme === "oauth2") {
|
|
||||||
setAuthenticationOption("Oauth2");
|
|
||||||
setAuthenticationRequired(true);
|
|
||||||
} else {
|
} else {
|
||||||
alert.error("Couldn't handle AUTH type: ", key);
|
alert.error("Couldn't handle AUTH type: ", key);
|
||||||
//newauth.push({
|
//newauth.push({
|
||||||
@@ -1687,6 +1709,7 @@ const AppCreator = (defaultprops) => {
|
|||||||
queryitem.name.toLowerCase() == "ssl_verify" ||
|
queryitem.name.toLowerCase() == "ssl_verify" ||
|
||||||
queryitem.name.toLowerCase() == "queries" ||
|
queryitem.name.toLowerCase() == "queries" ||
|
||||||
queryitem.name.toLowerCase() == "headers" ||
|
queryitem.name.toLowerCase() == "headers" ||
|
||||||
|
queryitem.name.toLowerCase() == "access_token" ||
|
||||||
queryitem.name.includes("[") ||
|
queryitem.name.includes("[") ||
|
||||||
queryitem.name.includes("]") ||
|
queryitem.name.includes("]") ||
|
||||||
queryitem.name.includes("{") ||
|
queryitem.name.includes("{") ||
|
||||||
@@ -2208,8 +2231,8 @@ const AppCreator = (defaultprops) => {
|
|||||||
//console.log("Option: ", authenticationOption)
|
//console.log("Option: ", authenticationOption)
|
||||||
//console.log("Location: ", parameterLocation)
|
//console.log("Location: ", parameterLocation)
|
||||||
//console.log("Name: ", parameterName)
|
//console.log("Name: ", parameterName)
|
||||||
//const extraKeys = authenticationOption === "Oauth2" ? null :
|
//const extraKeys =
|
||||||
const extraKeys =
|
const extraKeys = authenticationOption === "Oauth2" ? null :
|
||||||
<div style={{ marginTop: 50, marginRight: 25, }}>
|
<div style={{ marginTop: 50, marginRight: 25, }}>
|
||||||
<div style={{ display: "flex" }}>
|
<div style={{ display: "flex" }}>
|
||||||
<Typography variant="body1">Extra authentication</Typography>
|
<Typography variant="body1">Extra authentication</Typography>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import {
|
|||||||
import { useTheme } from "@material-ui/core/styles";
|
import { useTheme } from "@material-ui/core/styles";
|
||||||
|
|
||||||
import YAML from "yaml";
|
import YAML from "yaml";
|
||||||
import { Link } from "react-router-dom";
|
import { useNavigate, Link, useParams } from "react-router-dom";
|
||||||
import { useAlert } from "react-alert";
|
import { useAlert } from "react-alert";
|
||||||
import Dropzone from "../components/Dropzone";
|
import Dropzone from "../components/Dropzone";
|
||||||
|
|
||||||
@@ -172,6 +172,8 @@ const Apps = (props) => {
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const baseRepository = "https://github.com/frikky/shuffle-apps";
|
const baseRepository = "https://github.com/frikky/shuffle-apps";
|
||||||
const alert = useAlert();
|
const alert = useAlert();
|
||||||
|
let navigate = useNavigate();
|
||||||
|
|
||||||
const [selectedApp, setSelectedApp] = React.useState({});
|
const [selectedApp, setSelectedApp] = React.useState({});
|
||||||
const [firstrequest, setFirstrequest] = React.useState(true);
|
const [firstrequest, setFirstrequest] = React.useState(true);
|
||||||
const [apps, setApps] = React.useState([]);
|
const [apps, setApps] = React.useState([]);
|
||||||
@@ -220,7 +222,7 @@ const Apps = (props) => {
|
|||||||
document.title = "Shuffle - Apps";
|
document.title = "Shuffle - Apps";
|
||||||
|
|
||||||
if (!isLoggedIn && isLoaded) {
|
if (!isLoggedIn && isLoaded) {
|
||||||
window.location = "/login";
|
navigate("/login")
|
||||||
}
|
}
|
||||||
|
|
||||||
setFirstrequest(false);
|
setFirstrequest(false);
|
||||||
@@ -1932,7 +1934,7 @@ const Apps = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const redirectOpenApi = () => {
|
const redirectOpenApi = () => {
|
||||||
window.location.href = "/apps/new?id=" + appValidation;
|
navigate(`/apps/new?id=${appValidation}`)
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleGithubValidation = (forceUpdate) => {
|
const handleGithubValidation = (forceUpdate) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user