the backend successfully communicates with the frontend

This commit is contained in:
Vladislav Tsarev 2024-12-24 16:56:12 +03:00
parent 307e3cf367
commit fc8f219e42

View File

@ -1,66 +1,29 @@
(document:surround "/std/frame") (document:surround "/std/frame")
(vbox align "center" (gridbox align "center"
(hbox (hbox
align "center" align "left"
margin 10 margin 20
(label text (bold (_ "Filesystem")) name "filesystems") (vbox
(label text (bold (_ "Filesystem")) align "right")
(label text (bold (_ "Target Disk")) align "right" name "target_disk_label"))
(listbox (vbox
name "filesystem" (combobox align "left" name "filesystem")
enumref '( (combobox name "target_disk" align "right")))
"ext4"
"xfs"
"btrfs (RAID0)"
"btrfs (RAID1)"
"btrfs (RAID10)")))
(separator) (separator)
(gridbox (hbox
name "btrfs-form" name "btrfs-form"
align "center" margin 20
columns "0;50"
visibility #f
(hbox (vbox
name "target_disk_form" (label text (bold (_ "Disk Setup")))
align "top" (checklistbox width 350 name "harddisks"))
margin 10
(label text (bold (_ "Target Disk")))
(combobox
name "target_disk"
rows '(
"disk 1"
"disk 2"
"disk 3")))
(vbox margin 10
(label align "right" text (bold (_ "Disk Setup")))
(separator)
(hbox align "right"
(label text (_ "Harddisk 0") nameref "harddisk0")
(combobox
name "harddisk0"
rows '(
"/dev/sda (22.26GiB, VBOX HARDDISK)"
"/dev/sdb (21.40GiB, VBOX HARDDISK)")))
(hbox align "right"
(label text (_ "Harddisk 1") nameref "harddisk1")
(combobox
name "harddisk1"
rows '(
"/dev/sda (22.26GiB, VBOX HARDDISK)"
"/dev/sdb (21.40GiB, VBOX HARDDISK)")))
(vbox align "middle"
(checkbox (checkbox
name "use_advanced_options_enabled" name "use_advanced_options_enabled"
align "right" align "right"
@ -70,52 +33,51 @@
(vbox (vbox
name "advenced_options" name "advenced_options"
align "left" align "top"
activity #f activity #f
(hbox align "left" (hbox align "left"
(label text (_ "compress")) (label text (_ "compress"))
(combobox (combobox name "compress"))
name "compress"
rows (list "off" "on")))
(hbox align "left" (hbox
(label text (_ "hdsize") nameref "hdsize") (label text (_ "hdsize"))
(edit name "hdsize") (spinbox name "hdsize")
(label text "GB"))))) (label text "GB")))))
(vbox (vbox
name "ext4-xfs-form" name "ext4-xfs-form"
align "left" align "left"
margin 30 margin 20
(hbox align "right" (hbox align "right"
(label text (_ "hdsize") nameref "hdsize") (label text (_ "hdsize"))
(edit name "hdsize") (spinbox name "hdsize")
(label text "GB")) (label text "GB"))
(hbox align "right" (hbox align "right"
(label text (_ "swapsize") nameref "swapsize") (label text (_ "swapsize"))
(edit name "swapsize") (spinbox name "swapsize")
(label text "GB")) (label text "GB"))
(hbox align "right" (hbox align "right"
(label text (_ "maxroot") nameref "maxroot") (label text (_ "maxroot"))
(edit name "maxroot") (spinbox name "maxroot")
(label text "GB")) (label text "GB"))
(hbox align "right" (hbox align "right"
(label text (_ "maxvz") nameref "maxvz") (label text (_ "maxvz"))
(edit name "maxvz") (spinbox name "maxvz")
(label text "GB")) (label text "GB"))
(hbox align "right" (hbox align "right"
(label text (_ "minfree") nameref "minfree") (label text (_ "minfree"))
(edit name "hdsize") (spinbox name "minfree")
(label text "GB")))) (label text "GB"))))
(document:root (when loaded (document:root (when loaded
; (initialization) (initialization)
(form-bind (form-bind
"use_advanced_options_enabled" "use_advanced_options_enabled"
"change" "change"
@ -124,27 +86,37 @@
(form-bind (form-bind
"filesystem" "filesystem"
"change" "change"
update-target-form) update-target-form)))
))
; (define (initialization) (define (initialization)
; (form-update-enum "filesystem" '( (form-update-enum "compress" (woo-list "/virtualization/avail_btrfs_compression"))
; "ext4" (form-update-enum "target_disk" (woo-list "/virtualization/available_disks"))
; "xfs" (form-update-enum "harddisks" (woo-list "/virtualization/available_disks"))
; "btrfs (RAID0)" (form-update-enum "filesystem" (woo-list "/virtualization/available_filesystems"))
; "btrfs (RAID1)" (update-target-form))
; "btrfs (RAID10)")))
(define (update-advenced-options-activity) (define (update-advenced-options-activity)
(form-update-activity "advenced_options" (form-value (form-update-activity "advenced_options" (form-value
"use_advanced_options_enabled"))) "use_advanced_options_enabled")))
(define (set-activity-ext4-xfs-form activity)
(form-update-visibility "ext4-xfs-form" activity)
(form-update-visibility "target_disk" activity)
(form-update-visibility "target_disk_label" activity))
(define (update-target-form) (define (update-target-form)
(format #t "debug-message:obj1=~S" (form-value "filesystem")) (format #t "debug-message:obj1=~S" (form-value "filesystem"))
(let ((filesystem (form-value "filesystem"))) (let ((filesystem (form-value "filesystem")))
(if (string=? filesystem "ext4") (if (or
(form-update-visibility "ext4-xfs-form" (form-value (string=? filesystem "ext4")
"use_advanced_options_enabled")) (string=? filesystem "xfs")
(form-update-visibility "btrfs-form" (form-value (string=? filesystem ""))
"use_advanced_options_enabled")))))
(begin
(set-activity-ext4-xfs-form #t)
(form-update-visibility "btrfs-form" #f))
(begin
(set-activity-ext4-xfs-form #f)
(form-update-visibility "btrfs-form" #t)))))