#400: Fixed parsing of underscore/space issues in frontend and SDK
This commit is contained in:
+39
-14
@@ -1220,6 +1220,9 @@ class AppBase:
|
|||||||
|
|
||||||
# Loops over split values
|
# Loops over split values
|
||||||
for value in parsersplit:
|
for value in parsersplit:
|
||||||
|
#if " " in value:
|
||||||
|
# value = value.replace(" ", "_", -1)
|
||||||
|
|
||||||
#print("VALUE: %s\n" % value)
|
#print("VALUE: %s\n" % value)
|
||||||
actualitem = re.findall(match, value, re.MULTILINE)
|
actualitem = re.findall(match, value, re.MULTILINE)
|
||||||
if value == "#":
|
if value == "#":
|
||||||
@@ -1287,21 +1290,43 @@ class AppBase:
|
|||||||
if len(value) == 0:
|
if len(value) == 0:
|
||||||
return basejson, False
|
return basejson, False
|
||||||
|
|
||||||
if isinstance(basejson, list):
|
try:
|
||||||
print("[WARNING] VALUE IN ISINSTANCE IS NOT TO BE USED (list): %s" % value)
|
if isinstance(basejson, list):
|
||||||
return basejson, False
|
print("[WARNING] VALUE IN ISINSTANCE IS NOT TO BE USED (list): %s" % value)
|
||||||
elif isinstance(basejson[value], str):
|
return basejson, False
|
||||||
print(f"[INFO] LOADING STRING '%s' AS JSON" % basejson[value])
|
elif isinstance(basejson[value], str):
|
||||||
try:
|
print(f"[INFO] LOADING STRING '%s' AS JSON" % basejson[value])
|
||||||
basejson = json.loads(basejson[value])
|
try:
|
||||||
print("BASEJSON: %s" % basejson)
|
basejson = json.loads(basejson[value])
|
||||||
except json.decoder.JSONDecodeError as e:
|
print("BASEJSON: %s" % basejson)
|
||||||
print("RETURNING BECAUSE '%s' IS A NORMAL STRING" % basejson[value])
|
except json.decoder.JSONDecodeError as e:
|
||||||
return basejson[value], False
|
print("RETURNING BECAUSE '%s' IS A NORMAL STRING" % basejson[value])
|
||||||
else:
|
return basejson[value], False
|
||||||
basejson = basejson[value]
|
else:
|
||||||
|
basejson = basejson[value]
|
||||||
|
except KeyError as e:
|
||||||
|
print("[WARNING] Running secondary value check with replacement of underscore in %s: %s" % (value, e))
|
||||||
|
if "_" in value:
|
||||||
|
value = value.replace("_", " ", -1)
|
||||||
|
elif " " in value:
|
||||||
|
value = value.replace(" ", "_", -1)
|
||||||
|
|
||||||
print("Parsed BASEJSON: %s" % basejson)
|
if isinstance(basejson, list):
|
||||||
|
print("[WARNING] VALUE IN ISINSTANCE IS NOT TO BE USED (list): %s" % value)
|
||||||
|
return basejson, False
|
||||||
|
elif isinstance(basejson[value], str):
|
||||||
|
print(f"[INFO] LOADING STRING '%s' AS JSON" % basejson[value])
|
||||||
|
try:
|
||||||
|
basejson = json.loads(basejson[value])
|
||||||
|
print("BASEJSON: %s" % basejson)
|
||||||
|
except json.decoder.JSONDecodeError as e:
|
||||||
|
print("RETURNING BECAUSE '%s' IS A NORMAL STRING" % basejson[value])
|
||||||
|
return basejson[value], False
|
||||||
|
else:
|
||||||
|
basejson = basejson[value]
|
||||||
|
|
||||||
|
|
||||||
|
#print("Parsed BASEJSON: %s" % basejson)
|
||||||
outercnt += 1
|
outercnt += 1
|
||||||
|
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
NAME=shuffle-app_sdk
|
NAME=shuffle-app_sdk
|
||||||
VERSION=0.8.98
|
VERSION=0.8.99
|
||||||
|
|
||||||
docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force
|
docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force
|
||||||
docker build . -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION
|
docker build . -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ require (
|
|||||||
github.com/elastic/go-elasticsearch/v7 v7.12.0 // indirect
|
github.com/elastic/go-elasticsearch/v7 v7.12.0 // indirect
|
||||||
github.com/elastic/go-elasticsearch/v8 v8.0.0-20210519083322-55daf7425ecb // indirect
|
github.com/elastic/go-elasticsearch/v8 v8.0.0-20210519083322-55daf7425ecb // indirect
|
||||||
github.com/frikky/kin-openapi v0.39.0
|
github.com/frikky/kin-openapi v0.39.0
|
||||||
github.com/frikky/shuffle-shared v0.0.54
|
github.com/frikky/shuffle-shared v0.0.56
|
||||||
github.com/fsouza/go-dockerclient v1.7.2 // indirect
|
github.com/fsouza/go-dockerclient v1.7.2 // indirect
|
||||||
github.com/ghodss/yaml v1.0.0
|
github.com/ghodss/yaml v1.0.0
|
||||||
github.com/go-git/go-billy/v5 v5.0.0
|
github.com/go-git/go-billy/v5 v5.0.0
|
||||||
|
|||||||
@@ -167,6 +167,8 @@ github.com/frikky/shuffle-shared v0.0.53 h1:TszF/PoJ3JrfEf7qCGdN0So3bDbofNxh4Fqq
|
|||||||
github.com/frikky/shuffle-shared v0.0.53/go.mod h1:BknTfpun3qte5bumR3OqQHf9XWPIsyj8woiXCjIlbBc=
|
github.com/frikky/shuffle-shared v0.0.53/go.mod h1:BknTfpun3qte5bumR3OqQHf9XWPIsyj8woiXCjIlbBc=
|
||||||
github.com/frikky/shuffle-shared v0.0.54 h1:rc8JcavY6uDxaIkXFwLVotfv3/epXUzuCWzRCozZNGg=
|
github.com/frikky/shuffle-shared v0.0.54 h1:rc8JcavY6uDxaIkXFwLVotfv3/epXUzuCWzRCozZNGg=
|
||||||
github.com/frikky/shuffle-shared v0.0.54/go.mod h1:BknTfpun3qte5bumR3OqQHf9XWPIsyj8woiXCjIlbBc=
|
github.com/frikky/shuffle-shared v0.0.54/go.mod h1:BknTfpun3qte5bumR3OqQHf9XWPIsyj8woiXCjIlbBc=
|
||||||
|
github.com/frikky/shuffle-shared v0.0.56 h1:stC793SdQeBh98yJqCL74aXFo9YYhVIg8CQJ7hm4d6o=
|
||||||
|
github.com/frikky/shuffle-shared v0.0.56/go.mod h1:BknTfpun3qte5bumR3OqQHf9XWPIsyj8woiXCjIlbBc=
|
||||||
github.com/fsouza/go-dockerclient v1.7.2 h1:bBEAcqLTkpq205jooP5RVroUKiVEWgGecHyeZc4OFjo=
|
github.com/fsouza/go-dockerclient v1.7.2 h1:bBEAcqLTkpq205jooP5RVroUKiVEWgGecHyeZc4OFjo=
|
||||||
github.com/fsouza/go-dockerclient v1.7.2/go.mod h1:+ugtMCVRwnPfY7d8/baCzZ3uwB0BrG5DB8OzbtxaRz8=
|
github.com/fsouza/go-dockerclient v1.7.2/go.mod h1:+ugtMCVRwnPfY7d8/baCzZ3uwB0BrG5DB8OzbtxaRz8=
|
||||||
github.com/getkin/kin-openapi v0.8.0 h1:a6TQjTqwkyscC4/hShJX7WhCVE+4bi9lzw61XHQW5hE=
|
github.com/getkin/kin-openapi v0.8.0 h1:a6TQjTqwkyscC4/hShJX7WhCVE+4bi9lzw61XHQW5hE=
|
||||||
|
|||||||
@@ -5675,6 +5675,7 @@ func initHandlers() {
|
|||||||
r.HandleFunc("/api/v1/orgs/", shuffle.HandleGetOrgs).Methods("GET", "OPTIONS")
|
r.HandleFunc("/api/v1/orgs/", shuffle.HandleGetOrgs).Methods("GET", "OPTIONS")
|
||||||
r.HandleFunc("/api/v1/orgs/{orgId}", shuffle.HandleGetOrg).Methods("GET", "OPTIONS")
|
r.HandleFunc("/api/v1/orgs/{orgId}", shuffle.HandleGetOrg).Methods("GET", "OPTIONS")
|
||||||
r.HandleFunc("/api/v1/orgs/{orgId}", shuffle.HandleEditOrg).Methods("POST", "OPTIONS")
|
r.HandleFunc("/api/v1/orgs/{orgId}", shuffle.HandleEditOrg).Methods("POST", "OPTIONS")
|
||||||
|
r.HandleFunc("/api/v1/orgs/{orgId}/create_sub_org", shuffle.HandleCreateSubOrg).Methods("POST", "OPTIONS")
|
||||||
|
|
||||||
// This is a new API that validates if a key has been seen before.
|
// This is a new API that validates if a key has been seen before.
|
||||||
// Not sure what the best course of action is for it.
|
// Not sure what the best course of action is for it.
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
frontend:
|
frontend:
|
||||||
#build: ./frontend
|
build: ./frontend
|
||||||
image: ghcr.io/frikky/shuffle-frontend:nightly
|
image: ghcr.io/frikky/shuffle-frontend:nightly
|
||||||
container_name: shuffle-frontend
|
container_name: shuffle-frontend
|
||||||
hostname: shuffle-frontend
|
hostname: shuffle-frontend
|
||||||
@@ -16,7 +16,7 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
backend:
|
backend:
|
||||||
#build: ./backend
|
build: ./backend
|
||||||
image: ghcr.io/frikky/shuffle-backend:nightly
|
image: ghcr.io/frikky/shuffle-backend:nightly
|
||||||
container_name: shuffle-backend
|
container_name: shuffle-backend
|
||||||
hostname: ${BACKEND_HOSTNAME}
|
hostname: ${BACKEND_HOSTNAME}
|
||||||
|
|||||||
@@ -28,6 +28,28 @@ http {
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name "localhost";
|
server_name "localhost";
|
||||||
|
|
||||||
|
#location /static/js/* {
|
||||||
|
# # avoid clickjacking
|
||||||
|
# add_header X-Frame-Options DENY;
|
||||||
|
# add_header X-Content-Type-Options nosniff;
|
||||||
|
# add_header ;
|
||||||
|
# # block MIME sniffing
|
||||||
|
|
||||||
|
# # security headers
|
||||||
|
# add_header X-XSS-Protection "1; mode=block";
|
||||||
|
# # add_header Content-Security-Policy "default-src 'self'";
|
||||||
|
# add_header Referrer-Policy "no-referrer";
|
||||||
|
# server_tokens off;
|
||||||
|
|
||||||
|
# root /usr/share/nginx/html;
|
||||||
|
# gzip_static on;
|
||||||
|
# expires 1y;
|
||||||
|
# add_header Cache-Control public;
|
||||||
|
# add_header ETag "";
|
||||||
|
# try_files $uri /index.html;
|
||||||
|
#}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
# avoid clickjacking
|
# avoid clickjacking
|
||||||
add_header X-Frame-Options DENY;
|
add_header X-Frame-Options DENY;
|
||||||
|
|||||||
@@ -7567,6 +7567,10 @@ const AngularWorkflow = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const HandleJsonCopy = (base, copy, base_node_name) => {
|
const HandleJsonCopy = (base, copy, base_node_name) => {
|
||||||
|
if (typeof(copy.name) === "string") {
|
||||||
|
copy.name = copy.name.replaceAll(" ", "_")
|
||||||
|
}
|
||||||
|
|
||||||
console.log("COPY: ", copy)
|
console.log("COPY: ", copy)
|
||||||
var newitem = JSON.parse(base)
|
var newitem = JSON.parse(base)
|
||||||
to_be_copied = "$"+base_node_name.toLowerCase().replaceAll(" ", "_")
|
to_be_copied = "$"+base_node_name.toLowerCase().replaceAll(" ", "_")
|
||||||
@@ -7919,7 +7923,7 @@ const AngularWorkflow = (props) => {
|
|||||||
try {
|
try {
|
||||||
validate.result.result = JSON.parse(validate.result.result)
|
validate.result.result = JSON.parse(validate.result.result)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("ERROR PARSING: ", e)
|
//console.log("ERROR PARSING: ", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ export const GetParsedPaths = (inputdata, basekey) => {
|
|||||||
// Handle direct loop!
|
// Handle direct loop!
|
||||||
if (!isNaN(key) && basekey === "") {
|
if (!isNaN(key) && basekey === "") {
|
||||||
console.log("Handling direct loop.")
|
console.log("Handling direct loop.")
|
||||||
parsedValues.push({"type": "object", "name": "Node", "autocomplete": `${basekey}`.toLowerCase()})
|
parsedValues.push({"type": "object", "name": "Node", "autocomplete": `${basekey.replaceAll(" ", "_")}`})
|
||||||
parsedValues.push({"type": "list", "name": `${splitkey}list`, "autocomplete": `${basekey}.#`.toLowerCase()})
|
parsedValues.push({"type": "list", "name": `${splitkey}list`, "autocomplete": `${basekey.replaceAll(" ", "_")}.#`})
|
||||||
const returnValues = GetParsedPaths(value, `${basekey}.#`)
|
const returnValues = GetParsedPaths(value, `${basekey}.#`)
|
||||||
for (var subkey in returnValues) {
|
for (var subkey in returnValues) {
|
||||||
parsedValues.push(returnValues[subkey])
|
parsedValues.push(returnValues[subkey])
|
||||||
@@ -61,8 +61,8 @@ export const GetParsedPaths = (inputdata, basekey) => {
|
|||||||
if (typeof(value) === 'object') {
|
if (typeof(value) === 'object') {
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
// Check if each item is object
|
// Check if each item is object
|
||||||
parsedValues.push({"type": "object", "name": basekeyname, "autocomplete": `${basekey}.${key}`.toLowerCase()})
|
parsedValues.push({"type": "object", "name": basekeyname, "autocomplete": `${basekey}.${key.replaceAll(" ", "_")}`})
|
||||||
parsedValues.push({"type": "list", "name": `${basekeyname}${splitkey}list`, "autocomplete": `${basekey}.${key}.#`.toLowerCase()})
|
parsedValues.push({"type": "list", "name": `${basekeyname}${splitkey}list`, "autocomplete": `${basekey}.${key.replaceAll(" ", "_")}.#`})
|
||||||
|
|
||||||
// Only check the first. This would be probably be dumb otherwise.
|
// Only check the first. This would be probably be dumb otherwise.
|
||||||
for (var subkey in value) {
|
for (var subkey in value) {
|
||||||
@@ -79,14 +79,14 @@ export const GetParsedPaths = (inputdata, basekey) => {
|
|||||||
}
|
}
|
||||||
//console.log(key+" is array")
|
//console.log(key+" is array")
|
||||||
} else {
|
} else {
|
||||||
parsedValues.push({"type": "object", "name": basekeyname, "autocomplete": `${basekey}.${key}`.toLowerCase()})
|
parsedValues.push({"type": "object", "name": basekeyname, "autocomplete": `${basekey}.${key.replaceAll(" ", "_")}`})
|
||||||
const returnValues = GetParsedPaths(value, `${basekey}.${key}`)
|
const returnValues = GetParsedPaths(value, `${basekey}.${key}`)
|
||||||
for (var subkey in returnValues) {
|
for (var subkey in returnValues) {
|
||||||
parsedValues.push(returnValues[subkey])
|
parsedValues.push(returnValues[subkey])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
parsedValues.push({"type": "value", "name": basekeyname, "autocomplete": `${basekey}.${key}`.toLowerCase(), "value": value,})
|
parsedValues.push({"type": "value", "name": basekeyname, "autocomplete": `${basekey}.${key.replaceAll(" ", "_")}`, "value": value,})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,12 @@ require (
|
|||||||
github.com/docker/docker v20.10.5+incompatible
|
github.com/docker/docker v20.10.5+incompatible
|
||||||
github.com/docker/go-connections v0.4.0 // indirect
|
github.com/docker/go-connections v0.4.0 // indirect
|
||||||
github.com/docker/go-units v0.4.0 // indirect
|
github.com/docker/go-units v0.4.0 // indirect
|
||||||
github.com/frikky/shuffle-shared v0.0.55
|
github.com/elastic/go-elasticsearch/v8 v8.0.0-20210531084204-f01628963386 // indirect
|
||||||
|
github.com/frikky/shuffle-shared v0.0.56
|
||||||
github.com/fsouza/go-dockerclient v1.7.2
|
github.com/fsouza/go-dockerclient v1.7.2
|
||||||
github.com/go-git/go-billy/v5 v5.3.1 // indirect
|
github.com/go-git/go-billy/v5 v5.3.1 // indirect
|
||||||
github.com/gogo/protobuf v1.3.2 // indirect
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
|
github.com/google/go-github/v28 v28.1.1 // indirect
|
||||||
github.com/gorilla/mux v1.8.0
|
github.com/gorilla/mux v1.8.0
|
||||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||||
github.com/opencontainers/image-spec v1.0.1 // indirect
|
github.com/opencontainers/image-spec v1.0.1 // indirect
|
||||||
|
|||||||
Reference in New Issue
Block a user