From 7f25e3b555064087a91ac0e7625993c54150669d Mon Sep 17 00:00:00 2001 From: Tyler Todd Date: Thu, 2 Feb 2023 21:19:15 +0000 Subject: [PATCH] Initial go at upgrading from Bootstap v3 to v4 and to AdminLTE v3.2.0 --- package.json | 12 +- powerdnsadmin/static/custom/js/custom.js | 16 +- .../templates/admin_edit_account.html | 56 +-- powerdnsadmin/templates/admin_edit_key.html | 67 ++-- powerdnsadmin/templates/admin_edit_user.html | 19 + .../templates/admin_global_search.html | 20 ++ powerdnsadmin/templates/admin_history.html | 141 ++++---- .../templates/admin_manage_account.html | 132 +++---- .../templates/admin_manage_keys.html | 129 +++---- .../templates/admin_manage_user.html | 37 +- powerdnsadmin/templates/admin_pdns_stats.html | 20 ++ .../admin_setting_authentication.html | 60 ++-- .../templates/admin_setting_basic.html | 121 ++++--- .../templates/admin_setting_pdns.html | 4 +- powerdnsadmin/templates/base.html | 331 +++++++++++------- powerdnsadmin/templates/errors/400.html | 77 ++-- powerdnsadmin/templates/errors/403.html | 69 ++-- powerdnsadmin/templates/errors/404.html | 69 ++-- powerdnsadmin/templates/errors/500.html | 69 ++-- powerdnsadmin/templates/errors/SAML.html | 89 +++-- powerdnsadmin/templates/login.html | 315 +++++++++-------- powerdnsadmin/templates/register.html | 253 +++++++------ powerdnsadmin/templates/template_add.html | 29 +- requirements.txt | 42 +-- 24 files changed, 1246 insertions(+), 931 deletions(-) diff --git a/package.json b/package.json index 76982c8..a375986 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { "dependencies": { - "admin-lte": "2.4.9", - "bootstrap": "^3.4.1", - "bootstrap-datepicker": "^1.8.0", + "admin-lte": "3.2.0", + "bootstrap": "4.6.2", + "bootstrap-datepicker": "^1.9.0", "bootstrap-validator": "^0.11.9", - "datatables.net-plugins": "^1.10.19", + "datatables.net-plugins": "^1.13.1", "icheck": "^1.0.2", "jquery-slimscroll": "^1.3.8", - "jquery-ui-dist": "^1.12.1", + "jquery-ui-dist": "^1.13.2", "jquery.quicksearch": "^2.4.0", - "jtimeout": "^3.1.0", + "jtimeout": "^3.2.0", "multiselect": "^0.9.12" } } diff --git a/powerdnsadmin/static/custom/js/custom.js b/powerdnsadmin/static/custom/js/custom.js index e4b72b1..0f096bf 100644 --- a/powerdnsadmin/static/custom/js/custom.js +++ b/powerdnsadmin/static/custom/js/custom.js @@ -287,4 +287,18 @@ function copy_otp_secret_to_clipboard() { navigator.clipboard.writeText(copyBox.value); $("#copy_tooltip").css("visibility", "visible"); setTimeout(function(){ $("#copy_tooltip").css("visibility", "collapse"); }, 2000); - } \ No newline at end of file + } + +// Side menu nav bar active selection +/** add active class and stay opened when selected */ +var url = window.location; + +// for sidebar menu entirely but not cover treeview +$('ul.nav-sidebar a').filter(function() { + return this.href == url; +}).addClass('active'); + +// for treeview +$('ul.nav-treeview a').filter(function() { + return this.href == url; +}).parentsUntil(".nav-sidebar > .nav-treeview").addClass('menu-open').prev('a').addClass('active'); diff --git a/powerdnsadmin/templates/admin_edit_account.html b/powerdnsadmin/templates/admin_edit_account.html index 1946bc9..08403b9 100644 --- a/powerdnsadmin/templates/admin_edit_account.html +++ b/powerdnsadmin/templates/admin_edit_account.html @@ -4,26 +4,34 @@ {% block dashboard_stat %} -
-

- Account - {% if create %}New account{% else %}{{ account.name }}{% endif %} -

- -
+
+
+
+
+

+ Account + {% if create %}New account{% else %}{{ account.name }}{% endif %} +

+
+
+ +
+
+
+
{% endblock %} {% block content %}
-
-
-

{% if create %}Add{% else %}Edit{% endif %} account

+
+
+

{% if create %}Add{% else %}Edit{% endif %} account

@@ -31,7 +39,7 @@ action="{% if create %}{{ url_for('admin.edit_account') }}{% else %}{{ url_for('admin.edit_account', account_name=account.name) }}{% endif %}"> -
+
{% if error %}
@@ -73,10 +81,10 @@
-
-

Access Control

+
+

Access Control

-
+

Users on the right have access to manage records in all domains associated with the account.

Click on users to move between columns.

@@ -90,7 +98,7 @@
- -
-
-
-

Help with creating a new account

+
+
+
+

Help with creating a new account

-
+

An account allows grouping of domains belonging to a particular entity, such as a customer or department.
diff --git a/powerdnsadmin/templates/admin_edit_key.html b/powerdnsadmin/templates/admin_edit_key.html index 6a94340..a97afcb 100644 --- a/powerdnsadmin/templates/admin_edit_key.html +++ b/powerdnsadmin/templates/admin_edit_key.html @@ -6,26 +6,35 @@ {% endblock %} {% block dashboard_stat %} -

-

- Key - {% if create %}New key{% else %}{{ key.id }}{% endif %} -

- -
+
+
+
+
+

+ API Keys + {% if create %}Add API Key{% else %}Edit API Key - {{ key.id }}{% endif %} +

+
+
+ +
+
+
+
+ {% endblock %} {% block content %}
-
-
-
-
-

{% if create %}Add{% else %}Edit{% endif %} key

+
+
+
+
+

{% if create %}Add{% else %}Edit{% endif %} Key

@@ -33,7 +42,7 @@ action="{% if create %}{{ url_for('admin.edit_key') }}{% else %}{{ url_for('admin.edit_key', key_id=key.id) }}{% endif %}"> -
+
-
+ +
+
+
+
+

+ Dashboard + Control panel +

+
+
+ +
+
+
+
{% endblock %} {% block content %} diff --git a/powerdnsadmin/templates/admin_global_search.html b/powerdnsadmin/templates/admin_global_search.html index 2e38bf1..815230c 100644 --- a/powerdnsadmin/templates/admin_global_search.html +++ b/powerdnsadmin/templates/admin_global_search.html @@ -13,6 +13,26 @@
  • Global Search
  • + +
    +
    +
    +
    +

    + Dashboard + Control panel +

    +
    +
    + +
    +
    +
    +
    + {% endblock %} {% block content %}
    diff --git a/powerdnsadmin/templates/admin_history.html b/powerdnsadmin/templates/admin_history.html index aa16c4a..23b45b9 100644 --- a/powerdnsadmin/templates/admin_history.html +++ b/powerdnsadmin/templates/admin_history.html @@ -4,15 +4,26 @@ History - {{ SITE_NAME }} {% endblock %} {% block dashboard_stat %} -
    -

    - History Recent events -

    - -
    + +
    +
    +
    +
    +

    + History + Recent Events +

    +
    +
    + +
    +
    +
    +
    + {% endblock %} {% block content %} {% import 'applied_change_macro.html' as applied_change_macro %} @@ -20,57 +31,57 @@
    +
    -
    -
    -
    -

    History Management

    +
    +
    +
    +

    History Management

    +
    +
    + +
    +
    +
    +
    {% endblock %} {% block extrascripts %} diff --git a/powerdnsadmin/templates/admin_manage_keys.html b/powerdnsadmin/templates/admin_manage_keys.html index dadc2a0..9f2c682 100644 --- a/powerdnsadmin/templates/admin_manage_keys.html +++ b/powerdnsadmin/templates/admin_manage_keys.html @@ -3,72 +3,75 @@ {% block title %} Key Management - {{ SITE_NAME }} {% endblock %} {% block dashboard_stat %} -
    -

    - Key Manage API keys -

    - -
    +
    +
    +
    +
    +

    + API Keys + Management +

    +
    +
    + +
    +
    +
    +
    {% endblock %} {% block content %}
    -
    -
    -
    -
    -

    Key Management

    -
    - -
    - - - - - - - - - - - - - {% for key in keys %} - - - - - - - - - {% endfor %} - -
    IdRoleDescriptionDomainsAccountsAction
    {{ key.id }}{{ key.role.name }}{{ key.description }}{% for domain in key.domains %}{{ domain.name }}{% if not loop.last %}, {% endif %}{% endfor %}{% for account in key.accounts %}{{ account.name }}{% if not loop.last %}, {% endif %}{% endfor %} - - -
    -
    - -
    - -
    - +
    +
    +
    +

    Key Management

    +
    + +
    + + + + + + + + + + + + + {% for key in keys %} + + + + + + + + + {% endfor %} + +
    IdRoleDescriptionDomainsAccountsAction
    {{ key.id }}{{ key.role.name }}{{ key.description }}{% for domain in key.domains %}{{ domain.name }}{% if not loop.last %}, {% endif %}{% endfor %}{% for account in key.accounts %}{{ account.name }}{% if not loop.last %}, {% endif %}{% endfor %} + + +
    +
    - +
    {% endblock %} {% block extrascripts %} diff --git a/powerdnsadmin/templates/admin_manage_user.html b/powerdnsadmin/templates/admin_manage_user.html index d6a7204..f1b6022 100644 --- a/powerdnsadmin/templates/admin_manage_user.html +++ b/powerdnsadmin/templates/admin_manage_user.html @@ -3,31 +3,40 @@ {% block title %} User Management - {{ SITE_NAME }} {% endblock %} {% block dashboard_stat %} -
    -

    - User Manage user privileges -

    - -
    +
    +
    +
    +
    +

    + User + Manage user privileges +

    +
    +
    + +
    +
    +
    +
    {% endblock %} {% block content %}
    -
    -
    -

    User Management

    +
    +
    +

    User Management

    -
    + -
    +
    diff --git a/powerdnsadmin/templates/admin_pdns_stats.html b/powerdnsadmin/templates/admin_pdns_stats.html index cd5a000..84a1ec6 100644 --- a/powerdnsadmin/templates/admin_pdns_stats.html +++ b/powerdnsadmin/templates/admin_pdns_stats.html @@ -13,6 +13,26 @@
  • Admin Console
  • + +
    +
    +
    +
    +

    + Dashboard + Control panel +

    +
    +
    + +
    +
    +
    +
    + {% endblock %} {% block content %} diff --git a/powerdnsadmin/templates/admin_setting_authentication.html b/powerdnsadmin/templates/admin_setting_authentication.html index 5d0fd10..0509cbb 100644 --- a/powerdnsadmin/templates/admin_setting_authentication.html +++ b/powerdnsadmin/templates/admin_setting_authentication.html @@ -4,33 +4,43 @@ Authentication Settings - {{ SITE_NAME }} {% endblock %} {% block dashboard_stat %} -
    -

    - Settings PowerDNS-Admin settings -

    - - + + + + - window.onload = function() { - ldapSelection(); - } - -
    {% endblock %} {% block content %}
    diff --git a/powerdnsadmin/templates/admin_setting_basic.html b/powerdnsadmin/templates/admin_setting_basic.html index d3d0905..3df8fc0 100644 --- a/powerdnsadmin/templates/admin_setting_basic.html +++ b/powerdnsadmin/templates/admin_setting_basic.html @@ -4,66 +4,73 @@ Basic Settings - {{ SITE_NAME }} {% endblock %} {% block dashboard_stat %} -
    -

    - Settings PowerDNS-Admin settings -

    - -
    +
    +
    +
    +
    +

    + Settings + Basic +

    +
    +
    + +
    +
    +
    +
    + {% endblock %} {% block content %}
    -
    -
    -
    -
    -

    Basic Settings

    -
    -
    -
    - - - - - - - - - {% for setting in settings %} - - - {% if SETTING.get(setting) in [True, False] %} - - - {% else %} - - - {% endif %} - - {% endfor %} - -
    NameValueChange
    {{ setting }}{{ SETTING.get(setting)|display_setting_state }} - - - -
    -
    - -
    - -
    - +
    +
    +
    +

    Basic Settings

    +
    +
    + + + + + + + + + + {% for setting in settings %} + + + {% if SETTING.get(setting) in [True, False] %} + + + {% else %} + + + {% endif %} + + {% endfor %} + +
    NameValueChange
    + {{ setting }} + {{ SETTING.get(setting)|display_setting_state }} + + + + + +
    +
    - +
    {% endblock %} {% block extrascripts %} diff --git a/powerdnsadmin/templates/admin_setting_pdns.html b/powerdnsadmin/templates/admin_setting_pdns.html index 84f86a9..08b42f1 100644 --- a/powerdnsadmin/templates/admin_setting_pdns.html +++ b/powerdnsadmin/templates/admin_setting_pdns.html @@ -4,7 +4,7 @@ PDNS Settings - {{ SITE_NAME }} {% endblock %} {% block dashboard_stat %} -
    +

    Settings PowerDNS-Admin settings

    @@ -13,7 +13,7 @@
  • Setting
  • PDNS
  • -
    +
    {% endblock %} {% block content %}
    diff --git a/powerdnsadmin/templates/base.html b/powerdnsadmin/templates/base.html index 35bfc51..f3261dd 100644 --- a/powerdnsadmin/templates/base.html +++ b/powerdnsadmin/templates/base.html @@ -2,37 +2,85 @@ {% block head %} - - - - {% block title %}{{ SITE_NAME }}{% endblock %} - - - - - - - - - {% assets "css_main" -%} + + + + {% block title %} + + {{ SITE_NAME }} + + {% endblock %} + + + + + + + + + + {% assets "css_main" -%} - {%- endassets %} -{% if SETTING.get('custom_css') %} - -{% endif %} + {%- endassets %} + {% if SETTING.get('custom_css') %} + + {% endif %} {% endblock %} + -{% set user_image_url = url_for('user.image', username=current_user.username) %} -
    + {% set user_image_url = url_for('user.image', username=current_user.username) %} +
    {% block pageheader %} -
    + + + {% endblock %} + +
    - {% endblock %} - -
    @@ -169,16 +224,24 @@
    {% block dashboard_stat %} -
    -

    - Dashboard - Control panel -

    - -
    +
    +
    +
    +
    +

    + Dashboard + Control panel +

    +
    +
    + +
    +
    +
    +
    {% endblock %} {% block content %} {% endblock %} @@ -382,4 +445,4 @@ {% block modals %} {% endblock %} - + \ No newline at end of file diff --git a/powerdnsadmin/templates/errors/400.html b/powerdnsadmin/templates/errors/400.html index ec53684..b2ca864 100644 --- a/powerdnsadmin/templates/errors/400.html +++ b/powerdnsadmin/templates/errors/400.html @@ -1,41 +1,52 @@ {% extends "base.html" %} -{% block title %}PowerDNS-Admin - 400 Error{% endblock %} + +{% block title %} + + {{ SITE_NAME }} - 400 Error + +{% endblock %} {% block dashboard_stat %} - -
    -

    - 400 - Error -

    - -
    +
    +
    +
    +
    +

    + 400 + Error +

    +
    +
    + +
    +
    +
    +
    {% endblock %} {% block content %} - -
    +
    -

    400

    -
    -

    - Oops! Bad request -

    -

    - {% if msg %} - {{ msg }} - {% else %} - The server refused to process your request and return a 400 error. - {% endif %} -
    You may return to the dashboard. -

    -
    - +

    + 400 +

    +
    +

    + + Oops! Bad request +

    +

    + {% if msg %} + {{ msg }} + {% else %} + The server refused to process your request and return a 400 error. + {% endif %} +
    You may return to the dashboard. +

    +
    - -
    - -{% endblock %} +
    +{% endblock %} \ No newline at end of file diff --git a/powerdnsadmin/templates/errors/403.html b/powerdnsadmin/templates/errors/403.html index ffe96bf..f629eb8 100644 --- a/powerdnsadmin/templates/errors/403.html +++ b/powerdnsadmin/templates/errors/403.html @@ -1,37 +1,48 @@ {% extends "base.html" %} -{% block title %}PowerDNS-Admin - 403 Error{% endblock %} + +{% block title %} + + {{ SITE_NAME }} - 403 Error + +{% endblock %} {% block dashboard_stat %} - -
    -

    - 403 - Error -

    - -
    +
    +
    +
    +
    +

    + 403 + Error +

    +
    +
    + +
    +
    +
    +
    {% endblock %} {% block content %} - -
    +
    -

    403

    -
    -

    - Oops! Access denied -

    -

    - You don't have permission to access this page - You may return to the dashboard. -

    -
    - +

    + 403 +

    +
    +

    + + Oops! Access denied +

    +

    + You don't have permission to access this page + You may return to the dashboard. +

    +
    - -
    - -{% endblock %} +
    +{% endblock %} \ No newline at end of file diff --git a/powerdnsadmin/templates/errors/404.html b/powerdnsadmin/templates/errors/404.html index a93c731..858731f 100644 --- a/powerdnsadmin/templates/errors/404.html +++ b/powerdnsadmin/templates/errors/404.html @@ -1,37 +1,48 @@ {% extends "base.html" %} -{% block title %}PowerDNS-Admin - 404 Error{% endblock %} + +{% block title %} + + {{ SITE_NAME }} - 404 Error + +{% endblock %} {% block dashboard_stat %} - -
    -

    - 404 - Error -

    - -
    +
    +
    +
    +
    +

    + 404 + Error +

    +
    +
    + +
    +
    +
    +
    {% endblock %} {% block content %} - -
    +
    -

    404

    -
    -

    - Oops! You're lost -

    -

    - The page you requested could not be found. - You may return to the dashboard. -

    -
    - +

    + 404 +

    +
    +

    + + Oops! You're lost +

    +

    + The page you requested could not be found. + You may return to the dashboard. +

    +
    - -
    - -{% endblock %} +
    +{% endblock %} \ No newline at end of file diff --git a/powerdnsadmin/templates/errors/500.html b/powerdnsadmin/templates/errors/500.html index d223b0b..51142f0 100644 --- a/powerdnsadmin/templates/errors/500.html +++ b/powerdnsadmin/templates/errors/500.html @@ -1,37 +1,48 @@ {% extends "base.html" %} -{% block title %}PowerDNS-Admin - 500 Error{% endblock %} + +{% block title %} + + {{ SITE_NAME }} - 500 Error + +{% endblock %} {% block dashboard_stat %} - -
    -

    - 500 - Error -

    - -
    +
    +
    +
    +
    +

    + 500 + Error +

    +
    +
    + +
    +
    +
    +
    {% endblock %} {% block content %} - -
    +
    -

    500

    -
    -

    - Oops! Something went wrong -

    -

    - Try again later. - You may return to the dashboard. -

    -
    - +

    + 500 +

    +
    +

    + + Oops! Something went wrong +

    +

    + Try again later. + You may return to the dashboard. +

    +
    - -
    - -{% endblock %} +
    +{% endblock %} \ No newline at end of file diff --git a/powerdnsadmin/templates/errors/SAML.html b/powerdnsadmin/templates/errors/SAML.html index 2cfacbd..c779022 100644 --- a/powerdnsadmin/templates/errors/SAML.html +++ b/powerdnsadmin/templates/errors/SAML.html @@ -1,45 +1,60 @@ {% extends "base.html" %} -{% block title %}PowerDNS-Admin - SAML Authentication Error{% endblock %} + +{% block title %} + + {{ SITE_NAME }} - SAML Authentication Error + +{% endblock %} {% block dashboard_stat %} - -
    -

    - SAML - Error -

    - -
    +
    +
    +
    +
    +

    + SAML + Error +

    +
    +
    + +
    +
    +
    +
    {% endblock %} {% block content %} - -
    +
    -
    -

    SAML Authentication Error



    -
    -

    - Oops! Something went wrong -


    -

    - Login failed.
    - Error(s) when processing SAML Response:
    -

      - {% for error in errors %} -
    • {{ error }}
    • - {% endfor %} -
    - - You may return to the dashboard. -

    -
    - +
    +

    + SAML Authentication Error +

    +
    +
    +
    +
    +

    + Oops! Something went wrong +

    +
    +

    + Login failed. +
    + Error(s) when processing SAML Response: +
    +

      + {% for error in errors %} +
    • {{ error }}
    • + {% endfor %} +
    + You may return to the dashboard. +

    +
    - -
    - -{% endblock %} +
    +{% endblock %} \ No newline at end of file diff --git a/powerdnsadmin/templates/login.html b/powerdnsadmin/templates/login.html index 805422b..02f3e41 100644 --- a/powerdnsadmin/templates/login.html +++ b/powerdnsadmin/templates/login.html @@ -1,166 +1,171 @@ - - - - - Log In - {{ SITE_NAME }} - - - - - {% assets "css_login" -%} - - {%- endassets %} -{% if SETTING.get('custom_css') %} - -{% endif %} - - - -