ashb commented on a change in pull request #10162:
URL: https://github.com/apache/airflow/pull/10162#discussion_r466428729



##########
File path: tests/test_configuration.py
##########
@@ -658,3 +658,16 @@ def test_store_dag_code_config_when_set(self):
         self.assertTrue(conf.has_option("core", "store_dag_code"))
         self.assertTrue(store_serialized_dags)
         self.assertFalse(store_dag_code)
+
+    @conf_vars({("webserver", "site_title"): "True"})
+    def test_site_title_config_when_set(self):
+        site_title_config = conf.get(section="webserver", key="site_title", 
fallback="DAGs")
+        self.assertTrue(conf.has_option("webserver", "site_title"))
+        self.assertTrue(bool(site_title_config))
+
+    @conf_vars({("webserver", "site_title"): None})
+    def test_site_title_config_when_not_set(self):

Review comment:
       Not need either

##########
File path: airflow/www/views.py
##########
@@ -336,11 +336,19 @@ def get_int_arg(value, default=0):
         state_color_mapping = State.state_color.copy()
         state_color_mapping["null"] = state_color_mapping.pop(None)
 
+        page_title = "Airflow - DAGs"
+        site_title = conf.get(section="webserver", key="site_title", 
fallback="DAGs")
+        if site_title != "DAGs":
+            site_title = site_title.replace("\"", "").replace("'", "")

Review comment:
       This shouldn't be needed.

##########
File path: tests/test_configuration.py
##########
@@ -658,3 +658,16 @@ def test_store_dag_code_config_when_set(self):
         self.assertTrue(conf.has_option("core", "store_dag_code"))
         self.assertTrue(store_serialized_dags)
         self.assertFalse(store_dag_code)
+
+    @conf_vars({("webserver", "site_title"): "True"})
+    def test_site_title_config_when_set(self):

Review comment:
       This year isn't needed - it is host testing the config loading which is 
already well tested

##########
File path: docs/howto/customize-dag-ui-page-site-title.rst
##########
@@ -0,0 +1,55 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+Customizing DAG UI header and page titles
+=========================================
+
+Airflow now allows you to customise the DAG home page header and page title. 
This will help
+distinguish between various installations of Airflow or simply amend the page 
text.
+
+Note: the custom title will be applied to both the page header and the page 
title.
+
+To make this change, simply:
+
+1.  Add the configuration option of ``site_title`` under ``webserver`` inside 
``airflow.cfg``:
+
+.. code-block::
+
+  [webserver]
+
+  site_title = "Text from airflow.cfg"

Review comment:
       Remove quotes here




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to