From 593644d9f0cd292a2788898939939b444b4784c0 Mon Sep 17 00:00:00 2001 From: Thirumalesh Aaraveti Date: Tue, 3 Dec 2024 12:21:25 +0530 Subject: [PATCH] feat: add dynamic lab_name to wiki fixes: https://github.com/redhat-performance/quads/issues/537 * additionally, set irc notifications to false as a default. Change-Id: Ic799667c9a35bd82e6c2dc05fbd982f8071a5224 --- README.md | 5 +---- conf/quads.yml | 5 +++-- src/quads/web/app.py | 6 ++++++ src/quads/web/templates/base.html | 2 +- src/quads/web/templates/wiki/inventory.html | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e418f74f..5e7268bd 100644 --- a/README.md +++ b/README.md @@ -602,10 +602,7 @@ Additionally, you can pass `--year` instead for a report for every month in that ## Customizing Environment Web Details ### Changing the Default Lab Name -Until [this RFE](https://github.com/redhat-performance/quads/issues/537) is completed you'll need to change your lab name, or what you want to call your QUADS-managed environment in two separate `quads-web` files: - -* Edit the [inventory.html](https://github.com/redhat-performance/quads/blob/latest/src/quads/web/templates/wiki/inventory.html#L5) -* Edit the [navbar.html](https://github.com/redhat-performance/quads/blob/latest/src/quads/web/templates/navbar.html#L2) +You can change the default QUADS environment name by modifying the `lab_name` variable in the [quads.yml](https://github.com/redhat-performance/quads/blob/latest/conf/quads.yml#L11) Restart `quads-web` to take effect. diff --git a/conf/quads.yml b/conf/quads.yml index ce64a453..535aeced 100644 --- a/conf/quads.yml +++ b/conf/quads.yml @@ -7,7 +7,8 @@ spare_pool_name: cloud01 spare_pool_description: "Spare Pool" spare_pool_owner: quads - +# Define the name of the QUADS environment +lab_name: "Lab" # display name for QUADS email notifications mail_display_name: "QUADS Scheduler" # set header for User-Agent: @@ -35,7 +36,7 @@ email_host: 172.16.0.1 # * Note* you'll need Supybot with the notify plugin # these setting use netcat to send messages to Supybot -irc_notify: true +irc_notify: false ircbot_ipaddr: 192.168.0.100 ircbot_port: 5050 ircbot_channel: #yourchannel diff --git a/src/quads/web/app.py b/src/quads/web/app.py index 79954491..695fc6e9 100644 --- a/src/quads/web/app.py +++ b/src/quads/web/app.py @@ -39,6 +39,11 @@ def initiate_navbar(flask_app): navbar.init_app(flask_app) +def set_global_variables(flask_app): + lab_name = Config.get("lab_name") + flask_app.add_template_global(lab_name, name="lab_name") + + def create_app() -> Flask: flask_app = Flask(__name__) flask_app.url_map.strict_slashes = False @@ -50,5 +55,6 @@ def create_app() -> Flask: flask_app.register_blueprint(instack_bp, url_prefix="/instack") flask_app.register_blueprint(wiki_bp) initiate_navbar(flask_app) + set_global_variables(flask_app) return flask_app diff --git a/src/quads/web/templates/base.html b/src/quads/web/templates/base.html index 16eb6202..e6192354 100644 --- a/src/quads/web/templates/base.html +++ b/src/quads/web/templates/base.html @@ -50,7 +50,7 @@ {% block navbar %}
-

RDU2 Scale Lab Dynamic +

{{ lab_name }} Dynamic Inventory

{{ nav.navbar.render(renderer="BootStrapRender5") }}
diff --git a/src/quads/web/templates/wiki/inventory.html b/src/quads/web/templates/wiki/inventory.html index 72d9531e..3ae29586 100644 --- a/src/quads/web/templates/wiki/inventory.html +++ b/src/quads/web/templates/wiki/inventory.html @@ -2,7 +2,7 @@ {% block title %}Inventory{% endblock %} {% block page_content %} -

RDU ScaleLab Dashboard

+

{{ lab_name }} Dashboard