parent
5a94c6754d
commit
dddd7223da
@ -0,0 +1,5 @@ |
||||
ScriptForm dynamic forms |
||||
======================== |
||||
|
||||
This example shows how to create dynamic forms where parts of the form are |
||||
generated by external scripts. |
@ -0,0 +1,25 @@ |
||||
{ |
||||
"title": "Dynamic forms", |
||||
"forms": [ |
||||
{ |
||||
"name": "import", |
||||
"title": "Import CSV data", |
||||
"description": "Import CSV into a database", |
||||
"submit_title": "Import", |
||||
"script": "job_import.sh", |
||||
"fields": [ |
||||
{ |
||||
"name": "target_db", |
||||
"title": "Database to import to", |
||||
"type": "radio", |
||||
"options_from": "form_import_target_dbs.sh" |
||||
}, |
||||
{ |
||||
"name": "sql_file", |
||||
"title": "SQL file", |
||||
"type": "file" |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,9 @@ |
||||
#!/bin/sh |
||||
|
||||
cat << END_TEXT |
||||
[ |
||||
["test", "Test DB"], |
||||
["acc", "Acc DB"], |
||||
["prod", "Prod DB"] |
||||
] |
||||
END_TEXT |
@ -0,0 +1,10 @@ |
||||
#!/bin/sh |
||||
|
||||
|
||||
MYSQL_DEFAULTS_FILE="my.cnf" |
||||
MYSQL="mysql --defaults-file=$MYSQL_DEFAULTS_FILE" |
||||
|
||||
echo "This is what would be executed if this wasn't a fake script:" |
||||
echo |
||||
echo "echo 'DROP DATABASE $target_db' | $MYSQL" |
||||
echo "$MYSQL ${target_db} < ${sql_file}" |
Loading…
Reference in new issue