From 8d53a4fce6f9b0fc2b4ac6085719c2420c9397f1 Mon Sep 17 00:00:00 2001 From: cle-b Date: Sun, 5 Jan 2025 12:09:38 +0100 Subject: [PATCH] config bar update --- httpdbg/webapp/static/configuration.js | 27 +++++++++++++++++++++----- httpdbg/webapp/static/index.htm | 10 +++++----- httpdbg/webapp/static/main.js | 24 +++++++++++++++++------ httpdbg/webapp/static/render.js | 4 ++-- httpdbg/webapp/static/style.css | 4 ++-- 5 files changed, 49 insertions(+), 20 deletions(-) diff --git a/httpdbg/webapp/static/configuration.js b/httpdbg/webapp/static/configuration.js index ac6dbda..06a7fff 100644 --- a/httpdbg/webapp/static/configuration.js +++ b/httpdbg/webapp/static/configuration.js @@ -1,14 +1,14 @@ "use strict"; function apply_config_rule_css(a_config, sheet) { - document.getElementById(a_config.checkbox).checked = a_config.value; + document.getElementById(a_config.id).checked = a_config.value; if (a_config.value) { sheet.insertRule(a_config.css); } } function apply_config_rule_click(a_config) { - document.getElementById(a_config.checkbox).checked = a_config.value; + document.getElementById(a_config.id).checked = a_config.value; document.getElementsByName(a_config.elt_name).forEach(element => { if (element.checked != a_config.value) { element.click(); @@ -18,7 +18,11 @@ function apply_config_rule_click(a_config) { } function apply_config_rule(a_config, sheet) { - document.getElementById(a_config.checkbox).checked = a_config.value; + document.getElementById(a_config.id).checked = a_config.value; +} + +function apply_config_rule_select(a_config, sheet) { + document.getElementById(a_config.id).value = a_config.value; } function apply_config() { @@ -30,6 +34,9 @@ function apply_config() { apply_config_rule(httpdbgApp.config.keep_previous_sessions); + apply_config_rule_select(httpdbgApp.config.group_by); + update_group_by(httpdbgApp.config.group_by.value); + apply_config_rule_css(httpdbgApp.config.hide_netloc, sheet); apply_config_rule_css(httpdbgApp.config.hide_group, sheet); apply_config_rule_css(httpdbgApp.config.hide_tag, sheet); @@ -39,13 +46,18 @@ function apply_config() { } function load_config_rule_from_url(a_config, params) { - a_config.value = (params.get(a_config.param) || "off") == "on"; + if (a_config.type === "select") { + a_config.value = params.get(a_config.param) || "default"; + } else { + a_config.value = (params.get(a_config.param) || "off") == "on"; + } } function load_config_from_url(apply) { const params = new URLSearchParams(window.location.search); load_config_rule_from_url(httpdbgApp.config.keep_previous_sessions, params); + load_config_rule_from_url(httpdbgApp.config.group_by, params); load_config_rule_from_url(httpdbgApp.config.hide_netloc, params); load_config_rule_from_url(httpdbgApp.config.hide_group, params); load_config_rule_from_url(httpdbgApp.config.hide_tag, params); @@ -58,13 +70,18 @@ function load_config_from_url(apply) { } function load_config_rule_from_form(a_config) { - a_config.value = document.getElementById(a_config.checkbox).checked; + if (a_config.type === "select") { + a_config.value = document.getElementById(a_config.id).value; + } else { + a_config.value = document.getElementById(a_config.id).checked; + } } function load_config_from_form(apply) { const params = new URLSearchParams(window.location.search); load_config_rule_from_form(httpdbgApp.config.keep_previous_sessions); + load_config_rule_from_form(httpdbgApp.config.group_by); load_config_rule_from_form(httpdbgApp.config.hide_netloc); load_config_rule_from_form(httpdbgApp.config.hide_group); load_config_rule_from_form(httpdbgApp.config.hide_tag); diff --git a/httpdbg/webapp/static/index.htm b/httpdbg/webapp/static/index.htm index b6ca5c2..8b55132 100644 --- a/httpdbg/webapp/static/index.htm +++ b/httpdbg/webapp/static/index.htm @@ -30,22 +30,22 @@