diff --git a/docs/modules/ROOT/images/args/checklist/.gitignore b/docs/modules/ROOT/images/args/checklist/.gitignore new file mode 100644 index 0000000..431dbf1 --- /dev/null +++ b/docs/modules/ROOT/images/args/checklist/.gitignore @@ -0,0 +1,2 @@ +custom-webui/ +__pycache__/ diff --git a/docs/modules/ROOT/images/args/checklist/Makefile b/docs/modules/ROOT/images/args/checklist/Makefile new file mode 100644 index 0000000..720e66a --- /dev/null +++ b/docs/modules/ROOT/images/args/checklist/Makefile @@ -0,0 +1,2 @@ +CONFIGDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +include ../../screenshots.mk diff --git a/docs/modules/ROOT/images/args/checklist/checklist.png b/docs/modules/ROOT/images/args/checklist/checklist.png new file mode 100644 index 0000000..495211c Binary files /dev/null and b/docs/modules/ROOT/images/args/checklist/checklist.png differ diff --git a/docs/modules/ROOT/images/args/checklist/config.yaml b/docs/modules/ROOT/images/args/checklist/config.yaml new file mode 100644 index 0000000..35e537d --- /dev/null +++ b/docs/modules/ROOT/images/args/checklist/config.yaml @@ -0,0 +1,22 @@ +--- +listenAddressSingleHTTPFrontend: 0.0.0.0:11337 + +logLevel: "WARN" +checkForUpdates: false +showFooter: false + +actions: + - title: Backup selected directories + shell: echo "Backing up {{ directories }}" + arguments: + - name: directories + title: Directories to back up + type: checklist + choices: + - title: Documents + value: documents + - title: Photos + value: photos + - title: Music + value: music + default: '["documents","photos"]' diff --git a/docs/modules/ROOT/images/args/checklist/screenshots.ini b/docs/modules/ROOT/images/args/checklist/screenshots.ini new file mode 100644 index 0000000..d798e27 --- /dev/null +++ b/docs/modules/ROOT/images/args/checklist/screenshots.ini @@ -0,0 +1,11 @@ +[DEFAULT] +base_url = http://localhost:11337/ +dir = . +width = 800 +height = 520 +post_script_sleep = 0.5 + +[checklist] +url = . +name = checklist +script = setup_checklist.py diff --git a/docs/modules/ROOT/images/args/checklist/setup_checklist.py b/docs/modules/ROOT/images/args/checklist/setup_checklist.py new file mode 100644 index 0000000..a7125cd --- /dev/null +++ b/docs/modules/ROOT/images/args/checklist/setup_checklist.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +"""Prepare the checklist argument form screenshot.""" + +import time + +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import WebDriverWait + + +def _wait_for_body_attr(driver, attr, timeout=15): + WebDriverWait(driver, timeout).until( + lambda d: bool(d.find_element(By.TAG_NAME, "body").get_attribute(attr)) + ) + + +def run(driver): + _wait_for_body_attr(driver, "loaded-dashboard") + + driver.find_element( + By.CSS_SELECTOR, '[title="Backup selected directories"]' + ).click() + + _wait_for_body_attr(driver, "loaded-argument-form") + + WebDriverWait(driver, 15).until( + lambda d: len( + d.find_elements(By.CSS_SELECTOR, ".choice-checklist-item input[type='checkbox']") + ) + >= 3 + ) + time.sleep(0.2) diff --git a/docs/modules/ROOT/pages/args/input_checklist.adoc b/docs/modules/ROOT/pages/args/input_checklist.adoc index 229814e..e831fd7 100644 --- a/docs/modules/ROOT/pages/args/input_checklist.adoc +++ b/docs/modules/ROOT/pages/args/input_checklist.adoc @@ -19,14 +19,17 @@ actions: value: photos - title: Music value: music - default: documents,photos + default: '["documents","photos"]' ---- +.Checklist argument form with Documents and Photos selected by default. +image::args/checklist/checklist.png[] + When the example above runs with Documents and Photos selected, the shell command becomes: [source,shell] ---- -echo "Backing up: documents,photos" +echo "Backing up: [\"documents\",\"photos\"]" ---- == Select all / Select none