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