Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

118 task show menu location in the title box #121

Merged
merged 9 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions lib/armbian-configng/config.ng.functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ function set_runtime_variables() {
[[ -z "${ARMBIAN// /}" ]] && ARMBIAN="$DISTRO $DISTROID"
DEFAULT_ADAPTER=$(ip -4 route ls | grep default | tail -1 | grep -Po '(?<=dev )(\S+)')
LOCALIPADD=$(ip -4 addr show dev $DEFAULT_ADAPTER | awk '/inet/ {print $2}' | cut -d'/' -f1)
BACKTITLE="\n Contribute: https://github.com/armbian/configng\n"
BACKTITLE="Contribute: https://github.com/armbian/configng"
TITLE="Armbian configuration utility"
[[ -z "${DEFAULT_ADAPTER// /}" ]] && DEFAULT_ADAPTER="lo"

Expand Down Expand Up @@ -518,13 +518,13 @@ module_options+=(
#
generate_top_menu() {
local json_data=$1

local backtitle="$ARMBIAN $DISTRO $DISTROID $KERNELID"
while true; do
local menu_options=()

parse_menu_items menu_options

local OPTION=$($DIALOG --title "$TITLE" --menu "$BACKTITLE" 0 80 9 "${menu_options[@]}" \
local OPTION=$($DIALOG --title "$TITLE" --backtitle "$backtitle" --menu "Choose an option:" 0 80 9 "${menu_options[@]}" \
--ok-button Select --cancel-button Exit 3>&1 1>&2 2>&3)
local exitstatus=$?

Expand All @@ -549,14 +549,19 @@ module_options+=(
# Function to generate the submenu
#
function generate_menu() {
local parent_id=$1
local parent_id="$1"
local top_parent_id="$2"
local backtitle="$ARMBIAN $DISTRO $DISTROID $KERNELID"
local status="$TITLE"

[[ "$parent_id" == "System" ]] && status=""

while true; do
# Get the submenu options for the current parent_id
local submenu_options=()
parse_menu_items submenu_options

local OPTION=$($DIALOG --title "$TITLE" --menu "$BACKTITLE" 0 80 9 "${submenu_options[@]}" \
local OPTION=$($DIALOG --title "$status" --backtitle "$backtitle" --menu "$top_parent_id $parent_id options:" 0 80 9 "${submenu_options[@]}" \
--ok-button Select --cancel-button Back 3>&1 1>&2 2>&3)

local exitstatus=$?
Expand All @@ -570,7 +575,8 @@ function generate_menu() {
if [ "$submenu_count" -gt 0 ]; then
# If it does, generate a new menu for the submenu
[[ -n "$debug" ]] && echo "$OPTION"
generate_menu "$OPTION"
generate_menu "$OPTION" "$parent_id"

else
# If it doesn't, execute the command
[[ -n "$debug" ]] && echo "$OPTION"
Expand Down
4 changes: 2 additions & 2 deletions lib/armbian-configng/config.ng.jobs.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"condition": "[[ -n $(ls /sbin/armbian-install) ]]"
},
{
"id": "S07.1",
"id": "SSH",
"description": "Manage SSH login options",
"sub": [
{
Expand Down Expand Up @@ -971,4 +971,4 @@
]
}
]
}
}
2 changes: 1 addition & 1 deletion tests/M00.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ENABLED=ture
ENABLED=true
CONDITION="[ -f /usr/bin/cockpit-bridge ]"