Improve overview buttons
This makes button use a more standard UX pattern. Change-Id: I8cac9f4653f6fcce0e0d4a08e815d3b1f1eaedae
This commit is contained in:
parent
f05e4992fb
commit
53b539d2fc
@ -9,27 +9,27 @@
|
||||
{% block main %}
|
||||
<div style="padding: 3px;">
|
||||
{% if grafana_url %}
|
||||
<a target="Grafana Home" href="{{grafana_url}}" class="btn btn-default btn-sm">
|
||||
<span class="glyphicon glyphicon-dashboard"></span>
|
||||
<a target="Grafana Home" href="{{grafana_url}}" class="btn btn-primary">
|
||||
<span class="fa fa-bar-chart"></span>
|
||||
Grafana Home
|
||||
</a>
|
||||
{% for dashboard in dashboards %}
|
||||
<a target={{ dashboard.title }} href="{{grafana_url}}/dashboard/db/{{ dashboard.path }}" class="btn btn-default btn-sm">
|
||||
<span class="glyphicon glyphicon-dashboard"></span>
|
||||
<a target={{ dashboard.title }} href="{{grafana_url}}/dashboard/db/{{ dashboard.path }}" class="btn btn-default">
|
||||
<span class="fa fa-bar-chart"></span>
|
||||
{% trans dashboard.title %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for dashboard in dashboards %}
|
||||
<a target={{ dashboard.title }} href="/grafana/index.html#/dashboard/file/{{ dashboard.fileName }}?api={{api}}" class="btn btn-default btn-sm">
|
||||
<span class="glyphicon glyphicon-dashboard"></span>
|
||||
<a target={{ dashboard.title }} href="/grafana/index.html#/dashboard/file/{{ dashboard.fileName }}?api={{api}}" class="btn btn-default">
|
||||
<span class="fa fa-bar-chart"></span>
|
||||
{% trans dashboard.title %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if can_access_logs and enable_kibana_button %}
|
||||
<a target="dashboard" href="{% url 'horizon:monitoring:overview:kibana_proxy' url='/' %}" class="btn btn-default btn-sm">
|
||||
<span class="glyphicon glyphicon-dashboard"></span>
|
||||
<a target="dashboard" href="{% url 'horizon:monitoring:overview:kibana_proxy' url='/' %}" class="btn btn-default">
|
||||
<span class="fa fa-bar-chart"></span>
|
||||
Log Management
|
||||
</a>
|
||||
{% endif %}
|
||||
|
@ -59,15 +59,9 @@
|
||||
</div>
|
||||
<div ng-repeat="service in group.services" style="display:inline-block; margin-bottom:4px; margin-right:4px;">
|
||||
<a href="{% url 'horizon:monitoring:alarms:index' %}alarm/{$ service.name $}">
|
||||
<div class="base-chicklet {$ service.class $}">
|
||||
<div>
|
||||
<div class="status-icon-holder" >
|
||||
<img ng-src="{$ service.icon $}"/>
|
||||
</div>
|
||||
<div class="service-text">
|
||||
{$ service.display $}
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn {$ service.class $}">
|
||||
<div class="fa {$ service.icon $}"> </div>
|
||||
{$ service.display $}
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -39,29 +39,27 @@ from monitoring.overview import constants
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
STATUS_FA_ICON_MAP = {'btn-success': "fa-check",
|
||||
'btn-danger': "fa-exclamation-triangle",
|
||||
'btn-warning': "fa-exclamation",
|
||||
'btn-default': "fa-question-circle"}
|
||||
|
||||
|
||||
def get_icon(status):
|
||||
if status == 'chicklet-success':
|
||||
return constants.OK_ICON
|
||||
if status == 'chicklet-error':
|
||||
return constants.CRITICAL_ICON
|
||||
if status == 'chicklet-warning':
|
||||
return constants.WARNING_ICON
|
||||
if status == 'chicklet-unknown':
|
||||
return constants.UNKNOWN_ICON
|
||||
if status == 'chicklet-notfound':
|
||||
return constants.NOTFOUND_ICON
|
||||
return STATUS_FA_ICON_MAP.get(status, "fa-question-circle")
|
||||
|
||||
|
||||
priorities = [
|
||||
{'status': 'chicklet-success', 'severity': 'OK'},
|
||||
{'status': 'chicklet-unknown', 'severity': 'UNDETERMINED'},
|
||||
{'status': 'chicklet-warning', 'severity': 'LOW'},
|
||||
{'status': 'chicklet-warning', 'severity': 'MEDIUM'},
|
||||
{'status': 'chicklet-warning', 'severity': 'HIGH'},
|
||||
{'status': 'chicklet-error', 'severity': 'CRITICAL'},
|
||||
{'status': 'btn-success', 'severity': 'OK'},
|
||||
{'status': 'btn-default', 'severity': 'UNDETERMINED'},
|
||||
{'status': 'btn-warning', 'severity': 'LOW'},
|
||||
{'status': 'btn-warning', 'severity': 'MEDIUM'},
|
||||
{'status': 'btn-warning', 'severity': 'HIGH'},
|
||||
{'status': 'btn-danger', 'severity': 'CRITICAL'},
|
||||
]
|
||||
index_by_severity = {d['severity']: i for i, d in enumerate(priorities)}
|
||||
|
||||
|
||||
def get_dashboard_links(request):
|
||||
#
|
||||
# GRAFANA_LINKS is a list of dictionaries, but can either
|
||||
@ -77,7 +75,7 @@ def get_dashboard_links(request):
|
||||
#
|
||||
# See examples of both in local_settings.py
|
||||
#
|
||||
non_project_keys = {'fileName','title'}
|
||||
non_project_keys = {'fileName', 'title'}
|
||||
try:
|
||||
for project_link in settings.DASHBOARDS:
|
||||
key = project_link.keys()[0]
|
||||
@ -111,6 +109,7 @@ def get_dashboard_links(request):
|
||||
#
|
||||
return settings.DASHBOARDS
|
||||
|
||||
|
||||
def get_monitoring_services(request):
|
||||
#
|
||||
# GRAFANA_LINKS is a list of dictionaries, but can either
|
||||
@ -160,6 +159,7 @@ def get_monitoring_services(request):
|
||||
#
|
||||
return settings.MONITORING_SERVICES
|
||||
|
||||
|
||||
def show_by_dimension(data, dim_name):
|
||||
if 'dimensions' in data['metrics'][0]:
|
||||
dimensions = data['metrics'][0]['dimensions']
|
||||
@ -270,7 +270,7 @@ class MonascaProxyView(TemplateView):
|
||||
# dimension for all metrics (mini-mon for one).
|
||||
#
|
||||
if 'region' in dim_dict and dim_dict['region'] == 'INJECT_REGION':
|
||||
dim_dict['region'] = self.request.user.services_region
|
||||
dim_dict['region'] = self.request.user.services_region
|
||||
req_kwargs['dimensions'] = dim_dict
|
||||
|
||||
return req_kwargs
|
||||
|
@ -108,14 +108,6 @@ angular.module('monitoring.controllers', [])
|
||||
success(function(data, status, headers, config) {
|
||||
// this callback will be called asynchronously
|
||||
// when the response is available
|
||||
var i;
|
||||
for (i=0; i < data.series.length; i++) {
|
||||
var group = data.series[i];
|
||||
for (var j in group.services) {
|
||||
var service = group.services[j];
|
||||
service.icon = getIcon(service.class);
|
||||
}
|
||||
}
|
||||
$scope._serviceModel = data.series;
|
||||
}).
|
||||
error(function(data, status, headers, config) {
|
||||
@ -124,14 +116,6 @@ angular.module('monitoring.controllers', [])
|
||||
|
||||
};
|
||||
|
||||
function getIcon(status) {
|
||||
var url_suffix = CHICKLET_TO_ICON[status];
|
||||
if(url_suffix){
|
||||
return base_url + url_suffix;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
$scope.onTimeout = function(){
|
||||
mytimeout = $timeout($scope.onTimeout,10000);
|
||||
$scope.fetchStatus();
|
||||
|
@ -18,20 +18,9 @@ from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
from horizon.test.settings import * # noqa
|
||||
from horizon.utils import secret_key as secret_key_utils
|
||||
|
||||
from openstack_dashboard.test.settings import * # noqa
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
ROOT_PATH = os.path.abspath(os.path.join(TEST_DIR, ".."))
|
||||
|
||||
MEDIA_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'media'))
|
||||
MEDIA_URL = '/media/'
|
||||
STATIC_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'static'))
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
SECRET_KEY = secret_key_utils.generate_or_read_from_file(
|
||||
os.path.join(TEST_DIR, '.secret_key_store'))
|
||||
ROOT_URLCONF = 'monitoring.test.urls'
|
||||
TEMPLATE_DIRS = (
|
||||
os.path.join(TEST_DIR, 'templates'),
|
||||
@ -140,13 +129,3 @@ NOSE_ARGS = ['--nocapture',
|
||||
'--cover-package=monitoring',
|
||||
'--cover-inclusive',
|
||||
'--all-modules']
|
||||
|
||||
TUSKAR_ENDPOINT_URL = "http://127.0.0.1:8585"
|
||||
|
||||
OVERCLOUD_CREDS = {
|
||||
'enabled': True,
|
||||
'user': 'admin',
|
||||
'password': 'password',
|
||||
'tenant': 'admin',
|
||||
'auth_url': 'http://localhost:5000/v2.0/',
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user