# Path: monitoring/alarms/tables.py
# STATUS = ["OK", "WARNING", "CRITICAL", "UNKNOWN"]
# def get_status(index):
# def show_status(data):
# def show_severity(data):
# def show_alarm_id(data):
# def show_metric_names(data):
# def show_def_name(data):
# def show_def_severity(data):
# def show_metric_dimensions(data):
# def get_service(data):
#     def get_link_url(self, datum):
#     def allowed(self, request, datum=None):
#     def get_link_url(self):
#     def allowed(self, request, datum=None):
#     def get_link_url(self, datum):
#     def allowed(self, request, datum=None):
#     def render(self):
#     def get_link_url(self, datum):
#     def allowed(self, request, datum=None):
#     def get_link_url(self, datum=None):
#     def action_present(count):
#     def action_past(count):
#     def allowed(self, request, datum=None):
#     def delete(self, request, obj_id):
#     def get_link_url(self):
#     def allowed(self, request, datum=None):
#     def get_object_id(self, obj):
#     def get_object_display(self, obj):
# def show_timestamp(data):
#     def get_object_id(self, obj):
# class ShowAlarmHistory(tables.LinkAction):
# class CreateAlarm(tables.LinkAction):
# class EditAlarm(tables.LinkAction):
# class GraphMetric(tables.LinkAction):
# class ShowAlarmDefinition(tables.LinkAction):
# class DeleteAlarm(tables.DeleteAction):
# class AlarmsFilterAction(tables.LinkAction):
# class AlarmsTable(tables.DataTable):
#     class Meta(object):
# class AlarmHistoryTable(tables.DataTable):
#     class Meta(object):


import base64
import copy
import json
import logging
import urllib
from django.conf import settings
from django.contrib import messages
from django import http
from django.http import HttpResponse
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _  # noqa
from django.views.decorators.csrf import csrf_exempt
from django.views import generic
from django.views.generic import TemplateView
from horizon import exceptions
from openstack_auth import utils as auth_utils
from openstack_dashboard import policy
from monitoring.alarms import tables as alarm_tables
from monitoring import api
from monitoring.overview import constants
        for metric in data['metrics']:
            if 'dimensions' in metric:
                if dim_name in metric['dimensions']:
                    dimension = metric['dimensions'][dim_name]
                    dimensions.append(dimension)

        return dimensions
    return []


def get_status(alarms):
    if not alarms:
        return 'chicklet-notfound'
    status_index = 0
    for a in alarms:
        severity = alarm_tables.show_severity(a)
        severity_index = index_by_severity.get(severity, None)
        status_index = max(status_index, severity_index)
    return priorities[status_index]['status']


def generate_status(request):
    try:
        alarms = api.monitor.alarm_list(request)
    except Exception as e:
        messages.error(request,
                       _('Unable to list alarms: %s') % str(e))
        alarms = []
    alarms_by_service = {}
    for a in alarms:

# Path: monitoring/alarms/tables.py
# STATUS = ["OK", "WARNING", "CRITICAL", "UNKNOWN"]
# def get_status(index):
# def show_status(data):
# def show_severity(data):
# def show_alarm_id(data):
# def show_metric_names(data):
# def show_def_name(data):
# def show_def_severity(data):
# def show_metric_dimensions(data):
# def get_service(data):
#     def get_link_url(self, datum):
#     def allowed(self, request, datum=None):
#     def get_link_url(self):
#     def allowed(self, request, datum=None):
#     def get_link_url(self, datum):
#     def allowed(self, request, datum=None):
#     def render(self):
#     def get_link_url(self, datum):
#     def allowed(self, request, datum=None):
#     def get_link_url(self, datum=None):
#     def action_present(count):
#     def action_past(count):
#     def allowed(self, request, datum=None):
#     def delete(self, request, obj_id):
#     def get_link_url(self):
#     def allowed(self, request, datum=None):
#     def get_object_id(self, obj):
#     def get_object_display(self, obj):
# def show_timestamp(data):
#     def get_object_id(self, obj):
# class ShowAlarmHistory(tables.LinkAction):
# class CreateAlarm(tables.LinkAction):
# class EditAlarm(tables.LinkAction):
# class GraphMetric(tables.LinkAction):
# class ShowAlarmDefinition(tables.LinkAction):
# class DeleteAlarm(tables.DeleteAction):
# class AlarmsFilterAction(tables.LinkAction):
# class AlarmsTable(tables.DataTable):
#     class Meta(object):
# class AlarmHistoryTable(tables.DataTable):
#     class Meta(object):


# Path: monitoring/overview/views.py
import base64
import copy
import json
import logging
import urllib
from django.conf import settings
from django.contrib import messages
from django import http
from django.http import HttpResponse
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _  # noqa
from django.views.decorators.csrf import csrf_exempt
from django.views import generic
from django.views.generic import TemplateView
from horizon import exceptions
from openstack_auth import utils as auth_utils
from openstack_dashboard import policy
from monitoring.alarms import tables as alarm_tables
from monitoring import api
from monitoring.overview import constants

        for metric in data['metrics']:
            if 'dimensions' in metric:
                if dim_name in metric['dimensions']:
                    dimension = metric['dimensions'][dim_name]
                    dimensions.append(dimension)

        return dimensions
    return []


def get_status(alarms):
    if not alarms:
        return 'chicklet-notfound'
    status_index = 0
    for a in alarms:
        severity = alarm_tables.show_severity(a)
        severity_index = index_by_severity.get(severity, None)
        status_index = max(status_index, severity_index)
    return priorities[status_index]['status']


def generate_status(request):
    try:
        alarms = api.monitor.alarm_list(request)
    except Exception as e:
        messages.error(request,
                       _('Unable to list alarms: %s') % str(e))
        alarms = []
    alarms_by_service = {}
    for a in alarms:

        service = alarm_tables.get_service(a)