Minor fixes for 2.0
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
import React, { useEffect, useState, useContext } from 'react';
|
import React, { useEffect, useState, useContext } from 'react';
|
||||||
import OrgHeaderexpanded from "./OrgHeaderexpandedNew.jsx";
|
import OrgHeaderexpanded from "../components/OrgHeaderexpandedNew.jsx";
|
||||||
import OrgHeader from './OrgHeaderNew.jsx';
|
import OrgHeader from '../components/OrgHeaderNew.jsx';
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import CloudSyncTab from './CloudSyncTab.jsx';
|
import CloudSyncTab from '../components/CloudSyncTab.jsx';
|
||||||
import {
|
import {
|
||||||
FileCopy as FileCopyIcon,
|
FileCopy as FileCopyIcon,
|
||||||
} from "@mui/icons-material";
|
} from "@mui/icons-material";
|
||||||
|
|||||||
@@ -579,7 +579,7 @@ const EditWorkflow = (props) => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Typography variant="body2" color="textSecondary" style={{ marginTop: 30, marginBottom: 10, }}>
|
<Typography variant="body2" color="textSecondary" style={{ marginTop: 30, marginBottom: 10, }}>
|
||||||
Multi-Tenant Workflows. Make one workflow, and keep a separate, synced copy in all your tenants. Control distributed auth, runtime locations, files, datastore keys etc. (<b>late beta</b> - contact support@shuffler.io if you want a demo. Please try it!)
|
Multi-Tenant Workflows. Make one workflow, and keep a separate, synced copy in all your tenants. Control distributed auth, runtime locations, files, datastore keys etc. (contact support@shuffler.io if you want a demo. Please try it!)
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
{userdata !== undefined && userdata !== null && userdata.orgs !== undefined && userdata.orgs !== null && userdata.orgs.length > 0 ?
|
{userdata !== undefined && userdata !== null && userdata.orgs !== undefined && userdata.orgs !== null && userdata.orgs.length > 0 ?
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ const EnvironmentTab = memo((props) => {
|
|||||||
-e AUTH="${auth}" \\
|
-e AUTH="${auth}" \\
|
||||||
-e ENVIRONMENT_NAME="${environment.Name}" \\
|
-e ENVIRONMENT_NAME="${environment.Name}" \\
|
||||||
-e ORG="${environment.org_id}" \\
|
-e ORG="${environment.org_id}" \\
|
||||||
-e SHUFFLE_WORKER_IMAGE="ghcr.io/shuffle/shuffle-worker:nightly" \\
|
-e SHUFFLE_WORKER_IMAGE="ghcr.io/shuffle/shuffle-worker:latest" \\
|
||||||
-e SHUFFLE_SWARM_CONFIG=run \\
|
-e SHUFFLE_SWARM_CONFIG=run \\
|
||||||
-e SHUFFLE_LOGS_DISABLED=true \\
|
-e SHUFFLE_LOGS_DISABLED=true \\
|
||||||
-e BASE_URL="${newUrl}" \\${addProxy ? `
|
-e BASE_URL="${newUrl}" \\${addProxy ? `
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ const OrgHeaderexpandedNew = (props) => {
|
|||||||
|
|
||||||
{isCloud ? (
|
{isCloud ? (
|
||||||
<div style={{ marginLeft: 13, fontSize: 16, color: "#9E9E9E" }} >
|
<div style={{ marginLeft: 13, fontSize: 16, color: "#9E9E9E" }} >
|
||||||
Region
|
Change Region
|
||||||
<RegionChangeModal selectedOrganization={selectedOrganization} setSelectedRegion={setSelectedRegion} userdata={userdata} handleSendChangeRegionMail={handleSendChangeRegionMail} />
|
<RegionChangeModal selectedOrganization={selectedOrganization} setSelectedRegion={setSelectedRegion} userdata={userdata} handleSendChangeRegionMail={handleSendChangeRegionMail} />
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -657,6 +657,7 @@ const CodeEditor = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!inputvariable.includes(".")) {
|
if (!inputvariable.includes(".")) {
|
||||||
|
inputvariable = inputvariable.toLowerCase()
|
||||||
return inputvariable
|
return inputvariable
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -665,6 +666,9 @@ const CodeEditor = (props) => {
|
|||||||
var removedIndexes = 0
|
var removedIndexes = 0
|
||||||
for (var key in itemsplit) {
|
for (var key in itemsplit) {
|
||||||
var tmpitem = itemsplit[key]
|
var tmpitem = itemsplit[key]
|
||||||
|
if (key == 0) {
|
||||||
|
tmpitem = tmpitem.toLowerCase()
|
||||||
|
}
|
||||||
|
|
||||||
// Makes sure #0 and # are same, as we only visualize first one anyway
|
// Makes sure #0 and # are same, as we only visualize first one anyway
|
||||||
if (tmpitem.startsWith("#")) {
|
if (tmpitem.startsWith("#")) {
|
||||||
@@ -695,20 +699,24 @@ const CodeEditor = (props) => {
|
|||||||
var variable_occurence = current_code_line.match(/[\\]{0,1}[$]{1}([a-zA-Z0-9_@-]+\.?){1}([a-zA-Z0-9#_@-]+\.?){0,}/g)
|
var variable_occurence = current_code_line.match(/[\\]{0,1}[$]{1}([a-zA-Z0-9_@-]+\.?){1}([a-zA-Z0-9#_@-]+\.?){0,}/g)
|
||||||
|
|
||||||
if (!variable_occurence) {
|
if (!variable_occurence) {
|
||||||
continue;
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var new_occurences = variable_occurence.filter((occurrence) => occurrence[0]);
|
//var new_occurences = variable_occurence.filter((occurrence) => occurrence[0]);
|
||||||
variable_occurence = new_occurences
|
//variable_occurence = new_occurences
|
||||||
|
|
||||||
|
variable_occurence = variable_occurence.filter((occurrence) => occurrence[0]);
|
||||||
|
|
||||||
|
// Checks code lines, not variable occurences. Then remaps later
|
||||||
var dollar_occurence = [];
|
var dollar_occurence = [];
|
||||||
for (let ch = 0; ch < current_code_line.length; ch++) {
|
for (let ch = 0; ch < current_code_line.length; ch++) {
|
||||||
//if (current_code_line[ch] === '$' && (ch === 0)) {
|
//if (current_code_line[ch] === '$' && (ch === 0)) {
|
||||||
if (current_code_line[ch] === '$') {
|
if (current_code_line[ch] === '$') {
|
||||||
dollar_occurence.push(ch);
|
dollar_occurence.push(ch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lowercase anything between the $ and first .
|
||||||
var dollar_occurence_len = []
|
var dollar_occurence_len = []
|
||||||
try {
|
try {
|
||||||
for (let occ = 0; occ < variable_occurence.length; occ++) {
|
for (let occ = 0; occ < variable_occurence.length; occ++) {
|
||||||
@@ -1005,7 +1013,6 @@ const CodeEditor = (props) => {
|
|||||||
|
|
||||||
// Replace quotes with nothing
|
// Replace quotes with nothing
|
||||||
} else {
|
} else {
|
||||||
console.log("NO TYPE? ", typeof new_input)
|
|
||||||
try {
|
try {
|
||||||
new_input = new_input.toString()
|
new_input = new_input.toString()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -1897,7 +1904,7 @@ const CodeEditor = (props) => {
|
|||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
console.log(innerdata.example)
|
//console.log(innerdata.example)
|
||||||
|
|
||||||
//const handleClick = (item) => {
|
//const handleClick = (item) => {
|
||||||
handleItemClick([innerdata]);
|
handleItemClick([innerdata]);
|
||||||
|
|||||||
@@ -13457,7 +13457,7 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
Shuffle AI
|
Shuffle AI
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="body2" color="textSecondary">
|
<Typography variant="body2" color="textSecondary">
|
||||||
What you write here will be fed to the Shuffle AI to generate a change for the selected action or field. Best used for when you are stuck with formatting. Uses your AI credits (resets monthly). Alpha feature. Please give feedback to support@shuffler.io {"<"}3
|
What you write here will be fed to the Shuffle AI to generate a change for the selected action or field. Best used for when you are stuck with formatting. Uses your AI credits (resets monthly). <b>Beta feature.</b> Please give feedback to support@shuffler.io {"<"}3
|
||||||
|
|
||||||
</Typography>
|
</Typography>
|
||||||
<TextField
|
<TextField
|
||||||
|
|||||||
+103
-110
@@ -455,44 +455,44 @@ export const collapseField = (field, inputdata) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const validateJson = (showResult) => {
|
export const validateJson = (showResult) => {
|
||||||
if (showResult === undefined || showResult === null) {
|
if (showResult === undefined || showResult === null) {
|
||||||
return {
|
return {
|
||||||
valid: false,
|
valid: false,
|
||||||
result: "",
|
result: "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof showResult === 'string') {
|
if (typeof showResult === 'string') {
|
||||||
showResult = showResult.split(" False").join(" false")
|
showResult = showResult.split(" False").join(" false")
|
||||||
showResult = showResult.split(" True").join(" true")
|
showResult = showResult.split(" True").join(" true")
|
||||||
|
|
||||||
showResult.replaceAll("False,", "false,")
|
showResult.replaceAll("False,", "false,")
|
||||||
showResult.replaceAll("True,", "true,")
|
showResult.replaceAll("True,", "true,")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof showResult === "object" || typeof showResult === "array") {
|
if (typeof showResult === "object" || typeof showResult === "array") {
|
||||||
return {
|
return {
|
||||||
valid: true,
|
valid: true,
|
||||||
result: showResult,
|
result: showResult,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showResult[0] === "\"") {
|
if (showResult[0] === "\"") {
|
||||||
return {
|
return {
|
||||||
valid: false,
|
valid: false,
|
||||||
result: showResult,
|
result: showResult,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var jsonvalid = true
|
var jsonvalid = true
|
||||||
try {
|
try {
|
||||||
if (!showResult.includes("{") && !showResult.includes("[")) {
|
if (!showResult.includes("{") && !showResult.includes("[")) {
|
||||||
jsonvalid = false
|
jsonvalid = false
|
||||||
|
|
||||||
return {
|
return {
|
||||||
valid: jsonvalid,
|
valid: jsonvalid,
|
||||||
result: showResult,
|
result: showResult,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
@@ -509,102 +509,94 @@ export const validateJson = (showResult) => {
|
|||||||
|
|
||||||
var result = showResult;
|
var result = showResult;
|
||||||
try {
|
try {
|
||||||
result = jsonvalid ? JSON.parse(showResult, { "storeAsString": true }) : showResult;
|
result = jsonvalid ? JSON.parse(showResult, {"storeAsString": true}) : showResult;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
////console.log("Failed parsing JSON even though its valid: ", e)
|
////console.log("Failed parsing JSON even though its valid: ", e)
|
||||||
jsonvalid = false;
|
jsonvalid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jsonvalid === false) {
|
if (jsonvalid === false) {
|
||||||
|
|
||||||
if (typeof showResult === 'string') {
|
if (typeof showResult === 'string') {
|
||||||
showResult = showResult.trim()
|
showResult = showResult.trim()
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
var newstr = showResult.replaceAll("'", '"')
|
|
||||||
|
|
||||||
// Basic workarounds for issues with Python Dicts -> JSON
|
|
||||||
if (newstr.includes(": None")) {
|
|
||||||
newstr = newstr.replaceAll(": None", ': null')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newstr.includes("[\"{") && newstr.includes("}\"]")) {
|
|
||||||
newstr = newstr.replaceAll("[\"{", '[{')
|
|
||||||
newstr = newstr.replaceAll("}\"]", '}]')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newstr.includes("{\"[") && newstr.includes("]\"}")) {
|
|
||||||
newstr = newstr.replaceAll("{\"[", '[{')
|
|
||||||
newstr = newstr.replaceAll("]\"}", '}]')
|
|
||||||
}
|
|
||||||
|
|
||||||
result = JSON.parse(newstr)
|
|
||||||
jsonvalid = true
|
|
||||||
} catch (e) {
|
|
||||||
|
|
||||||
//console.log("Failed parsing JSON even though its valid (2): ", e)
|
|
||||||
jsonvalid = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonvalid && typeof result === "number") {
|
|
||||||
jsonvalid = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is where we start recursing
|
|
||||||
if (jsonvalid) {
|
|
||||||
// Check fields if they can be parsed too
|
|
||||||
try {
|
|
||||||
for (const [key, value] of Object.entries(result)) {
|
|
||||||
if (typeof value === "string") {
|
|
||||||
value = value.replaceAll(" ", "_")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof value === "string" && (value.startsWith("{") || value.startsWith("["))) {
|
try {
|
||||||
//console.log("CHECKING STRING: ", value)
|
var newstr = showResult.replaceAll("'", '"')
|
||||||
|
|
||||||
const inside_result = validateJson(value)
|
// Basic workarounds for issues with Python Dicts -> JSON
|
||||||
if (inside_result.valid) {
|
if (newstr.includes(": None")) {
|
||||||
//console.log("INSIDE RESULT: ", inside_result.result)
|
newstr = newstr.replaceAll(": None", ': null')
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof inside_result.result === "string") {
|
if (newstr.includes("[\"{") && newstr.includes("}\"]")) {
|
||||||
const newres = JSON.parse(inside_result.result)
|
newstr = newstr.replaceAll("[\"{", '[{')
|
||||||
|
newstr = newstr.replaceAll("}\"]", '}]')
|
||||||
|
}
|
||||||
|
|
||||||
result[key] = newres
|
if (newstr.includes("{\"[") && newstr.includes("]\"}")) {
|
||||||
} else {
|
newstr = newstr.replaceAll("{\"[", '[{')
|
||||||
result[key] = inside_result.result
|
newstr = newstr.replaceAll("]\"}", '}]')
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// Usually only reaches here if raw array > dict > value
|
result = JSON.parse(newstr)
|
||||||
if (typeof showResult !== "array") {
|
jsonvalid = true
|
||||||
for (const [subkey, subvalue] of Object.entries(value)) {
|
} catch (e) {
|
||||||
if (typeof subvalue === "string") {
|
|
||||||
subvalue = subvalue.replaceAll(" ", "_")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof subvalue === "string" && (subvalue.startsWith("{") || subvalue.startsWith("["))) {
|
//console.log("Failed parsing JSON even though its valid (2): ", e)
|
||||||
const inside_result = validateJson(subvalue)
|
jsonvalid = false
|
||||||
if (inside_result.valid) {
|
}
|
||||||
if (typeof inside_result.result === "string") {
|
}
|
||||||
const newres = JSON.parse(inside_result.result)
|
|
||||||
result[key][subkey] = newres
|
|
||||||
} else {
|
|
||||||
result[key][subkey] = inside_result.result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
if (jsonvalid && typeof result === "number") {
|
||||||
}
|
jsonvalid = false
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (e) {
|
// This is where we start recursing
|
||||||
//console.log("Failed parsing inside json subvalues: ", e)
|
if (jsonvalid) {
|
||||||
}
|
// Check fields if they can be parsed too
|
||||||
}
|
try {
|
||||||
|
for (const [key, value] of Object.entries(result)) {
|
||||||
|
if (typeof value === "string" && (value.startsWith("{") || value.startsWith("["))) {
|
||||||
|
//console.log("CHECKING STRING: ", value)
|
||||||
|
|
||||||
|
const inside_result = validateJson(value)
|
||||||
|
if (inside_result.valid) {
|
||||||
|
//console.log("INSIDE RESULT: ", inside_result.result)
|
||||||
|
|
||||||
|
if (typeof inside_result.result === "string") {
|
||||||
|
const newres = JSON.parse(inside_result.result)
|
||||||
|
|
||||||
|
result[key] = newres
|
||||||
|
} else {
|
||||||
|
result[key] = inside_result.result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Usually only reaches here if raw array > dict > value
|
||||||
|
if (typeof showResult !== "array") {
|
||||||
|
for (const [subkey, subvalue] of Object.entries(value)) {
|
||||||
|
if (typeof subvalue === "string" && (subvalue.startsWith("{") || subvalue.startsWith("["))) {
|
||||||
|
const inside_result = validateJson(subvalue)
|
||||||
|
if (inside_result.valid) {
|
||||||
|
if (typeof inside_result.result === "string") {
|
||||||
|
const newres = JSON.parse(inside_result.result)
|
||||||
|
result[key][subkey] = newres
|
||||||
|
} else {
|
||||||
|
result[key][subkey] = inside_result.result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
//console.log("Failed parsing inside json subvalues: ", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
valid: jsonvalid,
|
valid: jsonvalid,
|
||||||
@@ -612,6 +604,7 @@ export const validateJson = (showResult) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//Custom hook for handling styling of the dropzone
|
//Custom hook for handling styling of the dropzone
|
||||||
const useDropzoneStyles = () => {
|
const useDropzoneStyles = () => {
|
||||||
const { leftSideBarOpenByClick } = useContext(Context);
|
const { leftSideBarOpenByClick } = useContext(Context);
|
||||||
|
|||||||
Reference in New Issue
Block a user