瀏覽代碼

docs: screenshot for checklist

jamesread 1 月之前
父節點
當前提交
1708cf15ad

+ 2 - 0
docs/modules/ROOT/images/args/checklist/.gitignore

@@ -0,0 +1,2 @@
+custom-webui/
+__pycache__/

+ 2 - 0
docs/modules/ROOT/images/args/checklist/Makefile

@@ -0,0 +1,2 @@
+CONFIGDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
+include ../../screenshots.mk

二進制
docs/modules/ROOT/images/args/checklist/checklist.png


+ 22 - 0
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"]'

+ 11 - 0
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

+ 31 - 0
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)

+ 5 - 2
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