diff --git a/docker/routlin-dash/app/view_page.py b/docker/routlin-dash/app/view_page.py index d71f8d9..957f567 100644 --- a/docker/routlin-dash/app/view_page.py +++ b/docker/routlin-dash/app/view_page.py @@ -1525,6 +1525,14 @@ def _render_nav_item(item, active_view, level, in_dropdown=False, inherited_req= def _inline_js(): return r""" +function showCard(el) { + el.style.display = ''; + el.classList.remove('card-reveal'); + void el.offsetWidth; + el.classList.add('card-reveal'); + el.addEventListener('animationend', function() { el.classList.remove('card-reveal'); }, {once: true}); +} + function prefixToDotted(n) { if (n < 1 || n > 30) return ''; var mask = ((0xFFFFFFFF << (32 - n)) >>> 0); @@ -1866,7 +1874,7 @@ document.querySelectorAll('.row-edit-btn').forEach(function(btn) { field.value = row[key] != null ? String(row[key]) : ''; } }); - target.style.display = ''; + showCard(target); target.scrollIntoView({behavior: 'smooth', block: 'nearest'}); }); }); @@ -2405,7 +2413,7 @@ function startApplyPoller(uuid, bar, mine) { var origMacField = form.querySelector('[name="original_mac"]'); if (origMacField) origMacField.value = originalMac; if (form._resetDirtyState) form._resetDirtyState(); - card.style.display = ''; + showCard(card); card.scrollIntoView({behavior: 'smooth', block: 'nearest'}); }); }); diff --git a/docker/routlin-dash/data/page_content.json b/docker/routlin-dash/data/page_content.json index fab4312..64699a1 100644 --- a/docker/routlin-dash/data/page_content.json +++ b/docker/routlin-dash/data/page_content.json @@ -24,8 +24,8 @@ }, { "type": "button_primary", - "text": "Log In", - "action": "/view/view_log_in" + "action": "/view/view_log_in", + "text": "Log In" } ] } @@ -73,8 +73,8 @@ }, { "type": "card", - "client_requirement": "client_is_viewer+", "label": "Network", + "client_requirement": "client_is_viewer+", "items": [ { "type": "grid", @@ -133,8 +133,8 @@ }, { "type": "card", - "client_requirement": "client_is_viewer+", "label": "DNS Blocking", + "client_requirement": "client_is_viewer+", "items": [ { "type": "grid", @@ -193,8 +193,8 @@ }, { "type": "card", - "client_requirement": "client_is_viewer+", "label": "DNS Caching", + "client_requirement": "client_is_viewer+", "items": [ { "type": "grid", @@ -359,11 +359,11 @@ ], "row_actions": [ { - "text": "Edit", - "class": "btn-ghost btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/edit_ddns_provider", "method": "inline_edit", - "client_requirement": "client_is_administrator+", + "text": "Edit", + "class": "btn-ghost btn-sm", "fields": [ { "col": "description", @@ -389,11 +389,11 @@ ] }, { - "text": "Delete", - "class": "btn-danger btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/delete_ddns_provider", "method": "post", - "client_requirement": "client_is_administrator+" + "text": "Delete", + "class": "btn-danger btn-sm" } ] }, @@ -437,9 +437,9 @@ "items": [ { "type": "button_primary", - "text": "Add Provider", "action": "/action/add_ddns_provider", - "method": "post" + "method": "post", + "text": "Add Provider" }, { "type": "button_cancel", @@ -461,9 +461,9 @@ "items": [ { "type": "button_danger", - "text": "Clear Log", "action": "/action/clear_ddns_log", - "method": "post" + "method": "post", + "text": "Clear Log" } ] }, @@ -523,9 +523,9 @@ "items": [ { "type": "button_primary", - "text": "Save", "action": "/action/general_cardnetworkinterface_save", - "method": "post" + "method": "post", + "text": "Save" }, { "type": "button_cancel", @@ -537,62 +537,6 @@ } ] }, - { - "type": "card", - "label": "Upstream DNS", - "items": [ - { - "type": "form", - "action": "/action/general_cardupstreamdns_save", - "method": "post", - "items": [ - { - "type": "field", - "label": "Strict Order", - "name": "strict_order", - "input_type": "checkbox", - "value": "%DNS_STRICT_ORDER%", - "hint": "Query DNS providers in list order rather than in parallel." - }, - { - "type": "field", - "label": "Cache Size", - "name": "cache_size", - "input_type": "number", - "value": "%DNS_CACHE_SIZE%", - "min": 0, - "hint": "Max DNS responses to cache per instance. Set to 0 to disable caching." - }, - { - "type": "editable_list", - "label": "DNS Providers", - "name": "upstream_servers", - "items": "%DNS_UPSTREAM_SERVERS_JSON%", - "item_placeholder": "e.g. 1.1.1.1", - "add_label": "Add Provider", - "validate": "ip", - "hint": "DNS resolvers queried for external hostnames. Supports IPv4 and IPv6." - }, - { - "type": "button_row", - "items": [ - { - "type": "button_primary", - "text": "Save", - "action": "/action/general_cardupstreamdns_save", - "method": "post" - }, - { - "type": "button_cancel", - "text": "Cancel" - } - ] - } - ] - } - ], - "client_requirement": "client_is_administrator+" - }, { "type": "card", "id": "iface-config-card", @@ -635,28 +579,28 @@ "value": "", "options": [ { - "value": "576", - "label": "576" + "label": "576", + "value": "576" }, { - "value": "1280", - "label": "1280" + "label": "1280", + "value": "1280" }, { - "value": "1492", - "label": "1492" + "label": "1492", + "value": "1492" }, { - "value": "1500", - "label": "1500" + "label": "1500", + "value": "1500" }, { - "value": "4096", - "label": "4096" + "label": "4096", + "value": "4096" }, { - "value": "9000", - "label": "9000" + "label": "9000", + "value": "9000" } ] }, @@ -675,14 +619,14 @@ "items": [ { "type": "button_primary", - "text": "Apply", "action": "/action/apply_iface_config", - "method": "post" + "method": "post", + "text": "Apply" }, { "type": "button_secondary", - "text": "Cancel", "action": "#", + "text": "Cancel", "class": "iface-config-cancel" } ] @@ -691,9 +635,66 @@ } ] }, + { + "type": "card", + "label": "Upstream DNS", + "client_requirement": "client_is_administrator+", + "items": [ + { + "type": "form", + "action": "/action/general_cardupstreamdns_save", + "method": "post", + "items": [ + { + "type": "field", + "label": "Strict Order", + "name": "strict_order", + "input_type": "checkbox", + "value": "%DNS_STRICT_ORDER%", + "hint": "Query DNS providers in list order rather than in parallel." + }, + { + "type": "field", + "label": "Cache Size", + "name": "cache_size", + "input_type": "number", + "value": "%DNS_CACHE_SIZE%", + "min": 0, + "hint": "Max DNS responses to cache per instance. Set to 0 to disable caching." + }, + { + "type": "editable_list", + "label": "DNS Providers", + "name": "upstream_servers", + "item_placeholder": "e.g. 1.1.1.1", + "add_label": "Add Provider", + "validate": "ip", + "hint": "DNS resolvers queried for external hostnames. Supports IPv4 and IPv6.", + "items": "%DNS_UPSTREAM_SERVERS_JSON%" + }, + { + "type": "button_row", + "items": [ + { + "type": "button_primary", + "action": "/action/general_cardupstreamdns_save", + "method": "post", + "text": "Save" + }, + { + "type": "button_cancel", + "text": "Cancel" + } + ] + } + ] + } + ] + }, { "type": "card", "label": "Logging", + "client_requirement": "client_is_administrator+", "items": [ { "type": "form", @@ -730,9 +731,9 @@ "items": [ { "type": "button_primary", - "text": "Save", "action": "/action/general_cardlogging_save", - "method": "post" + "method": "post", + "text": "Save" }, { "type": "button_cancel", @@ -742,8 +743,7 @@ } ] } - ], - "client_requirement": "client_is_administrator+" + ] }, { "type": "card", @@ -768,9 +768,9 @@ "items": [ { "type": "button_primary", - "text": "Save", "action": "/action/general_cardpendingchanges_save", - "method": "post" + "method": "post", + "text": "Save" }, { "type": "button_cancel", @@ -832,10 +832,11 @@ ], "row_actions": [ { - "text": "Edit", - "class": "btn-ghost btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/edit_banned_ip", "method": "inline_edit", + "text": "Edit", + "class": "btn-ghost btn-sm", "fields": [ { "col": "description", @@ -849,21 +850,20 @@ "col": "enabled", "input_type": "checkbox" } - ], - "client_requirement": "client_is_administrator+" + ] }, { - "text": "Delete", - "class": "btn-danger btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/delete_banned_ip", "method": "post", - "client_requirement": "client_is_administrator+" + "text": "Delete", + "class": "btn-danger btn-sm" } ] }, { - "id": "add-form", "type": "card", + "id": "add-form", "label": "Add Banned IP", "client_requirement": "client_is_administrator+", "items": [ @@ -892,9 +892,9 @@ "items": [ { "type": "button_primary", - "text": "Add Banned IP", "action": "/action/add_banned_ip", - "method": "post" + "method": "post", + "text": "Add Banned IP" }, { "type": "button_cancel", @@ -952,11 +952,11 @@ ], "row_actions": [ { - "text": "Edit", - "class": "btn-ghost btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/edit_host_override", "method": "inline_edit", - "client_requirement": "client_is_administrator+", + "text": "Edit", + "class": "btn-ghost btn-sm", "fields": [ { "col": "description", @@ -979,17 +979,17 @@ ] }, { - "text": "Delete", - "class": "btn-danger btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/delete_host_override", "method": "post", - "client_requirement": "client_is_administrator+" + "text": "Delete", + "class": "btn-danger btn-sm" } ] }, { - "id": "add-form", "type": "card", + "id": "add-form", "label": "Add Host Override", "client_requirement": "client_is_administrator+", "items": [ @@ -1026,9 +1026,9 @@ "items": [ { "type": "button_primary", - "text": "Add Host Override", "action": "/action/add_host_override", - "method": "post" + "method": "post", + "text": "Add Host Override" }, { "type": "button_cancel", @@ -1085,11 +1085,11 @@ ], "row_actions": [ { - "text": "Edit", - "class": "btn-ghost btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/dnsserver_tableblocklist_rowedit", "method": "inline_edit", - "client_requirement": "client_is_administrator+", + "text": "Edit", + "class": "btn-ghost btn-sm", "fields": [ { "col": "name", @@ -1113,17 +1113,17 @@ ] }, { - "text": "Delete", - "class": "btn-danger btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/dnsserver_tableblocklists_rowdelete", "method": "post", - "client_requirement": "client_is_administrator+" + "text": "Delete", + "class": "btn-danger btn-sm" } ] }, { - "id": "add-form", "type": "card", + "id": "add-form", "label": "Add Blocklist", "client_requirement": "client_is_administrator+", "items": [ @@ -1167,9 +1167,9 @@ "items": [ { "type": "button_primary", - "text": "Add Blocklist", "action": "/action/dnsserver_cardaddblocklist_add", - "method": "post" + "method": "post", + "text": "Add Blocklist" }, { "type": "button_cancel", @@ -1195,9 +1195,9 @@ "items": [ { "type": "button_secondary", - "text": "Refresh All Now", "action": "/action/dnsserver_cardblocklistrefresh_refresh", - "method": "post" + "method": "post", + "text": "Refresh All Now" } ] }, @@ -1220,9 +1220,9 @@ "items": [ { "type": "button_primary", - "text": "Save", "action": "/action/dnsserver_cardblocklistrefresh_save", - "method": "post" + "method": "post", + "text": "Save" }, { "type": "button_cancel", @@ -1309,11 +1309,11 @@ ], "row_actions": [ { - "text": "Edit", - "class": "btn-ghost btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/edit_vlan", "method": "inline_edit", - "client_requirement": "client_is_administrator+", + "text": "Edit", + "class": "btn-ghost btn-sm", "fields": [ { "col": "name", @@ -1346,11 +1346,11 @@ ] }, { - "text": "Delete", - "class": "btn-danger btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/delete_vlan", "method": "post", - "client_requirement": "client_is_administrator+", + "text": "Delete", + "class": "btn-danger btn-sm", "disable_if": { "field": "vlan_id", "value": 1 @@ -1359,8 +1359,8 @@ ] }, { - "id": "add-form", "type": "card", + "id": "add-form", "label": "Add VLAN", "client_requirement": "client_is_administrator+", "items": [ @@ -1455,9 +1455,9 @@ "items": [ { "type": "button_primary", - "text": "Add VLAN", "action": "/action/add_vlan", "method": "post", + "text": "Add VLAN", "class": "add-vlan-btn", "disabled": true }, @@ -1527,11 +1527,11 @@ ], "row_actions": [ { - "text": "Edit", - "class": "btn-ghost btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/edit_inter_vlan", "method": "inline_edit", - "client_requirement": "client_is_administrator+", + "text": "Edit", + "class": "btn-ghost btn-sm", "fields": [ { "col": "description", @@ -1561,17 +1561,17 @@ ] }, { - "text": "Delete", - "class": "btn-danger btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/delete_inter_vlan", "method": "post", - "client_requirement": "client_is_administrator+" + "text": "Delete", + "class": "btn-danger btn-sm" } ] }, { - "id": "add-form", "type": "card", + "id": "add-form", "label": "Add Exception", "client_requirement": "client_is_administrator+", "items": [ @@ -1623,9 +1623,9 @@ "items": [ { "type": "button_primary", - "text": "Add Exception", "action": "/action/add_inter_vlan", - "method": "post" + "method": "post", + "text": "Add Exception" }, { "type": "button_cancel", @@ -1693,11 +1693,11 @@ ], "row_actions": [ { - "text": "Edit", - "class": "btn-ghost btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/edit_port_forward", "method": "inline_edit", - "client_requirement": "client_is_administrator+", + "text": "Edit", + "class": "btn-ghost btn-sm", "fields": [ { "col": "description", @@ -1727,17 +1727,17 @@ ] }, { - "text": "Delete", - "class": "btn-danger btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/delete_port_forward", "method": "post", - "client_requirement": "client_is_administrator+" + "text": "Delete", + "class": "btn-danger btn-sm" } ] }, { - "id": "add-form", "type": "card", + "id": "add-form", "label": "Add Rule", "client_requirement": "client_is_administrator+", "items": [ @@ -1789,9 +1789,9 @@ "items": [ { "type": "button_primary", - "text": "Add Rule", "action": "/action/add_port_forward", - "method": "post" + "method": "post", + "text": "Add Rule" }, { "type": "button_cancel", @@ -1903,11 +1903,11 @@ }, "row_actions": [ { - "text": "Edit", - "class": "btn-ghost btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/edit_dhcp_reservation", "method": "inline_edit", - "client_requirement": "client_is_administrator+", + "text": "Edit", + "class": "btn-ghost btn-sm", "fields": [ { "col": "description", @@ -1939,17 +1939,17 @@ ] }, { - "text": "Delete", - "class": "btn-danger btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/delete_dhcp_reservation", "method": "post", - "client_requirement": "client_is_administrator+" + "text": "Delete", + "class": "btn-danger btn-sm" } ] }, { - "id": "add-form", "type": "card", + "id": "add-form", "label": "Add Reservation", "client_requirement": "client_is_administrator+", "items": [ @@ -2009,9 +2009,9 @@ "items": [ { "type": "button_primary", - "text": "Add Reservation", "action": "/action/add_dhcp_reservation", - "method": "post" + "method": "post", + "text": "Add Reservation" }, { "type": "button_cancel", @@ -2115,11 +2115,11 @@ ], "row_actions": [ { - "text": "Edit", - "class": "btn-ghost btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/edit_vpn_peer", "method": "inline_edit", - "client_requirement": "client_is_administrator+", + "text": "Edit", + "class": "btn-ghost btn-sm", "fields": [ { "col": "name", @@ -2137,18 +2137,18 @@ ] }, { - "text": "Regen Conf", - "class": "btn-ghost btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/regenerate_vpn_peer", "method": "post", - "client_requirement": "client_is_administrator+" + "text": "Regen Conf", + "class": "btn-ghost btn-sm" }, { - "text": "Delete", - "class": "btn-danger btn-sm", + "client_requirement": "client_is_administrator+", "action": "/action/delete_vpn_peer", "method": "post", - "client_requirement": "client_is_administrator+" + "text": "Delete", + "class": "btn-danger btn-sm" } ] }, @@ -2206,9 +2206,9 @@ "items": [ { "type": "button_primary", - "text": "Add Peer & Download Conf", "action": "/action/add_vpn_peer", - "method": "post" + "method": "post", + "text": "Add Peer & Download Conf" }, { "type": "button_cancel", @@ -2222,8 +2222,8 @@ }, { "type": "card", - "client_requirement": "client_is_administrator+", "label": "WireGuard Interface", + "client_requirement": "client_is_administrator+", "items": [ { "type": "form", @@ -2284,9 +2284,9 @@ "items": [ { "type": "button_primary", - "text": "Save", "action": "/action/apply_vpn", - "method": "post" + "method": "post", + "text": "Save" }, { "type": "button_cancel", @@ -2343,9 +2343,9 @@ }, { "type": "button_primary", - "text": "Log In", "action": "/action/log_in", "method": "post", + "text": "Log In", "class": "btn-full" } ] @@ -2354,8 +2354,8 @@ "type": "p", "text": "Need to complete your account?", "link": { - "text": "Create Account", - "action": "/view/view_create_account" + "action": "/view/view_create_account", + "text": "Create Account" } } ] @@ -2379,8 +2379,8 @@ }, { "type": "button_primary", - "text": "Go to Overview", - "action": "/view/overview" + "action": "/view/overview", + "text": "Go to Overview" } ] } @@ -2446,9 +2446,9 @@ }, { "type": "button_primary", - "text": "Create Account", "action": "/action/create_account", "method": "post", + "text": "Create Account", "class": "btn-full" } ] @@ -2457,8 +2457,8 @@ "type": "p", "text": "Already have an account?", "link": { - "text": "Log In", - "action": "/view/view_log_in" + "action": "/view/view_log_in", + "text": "Log In" } } ] @@ -2482,8 +2482,8 @@ }, { "type": "button_primary", - "text": "Go to Overview", - "action": "/view/overview" + "action": "/view/overview", + "text": "Go to Overview" } ] } @@ -2523,9 +2523,9 @@ }, { "type": "button_primary", - "text": "Verify", "action": "/action/verify_email", "method": "post", + "text": "Verify", "class": "btn-full" } ] @@ -2534,16 +2534,16 @@ "type": "p", "text": "Didn't receive it?", "link": { - "text": "Resend code", - "action": "/action/resend_verification" + "action": "/action/resend_verification", + "text": "Resend code" } }, { "type": "p", "text": "Wrong email?", "link": { - "text": "Start over", - "action": "/view/view_create_account" + "action": "/view/view_create_account", + "text": "Start over" } } ] @@ -2567,8 +2567,8 @@ }, { "type": "button_primary", - "text": "Go to Overview", - "action": "/view/view_overview" + "action": "/view/view_overview", + "text": "Go to Overview" } ] } @@ -2622,9 +2622,9 @@ "items": [ { "type": "button_primary", - "text": "Save Preferences", "action": "/action/save_preferences", - "method": "post" + "method": "post", + "text": "Save Preferences" } ] } @@ -2667,9 +2667,9 @@ "items": [ { "type": "button_primary", - "text": "Change Password", "action": "/action/change_password", - "method": "post" + "method": "post", + "text": "Change Password" } ] } @@ -2721,10 +2721,10 @@ ], "row_actions": [ { - "text": "Remove", - "class": "btn-danger btn-sm", "action": "/action/delete_account", - "method": "post" + "method": "post", + "text": "Remove", + "class": "btn-danger btn-sm" } ] }, @@ -2757,9 +2757,9 @@ "items": [ { "type": "button_primary", - "text": "Authorize", "action": "/action/add_account", - "method": "post" + "method": "post", + "text": "Authorize" } ] }