瀏覽代碼

tahoelafs configuration menu style

Bob Mottram 7 年之前
父節點
當前提交
054f5a1d16
共有 1 個文件被更改,包括 19 次插入21 次删除
  1. 19
    21
      src/freedombone-app-tahoelafs

+ 19
- 21
src/freedombone-app-tahoelafs 查看文件

@@ -188,27 +188,25 @@ function edit_tahoelafs_shares {
188 188
 }
189 189
 
190 190
 function configure_interactive_tahoelafs {
191
-    data=$(mktemp 2>/dev/null)
192
-    dialog --backtitle $"Freedombone Configuration" \
193
-           --title $"Tahoe-LAFS" \
194
-           --radiolist $"The least authority is always the best" 11 50 5 \
195
-           1 "Add a storage node" off \
196
-           2 "Manually edit storage nodes" off \
197
-           3 "Shares settings" off \
198
-           4 "Back to main menu" on 2> "$data"
199
-    sel=$?
200
-    case $sel in
201
-        1) rm -f "$data"
202
-           exit 1;;
203
-        255) rm -f "$data"
204
-             exit 1;;
205
-    esac
206
-    case $(cat "$data") in
207
-        1) add_tahoelafs_storage_node_interactive;;
208
-        2) edit_tahoelafs_nodes;;
209
-        3) edit_tahoelafs_shares;;
210
-    esac
211
-    rm -f "$data"
191
+    W=(1 $"Add a storage node"
192
+       2 $"Manually edit storage nodes"
193
+       3 $"Shares settings")
194
+
195
+    while true
196
+    do
197
+        # shellcheck disable=SC2068
198
+        selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Tahoe-LAFS" --menu $"Choose an operation, or ESC to exit:" 12 60 3 "${W[@]}" 3>&2 2>&1 1>&3)
199
+
200
+        if [ ! "$selection" ]; then
201
+            break
202
+        fi
203
+
204
+        case $selection in
205
+            1) add_tahoelafs_storage_node_interactive;;
206
+            2) edit_tahoelafs_nodes;;
207
+            3) edit_tahoelafs_shares;;
208
+        esac
209
+    done
212 210
 }
213 211
 
214 212
 function tahoelafs_setup_client_config {