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")
(vbox align "center"
(gridbox align "center"
(hbox
align "center"
margin 10
align "left"
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
name "filesystem"
enumref '(
"ext4"
"xfs"
"btrfs (RAID0)"
"btrfs (RAID1)"
"btrfs (RAID10)")))
(vbox
(combobox align "left" name "filesystem")
(combobox name "target_disk" align "right")))
(separator)
(gridbox
(hbox
name "btrfs-form"
align "center"
columns "0;50"
visibility #f
margin 20
(hbox
name "target_disk_form"
align "top"
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
(label text (bold (_ "Disk Setup")))
(checklistbox width 350 name "harddisks"))
(vbox align "middle"
(checkbox
name "use_advanced_options_enabled"
align "right"
@ -70,52 +33,51 @@
(vbox
name "advenced_options"
align "left"
align "top"
activity #f
(hbox align "left"
(label text (_ "compress"))
(combobox
name "compress"
rows (list "off" "on")))
(combobox name "compress"))
(hbox align "left"
(label text (_ "hdsize") nameref "hdsize")
(edit name "hdsize")
(hbox
(label text (_ "hdsize"))
(spinbox name "hdsize")
(label text "GB")))))
(vbox
name "ext4-xfs-form"
align "left"
margin 30
margin 20
(hbox align "right"
(label text (_ "hdsize") nameref "hdsize")
(edit name "hdsize")
(label text (_ "hdsize"))
(spinbox name "hdsize")
(label text "GB"))
(hbox align "right"
(label text (_ "swapsize") nameref "swapsize")
(edit name "swapsize")
(label text (_ "swapsize"))
(spinbox name "swapsize")
(label text "GB"))
(hbox align "right"
(label text (_ "maxroot") nameref "maxroot")
(edit name "maxroot")
(label text (_ "maxroot"))
(spinbox name "maxroot")
(label text "GB"))
(hbox align "right"
(label text (_ "maxvz") nameref "maxvz")
(edit name "maxvz")
(label text (_ "maxvz"))
(spinbox name "maxvz")
(label text "GB"))
(hbox align "right"
(label text (_ "minfree") nameref "minfree")
(edit name "hdsize")
(label text (_ "minfree"))
(spinbox name "minfree")
(label text "GB"))))
(document:root (when loaded
; (initialization)
(initialization)
(form-bind
"use_advanced_options_enabled"
"change"
@ -124,27 +86,37 @@
(form-bind
"filesystem"
"change"
update-target-form)
))
update-target-form)))
; (define (initialization)
; (form-update-enum "filesystem" '(
; "ext4"
; "xfs"
; "btrfs (RAID0)"
; "btrfs (RAID1)"
; "btrfs (RAID10)")))
(define (initialization)
(form-update-enum "compress" (woo-list "/virtualization/avail_btrfs_compression"))
(form-update-enum "target_disk" (woo-list "/virtualization/available_disks"))
(form-update-enum "harddisks" (woo-list "/virtualization/available_disks"))
(form-update-enum "filesystem" (woo-list "/virtualization/available_filesystems"))
(update-target-form))
(define (update-advenced-options-activity)
(form-update-activity "advenced_options" (form-value
"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)
(format #t "debug-message:obj1=~S" (form-value "filesystem"))
(let ((filesystem (form-value "filesystem")))
(if (string=? filesystem "ext4")
(form-update-visibility "ext4-xfs-form" (form-value
"use_advanced_options_enabled"))
(form-update-visibility "btrfs-form" (form-value
"use_advanced_options_enabled")))))
(if (or
(string=? filesystem "ext4")
(string=? filesystem "xfs")
(string=? filesystem ""))
(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)))))