From 1f19522a8559ea4a26237c655175a8d150f9297c Mon Sep 17 00:00:00 2001 From: lin-hua-cheng Date: Thu, 24 Sep 2015 11:34:52 -0700 Subject: [PATCH] Add optional Report Bug link to Horizon Change-Id: I2d0053adbdfcb196683c709f755f778427e6109b Closes-Bug: #1499476 --- doc/source/topics/settings.rst | 13 ++++++++++++- horizon/conf/default.py | 3 +++ horizon/test/settings.py | 1 + openstack_dashboard/local/local_settings.py.example | 5 +++++ openstack_dashboard/settings.py | 1 + openstack_dashboard/templates/500.html | 3 +++ openstack_dashboard/templates/_header.html | 8 ++++++++ .../themes/material/templates/_header.html | 8 ++++++++ 8 files changed, 41 insertions(+), 1 deletion(-) diff --git a/doc/source/topics/settings.rst b/doc/source/topics/settings.rst index 3d01981e6b..dfaf45ea97 100755 --- a/doc/source/topics/settings.rst +++ b/doc/source/topics/settings.rst @@ -147,6 +147,17 @@ If provided, will auto-fade the alert types specified. Valid alert types include: ['alert-success', 'alert-info', 'alert-warning', 'alert-error'] Can also define the delay before the alert fades and the fade out duration. +``bug_url`` +------------ + +.. versionadded:: 9.0.0(Mitaka) + +Default: ``None`` + +If provided, a "Report Bug" link will be displayed in the site header which +links to the value of this setting (ideally a URL containing information on +how to report issues). + ``help_url`` ------------ @@ -155,7 +166,7 @@ Can also define the delay before the alert fades and the fade out duration. Default: ``None`` If provided, a "Help" link will be displayed in the site header which links -to the value of this settings (ideally a URL containing help information). +to the value of this setting (ideally a URL containing help information). ``exceptions`` -------------- diff --git a/horizon/conf/default.py b/horizon/conf/default.py index 7ad8da2506..dcc3ab77d0 100644 --- a/horizon/conf/default.py +++ b/horizon/conf/default.py @@ -28,6 +28,9 @@ HORIZON_CONFIG = { 'ajax_queue_limit': 10, 'ajax_poll_interval': 2500, + # URL for reporting issue with this site. + 'bug_url': None, + # URL for additional help with this site. 'help_url': None, diff --git a/horizon/test/settings.py b/horizon/test/settings.py index bf7c8a89a6..e7d42ccaa3 100644 --- a/horizon/test/settings.py +++ b/horizon/test/settings.py @@ -137,6 +137,7 @@ HORIZON_CONFIG = { "help_text": "Password must be between 8 and 18 characters." }, 'user_home': None, + 'bug_url': None, 'help_url': "http://example.com", } diff --git a/openstack_dashboard/local/local_settings.py.example b/openstack_dashboard/local/local_settings.py.example index e53ee35ed0..fef84932c9 100644 --- a/openstack_dashboard/local/local_settings.py.example +++ b/openstack_dashboard/local/local_settings.py.example @@ -68,6 +68,11 @@ WEBROOT = '/' # Set to None explicitly if you want to deactivate the console. #CONSOLE_TYPE = "AUTO" +# If provided, a "Report Bug" link will be displayed in the site header +# which links to the value of this setting (ideally a URL containing +# information on how to report issues). +#HORIZON_CONFIG["bug_url"] = "http://bug-report.example.com" + # Show backdrop element outside the modal, do not close the modal # after clicking on backdrop. #HORIZON_CONFIG["modal_backdrop"] = "static" diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py index 0392340f4f..ff84dffbb8 100644 --- a/openstack_dashboard/settings.py +++ b/openstack_dashboard/settings.py @@ -60,6 +60,7 @@ HORIZON_CONFIG = { 'fade_duration': 1500, 'types': ['alert-success', 'alert-info'] }, + 'bug_url': None, 'help_url': "http://docs.openstack.org", 'exceptions': {'recoverable': exceptions.RECOVERABLE, 'not_found': exceptions.NOT_FOUND, diff --git a/openstack_dashboard/templates/500.html b/openstack_dashboard/templates/500.html index 9bef4d1a3c..b901983e87 100644 --- a/openstack_dashboard/templates/500.html +++ b/openstack_dashboard/templates/500.html @@ -71,6 +71,9 @@ diff --git a/openstack_dashboard/templates/_header.html b/openstack_dashboard/templates/_header.html index a2ec75223e..29f85cab7b 100644 --- a/openstack_dashboard/templates/_header.html +++ b/openstack_dashboard/templates/_header.html @@ -67,6 +67,14 @@ {% trans "Settings" %} + {% if HORIZON_CONFIG.bug_url %} +
  • + + + {% trans "Report Bug" %} + +
  • + {% endif %} {% if HORIZON_CONFIG.help_url %}
  • diff --git a/openstack_dashboard/themes/material/templates/_header.html b/openstack_dashboard/themes/material/templates/_header.html index 658417e5cc..5b5fc7b6e3 100644 --- a/openstack_dashboard/themes/material/templates/_header.html +++ b/openstack_dashboard/themes/material/templates/_header.html @@ -76,6 +76,14 @@ {% trans "Settings" %}
  • + {% if HORIZON_CONFIG.bug_url %} +
  • + + + {% trans "Report Bug" %} + +
  • + {% endif %} {% if HORIZON_CONFIG.help_url %}