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