#65: Starting auto casting in app sdk. Might break some things.

This commit is contained in:
frikky
2020-06-17 20:03:47 +02:00
parent 89ae46925e
commit 96b5998ce0
9 changed files with 8172 additions and 11845 deletions
+17 -1
View File
@@ -442,7 +442,8 @@ class AppBase:
for parameter in action["parameters"]: for parameter in action["parameters"]:
check, value = parse_params(action, fullexecution, parameter) check, value = parse_params(action, fullexecution, parameter)
if check: if check:
raise Exception(check) raise "Value check error: %s" % Exception(check)
# Custom format for ${name[0,1,2,...]}$ # Custom format for ${name[0,1,2,...]}$
submatch = "([${]{2}([0-9a-zA-Z_-]+)(\[.*\])[}$]{2})" submatch = "([${]{2}([0-9a-zA-Z_-]+)(\[.*\])[}$]{2})"
@@ -483,6 +484,21 @@ class AppBase:
# With this parameter ready, add it to... a greater list of parameters. Rofl # With this parameter ready, add it to... a greater list of parameters. Rofl
multi_parameters[parameter["name"]] = resultarray multi_parameters[parameter["name"]] = resultarray
else: else:
# Testing casting
if value.lower() == "true":
value = True
elif value.lower() == "false":
value = False
else:
constructors = [int]
for c in constructors:
try:
value = c(value)
print("Successfully parsed %s to %s", value, c)
except ValueError:
print("Failed to parse %s to %s", value, c)
pass
params[parameter["name"]] = value params[parameter["name"]] = value
multi_parameters[parameter["name"]] = value multi_parameters[parameter["name"]] = value
+2 -2
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
docker rmi frikky/shuffle:app_sdk docker rmi frikky/shuffle:app_sdk --force
docker build . -t frikky/shuffle:app_sdk --no-cache docker build . -t frikky/shuffle:app_sdk
docker push frikky/shuffle:app_sdk docker push frikky/shuffle:app_sdk
+5 -8
View File
@@ -189,17 +189,14 @@ func buildImageMemory(fs billy.Filesystem, tags []string, dockerfileFolder strin
dockerFileTarReader, dockerFileTarReader,
buildOptions, buildOptions,
) )
//log.Printf("IMAGERESPONSE: %#v", imageBuildResponse.Body)
log.Printf("IMAGERESPONSE: %#v", imageBuildResponse.Body)
if err != nil { if err != nil {
return err // Read the STDOUT from the build process
} defer imageBuildResponse.Body.Close()
_, newerr := io.Copy(os.Stdout, imageBuildResponse.Body)
log.Printf("Failed reading Docker build STDOUT: %s", newerr)
// Read the STDOUT from the build process
defer imageBuildResponse.Body.Close()
_, err = io.Copy(os.Stdout, imageBuildResponse.Body)
if err != nil {
return err return err
} }
+3 -3
View File
@@ -1402,7 +1402,7 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
ctx := context.Background() ctx := context.Background()
sessionToken := c.Value sessionToken := c.Value
log.Printf("Found session %s", sessionToken) //log.Printf("Found session %s", sessionToken)
session, err := getSession(ctx, sessionToken) session, err := getSession(ctx, sessionToken)
if err != nil { if err != nil {
log.Printf("Session %#v doesn't exist: %s", session, err) log.Printf("Session %#v doesn't exist: %s", session, err)
@@ -5933,7 +5933,7 @@ func handleAppHotload(location string) error {
fs, err := createFs(basepath, location) fs, err := createFs(basepath, location)
if err != nil { if err != nil {
log.Printf("Failed memfs creation - probably bad path: %s", err) log.Printf("Failed memfs creation - probably bad path: %s", err)
return err return errors.New(fmt.Sprintf("Failed to find directory %s", location))
} else { } else {
log.Printf("Memfs creation from %s done", location) log.Printf("Memfs creation from %s done", location)
} }
@@ -5944,7 +5944,7 @@ func handleAppHotload(location string) error {
return err return err
} }
log.Printf("Reading app folder: %#v", dir) //log.Printf("Reading app folder: %#v", dir)
err = iterateAppGithubFolders(fs, dir, "", "") err = iterateAppGithubFolders(fs, dir, "", "")
if err != nil { if err != nil {
log.Printf("Err: %s", err) log.Printf("Err: %s", err)
+1 -1
View File
@@ -3966,7 +3966,7 @@ func iterateAppGithubFolders(fs billy.Filesystem, dir []os.FileInfo, extra strin
log.Printf("Failed to increase total apps loaded stats: %s", err) log.Printf("Failed to increase total apps loaded stats: %s", err)
} }
log.Printf("Added %s:%s to the database", workflowapp.Name, workflowapp.AppVersion) //log.Printf("Added %s:%s to the database", workflowapp.Name, workflowapp.AppVersion)
/// Only upload if successful and no errors /// Only upload if successful and no errors
err = buildImageMemory(fs, tags, extra) err = buildImageMemory(fs, tags, extra)
+3 -1
View File
@@ -14,7 +14,7 @@ services:
depends_on: depends_on:
- backend - backend
backend: backend:
build: ./backend #build: ./backend
image: frikky/shuffle:backend image: frikky/shuffle:backend
container_name: shuffle-backend container_name: shuffle-backend
hostname: ${BACKEND_HOSTNAME} hostname: ${BACKEND_HOSTNAME}
@@ -31,6 +31,8 @@ services:
- DATASTORE_EMULATOR_HOST=shuffle-database:8000 - DATASTORE_EMULATOR_HOST=shuffle-database:8000
- APP_DOWNLOAD_LOCATION=${APP_DOWNLOAD_LOCATION} - APP_DOWNLOAD_LOCATION=${APP_DOWNLOAD_LOCATION}
- APP_HOTLOAD_FOLDER=/shuffle-apps - APP_HOTLOAD_FOLDER=/shuffle-apps
- https_proxy=http://server:443
- http_proxy=http://server:443
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
- database - database
+8137 -11825
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "shuffler", "name": "shuffler",
"homepage": "https://shuffler.io", "homepage": "https://shuffler.io",
"version": "0.3.0", "version": "0.6.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@material-ui/core": "^4.5.2", "@material-ui/core": "^4.5.2",
@@ -49,7 +49,7 @@
"react-powerhooks": "0.0.7", "react-powerhooks": "0.0.7",
"react-router": "^4.3.1", "react-router": "^4.3.1",
"react-router-dom": "^4.3.1", "react-router-dom": "^4.3.1",
"react-scripts": "^2.1.8", "react-scripts": "^3.4.1",
"reactstrap": "^7.1.0", "reactstrap": "^7.1.0",
"shellwords": "^0.1.1", "shellwords": "^0.1.1",
"simplebar": "^4.2.3", "simplebar": "^4.2.3",
+2 -2
View File
@@ -2771,12 +2771,12 @@ const AngularWorkflow = (props) => {
const AppConditionHandler = (props) => { const AppConditionHandler = (props) => {
const { tmpdata, type } = props const { tmpdata, type } = props
const [data, ] = useState(tmpdata)
const [multiline, setMultiline] = useState(false)
if (tmpdata === undefined) { if (tmpdata === undefined) {
return tmpdata return tmpdata
} }
const [data, ] = useState(tmpdata)
const [multiline, setMultiline] = useState(false)
if (data.variant === "") { if (data.variant === "") {
data.variant = "STATIC_VALUE" data.variant = "STATIC_VALUE"