mirror of
https://github.com/YunoHost/test_apps.git
synced 2024-09-03 20:06:29 +02:00
[enh] Small change in config panel test app
This commit is contained in:
parent
319c55f647
commit
2403d99912
7 changed files with 34 additions and 59 deletions
|
@ -0,0 +1 @@
|
||||||
|
arg4 = "Arg4 value"
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"arg3": "Arg3 value"
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?php
|
||||||
|
$arg5= "Arg5 value";
|
|
@ -0,0 +1 @@
|
||||||
|
arg6 = "Arg6 value"
|
|
@ -0,0 +1 @@
|
||||||
|
arg2: "Arg2 value"
|
|
@ -2,7 +2,7 @@ version = "0.1"
|
||||||
name = "Configuration panel"
|
name = "Configuration panel"
|
||||||
|
|
||||||
[main]
|
[main]
|
||||||
name = "Main section"
|
name = "Main panel"
|
||||||
|
|
||||||
[main.components]
|
[main.components]
|
||||||
name = "Components"
|
name = "Components"
|
||||||
|
@ -10,97 +10,78 @@ name = "Main section"
|
||||||
[main.components.boolean]
|
[main.components.boolean]
|
||||||
ask = "Put a boolean"
|
ask = "Put a boolean"
|
||||||
type = "boolean"
|
type = "boolean"
|
||||||
labels.true = "on"
|
|
||||||
labels.false = "off"
|
|
||||||
default = true
|
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.number]
|
[main.components.number]
|
||||||
ask = "Put a number"
|
ask = "Put a number"
|
||||||
type = "number"
|
type = "number"
|
||||||
min = 1
|
min = 1
|
||||||
max = 100
|
max = 100
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.range]
|
[main.components.range]
|
||||||
ask = "Put a range"
|
ask = "Put a range"
|
||||||
type = "range"
|
type = "range"
|
||||||
min = 1
|
min = 1
|
||||||
max = 100
|
max = 100
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.str]
|
[main.components.str]
|
||||||
ask = "Put a string with yunohost word"
|
ask = "Put a string with yunohost word"
|
||||||
type = "string"
|
type = "string"
|
||||||
pattern = "yunohost"
|
pattern = "yunohost"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.text]
|
[main.components.text]
|
||||||
ask = "Put a text"
|
ask = "Put a text"
|
||||||
type = "text"
|
type = "text"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.password]
|
[main.components.password]
|
||||||
ask = "Put a password"
|
ask = "Put a password"
|
||||||
type = "password"
|
type = "password"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.custom_path]
|
[main.components.path]
|
||||||
ask = "Put a path"
|
ask = "Put a path"
|
||||||
type = "path"
|
type = "path"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.email]
|
[main.components.email]
|
||||||
ask = "Put a email"
|
ask = "Put a email"
|
||||||
type = "email"
|
type = "email"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.url]
|
[main.components.url]
|
||||||
ask = "Put a url"
|
ask = "Put a url"
|
||||||
type = "url"
|
type = "url"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.date]
|
[main.components.date]
|
||||||
ask = "Put a date"
|
ask = "Put a date"
|
||||||
type = "date"
|
type = "date"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.time]
|
[main.components.time]
|
||||||
ask = "Put a time"
|
ask = "Put a time"
|
||||||
type = "time"
|
type = "time"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.color]
|
[main.components.color]
|
||||||
ask = "Put a color"
|
ask = "Put a color"
|
||||||
type = "color"
|
type = "color"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.select]
|
[main.components.select]
|
||||||
ask = "Choose an option"
|
ask = "Choose an option"
|
||||||
type = "select"
|
type = "select"
|
||||||
choices = ["option1", "option2", "option3"]
|
choices = ["option1", "option2", "option3"]
|
||||||
optional = true
|
default = "option1"
|
||||||
|
|
||||||
[main.components.custom_domain]
|
[main.components.domain]
|
||||||
ask = "Put a domain"
|
ask = "Put a domain"
|
||||||
type = "domain"
|
type = "domain"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.user]
|
[main.components.user]
|
||||||
ask = "Put a user"
|
ask = "Put a user"
|
||||||
type = "user"
|
type = "user"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.tags]
|
[main.components.tags]
|
||||||
ask = "Put some tags"
|
ask = "Put some tags"
|
||||||
type = "tags"
|
type = "tags"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.components.file]
|
# [main.components.file]
|
||||||
ask = "Put a file"
|
# ask = "Put a file"
|
||||||
type = "file"
|
# type = "file"
|
||||||
accept = ".cube"
|
# accept = ".cube"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.messages]
|
[main.messages]
|
||||||
name = "Read only components"
|
name = "Read only components"
|
||||||
|
@ -117,9 +98,9 @@ name = "Main section"
|
||||||
ask = "This is an warning message"
|
ask = "This is an warning message"
|
||||||
type = "warning"
|
type = "warning"
|
||||||
|
|
||||||
[main.messages.error]
|
[main.messages.danger]
|
||||||
ask = "This is an simple message"
|
ask = "This is a danger message"
|
||||||
type = "error"
|
type = "danger"
|
||||||
|
|
||||||
[main.messages.display_text]
|
[main.messages.display_text]
|
||||||
ask = "This is a simple text"
|
ask = "This is a simple text"
|
||||||
|
@ -136,36 +117,32 @@ name = "Main section"
|
||||||
ask = "This is a question with a default value"
|
ask = "This is a question with a default value"
|
||||||
type = "string"
|
type = "string"
|
||||||
default = "Camille"
|
default = "Camille"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.generic.example]
|
[main.generic.example]
|
||||||
ask = "This is a question with an example value"
|
ask = "This is a question with an example value"
|
||||||
type = "string"
|
type = "string"
|
||||||
example = "Camille"
|
example = "Camille"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.generic.required]
|
[main.generic.required]
|
||||||
ask = "This is a required value"
|
ask = "This is a required value"
|
||||||
type = "string"
|
type = "string"
|
||||||
|
optional = false
|
||||||
|
|
||||||
[main.generic.help]
|
[main.generic.help]
|
||||||
ask = "Here we add some help"
|
ask = "Here we add some help"
|
||||||
type = "string"
|
type = "string"
|
||||||
help = "You can feel this question with your keyboard (yes i know it's very useful)"
|
help = "You can feel this question with your keyboard (yes i know it's very useful)"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.generic.helpLink]
|
[main.generic.helpLink]
|
||||||
ask = "Here we add an help link"
|
ask = "Here we add an help link"
|
||||||
type = "string"
|
type = "string"
|
||||||
helpLink.href = "https://yunohost.org/doc"
|
helpLink.href = "https://yunohost.org/doc"
|
||||||
helpLink.text = "Yunohost Doc"
|
helpLink.text = "Yunohost Doc"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[main.generic.visibleIf]
|
[main.generic.visibleIf]
|
||||||
ask = "Display if helpLink question is filled"
|
ask = "Display if helpLink question is filled"
|
||||||
type = "string"
|
type = "string"
|
||||||
visibleIf = "helpLink"
|
visibleIf = "helpLink == 'plop'"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[source]
|
[source]
|
||||||
name = "Source section"
|
name = "Source section"
|
||||||
|
@ -176,7 +153,6 @@ name = "Source section"
|
||||||
[source.settings.arg1]
|
[source.settings.arg1]
|
||||||
ask = "Save app settings arg1"
|
ask = "Save app settings arg1"
|
||||||
type = "string"
|
type = "string"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[source.yml]
|
[source.yml]
|
||||||
name = "YAML"
|
name = "YAML"
|
||||||
|
@ -185,7 +161,6 @@ name = "Source section"
|
||||||
ask = "Save arg2 in YAML"
|
ask = "Save arg2 in YAML"
|
||||||
type = "string"
|
type = "string"
|
||||||
source = "__FINALPATH__/test.yml"
|
source = "__FINALPATH__/test.yml"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[source.json]
|
[source.json]
|
||||||
name = "JSON"
|
name = "JSON"
|
||||||
|
@ -194,7 +169,6 @@ name = "Source section"
|
||||||
ask = "Save arg3 in JSON"
|
ask = "Save arg3 in JSON"
|
||||||
type = "string"
|
type = "string"
|
||||||
source = "__FINALPATH__/test.json"
|
source = "__FINALPATH__/test.json"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[source.ini]
|
[source.ini]
|
||||||
name = "INI"
|
name = "INI"
|
||||||
|
@ -203,7 +177,6 @@ name = "Source section"
|
||||||
ask = "Save arg4 in INI"
|
ask = "Save arg4 in INI"
|
||||||
type = "string"
|
type = "string"
|
||||||
source = "__FINALPATH__/test.ini"
|
source = "__FINALPATH__/test.ini"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[source.php]
|
[source.php]
|
||||||
name = "PHP"
|
name = "PHP"
|
||||||
|
@ -212,7 +185,6 @@ name = "Source section"
|
||||||
ask = "Save arg5 in PHP file"
|
ask = "Save arg5 in PHP file"
|
||||||
type = "string"
|
type = "string"
|
||||||
source = "__FINALPATH__/test.php"
|
source = "__FINALPATH__/test.php"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[source.python]
|
[source.python]
|
||||||
name = "Python"
|
name = "Python"
|
||||||
|
@ -221,17 +193,15 @@ name = "Source section"
|
||||||
ask = "Save arg6 in python file"
|
ask = "Save arg6 in python file"
|
||||||
type = "string"
|
type = "string"
|
||||||
source = "__FINALPATH__/test.py"
|
source = "__FINALPATH__/test.py"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[source.file]
|
# [source.file]
|
||||||
name = "File"
|
# name = "File"
|
||||||
|
#
|
||||||
[source.file.arg7]
|
# [source.file.arg7]
|
||||||
ask = "Save a cube file"
|
# ask = "Save a cube file"
|
||||||
type = "file"
|
# type = "file"
|
||||||
accept = ".cube"
|
# accept = ".cube"
|
||||||
source = "__FINALPATH__/test.cube"
|
# source = "__FINALPATH__/test.cube"
|
||||||
optional = true
|
|
||||||
|
|
||||||
[source.function]
|
[source.function]
|
||||||
name = "Save with a bash function"
|
name = "Save with a bash function"
|
||||||
|
@ -239,4 +209,3 @@ name = "Source section"
|
||||||
[source.function.arg8]
|
[source.function.arg8]
|
||||||
ask = "Custom validate and save arg8 password"
|
ask = "Custom validate and save arg8 password"
|
||||||
type = "password"
|
type = "password"
|
||||||
optional = true
|
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -28,7 +28,7 @@ get__arg8() {
|
||||||
# SPECIFIC VALIDATORS FOR TOML SHORT KEYS
|
# SPECIFIC VALIDATORS FOR TOML SHORT KEYS
|
||||||
#=================================================
|
#=================================================
|
||||||
validate__arg8() {
|
validate__arg8() {
|
||||||
[[ "$#arg8" -lt 8 ]] &&
|
[[ "${#arg8}" -lt 8 ]] &&
|
||||||
echo 'Too short password'
|
echo 'Too short password'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,14 +36,12 @@ validate__arg8() {
|
||||||
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
||||||
#=================================================
|
#=================================================
|
||||||
set__arg8() {
|
set__arg8() {
|
||||||
if [ -z "$arg8" ]
|
if [ -z "${arg8}" ]
|
||||||
then
|
then
|
||||||
python -c "import crypt; print(crypt.crypt(\"${arg8}\", \"\$6\$saltsalt\$\"))" > $final_path/password
|
python -c "import crypt; print(crypt.crypt(\"${arg8}\", \"\$6\$saltsalt\$\"))" > $final_path/password
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# OVERWRITING APPLY STEP
|
# OVERWRITING APPLY STEP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -55,4 +53,4 @@ ynh_panel_apply() {
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_panel_run
|
ynh_panel_run $1
|
||||||
|
|
Loading…
Add table
Reference in a new issue