Read STATIC_URL from Horizon settings

Change-Id: Ie853ded6ad2d50f4a8613c8f142df9b2c7a0064a
This commit is contained in:
Witold Bedyk 2015-09-29 10:16:09 +02:00 committed by Tomasz Trębski
parent 40d31dbd57
commit d0c964d3c4
4 changed files with 19 additions and 13 deletions

View File

@ -14,12 +14,14 @@
# License for the specific language governing permissions and limitations
# under the License.
from django.conf import settings
URL_PREFIX = 'horizon:monitoring:alarms:'
TEMPLATE_PREFIX = 'monitoring/alarms/'
CRITICAL_ICON = '/static/monitoring/img/critical-icon.png'
WARNING_ICON = '/static/monitoring/img/warning-icon.png'
OK_ICON = '/static/monitoring/img/ok-icon.png'
UNKNOWN_ICON = '/static/monitoring/img/unknown-icon.png'
NOTFOUND_ICON = '/static/monitoring/img/notfound-icon.png'
prefix = settings.STATIC_URL or ''
CRITICAL_ICON = prefix + 'monitoring/img/critical-icon.png'
WARNING_ICON = prefix + 'monitoring/img/warning-icon.png'
OK_ICON = prefix + 'monitoring/img/ok-icon.png'
UNKNOWN_ICON = prefix + 'monitoring/img/unknown-icon.png'
NOTFOUND_ICON = prefix + 'monitoring/img/notfound-icon.png'

View File

@ -16,6 +16,7 @@
import logging
from django.conf import settings
from django.core import urlresolvers
from django.core.urlresolvers import reverse_lazy
from django import template
@ -160,7 +161,8 @@ class GraphMetric(tables.LinkAction):
endpoint = str(reverse_lazy(ov_constants.URL_PREFIX + 'proxy'))
endpoint = self.table.request.build_absolute_uri(endpoint)
self.attrs['target'] = '_blank'
url = '/static/grafana/index.html#/dashboard/script/detail.js'
url = (settings.STATIC_URL or '') + \
'grafana/index.html#/dashboard/script/detail.js'
query = "?name=%s&threshold=%s&api=%s" % \
(name, threshold, endpoint)
return url + query

View File

@ -14,12 +14,14 @@
# License for the specific language governing permissions and limitations
# under the License.
from django.conf import settings
URL_PREFIX = 'horizon:monitoring:overview:'
TEMPLATE_PREFIX = 'monitoring/overview/'
CRITICAL_ICON = '/static/monitoring/img/critical-icon.png'
WARNING_ICON = '/static/monitoring/img/warning-icon.png'
OK_ICON = '/static/monitoring/img/ok-icon.png'
UNKNOWN_ICON = '/static/monitoring/img/unknown-icon.png'
NOTFOUND_ICON = '/static/monitoring/img/notfound-icon.png'
prefix = settings.STATIC_URL or ''
CRITICAL_ICON = prefix + 'monitoring/img/critical-icon.png'
WARNING_ICON = prefix + 'monitoring/img/warning-icon.png'
OK_ICON = prefix + 'monitoring/img/ok-icon.png'
UNKNOWN_ICON = prefix + 'monitoring/img/unknown-icon.png'
NOTFOUND_ICON = prefix + 'monitoring/img/notfound-icon.png'

View File

@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load i18n %}
{% load static i18n %}
{% block title %}{% trans 'Monitoring' %}{% endblock %}
{% block page_header %}
@ -9,7 +9,7 @@
{% block main %}
<div style="padding: 3px;">
{% for dashboard in dashboards %}
<a target={{ dashboard.title }} href="/static/grafana/index.html#/dashboard/file/{{ dashboard.fileName }}?api={{api}}" class="btn btn-default btn-sm">
<a target={{ dashboard.title }} href="{% get_static_prefix %}grafana/index.html#/dashboard/file/{{ dashboard.fileName }}?api={{api}}" class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-dashboard"></span>
{% trans dashboard.title %}
</a>