# Path: monitoring/alarmdefs/constants.py
# URL_PREFIX = 'horizon:monitoring:alarmdefs:'
# TEMPLATE_PREFIX = 'monitoring/alarmdefs/'
# 
# Path: monitoring/alarmdefs/forms.py
# def _get_metrics_call(request, offset=None):
# def _get_metrics(request):
# def _get_notifications(request):
#     def __init__(self, initial, attrs=None):
#     def render(self, name, value, attrs=None, renderer=None):
#     def _get_metrics(self):
#     def _set_metrics(self, value):
#     def __init__(self, initial, attrs=None):
#     def render(self, name, value, attrs=None, renderer=None):
#     def __init__(self, *args, **kwargs):
#     def _get_choices(self):
#     def _set_choices(self, value):
#     def compress(self, data_list):
#     def clean(self, value):
#     def __init__(self, *args, **kwargs):
#     def render(self, name, value, attrs=None, choices=(), renderer=None):
#     def value_from_datadict(self, data, files, name):
#     def __init__(self, request, *args, **kwargs):
#     def _instantiate(cls, request, *args, **kwargs):
#     def _init_fields(self, readOnly=False, create=False, initial=None):
#     def set_notification_choices(self, request):
#     def handle(self, request, data):
# class ExpressionWidget(forms.Widget):
# class ExpressionField(forms.CharField):
# class MatchByWidget(forms.Widget):
# class NotificationField(forms.MultiValueField):
# class NotificationCreateWidget(forms.Select):
# class EditAlarmForm(forms.SelfHandlingForm):
# 
# Path: monitoring/alarmdefs/workflows.py
# class SetAlarmNotificationsAction(workflows.Action):
#     class Meta(object):
# class SetAlarmDefinitionAction(workflows.Action):
#     class Meta(object):
# class SetAlarmDefinitionExpressionAction(workflows.Action):
#     class Meta(object):
# class SetDetailsStep(workflows.Step):
# class SetExpressionStep(workflows.Step):
# class SetNotificationsStep(workflows.Step):
# class AlarmDefinitionWorkflow(workflows.Workflow):
#     def __init__(self, request, context, *args, **kwargs):
#     def clean(self):
#     def _is_alarm_def_name_unique_validator(self, value):
#     def _get_alarm_def_by_name(self, value):
#     def __init__(self, request, context, *args, **kwargs):
#     def contribute(self, data, context):
#     def format_status_message(self, message):
#     def handle(self, request, context):
# _SEVERITY_CHOICES = [("LOW", _("Low")),
#                      ("MEDIUM", _("Medium")),
#                      ("HIGH", _("High")),
#                      ("CRITICAL", _("Critical"))]


import logging
from django.contrib import messages
from django.core.paginator import EmptyPage
from django.core.paginator import Paginator
from django.urls import reverse
from django.urls import reverse_lazy
from django.utils.translation import ugettext as _  # noqa
from django.views.generic import TemplateView
from horizon import exceptions
from horizon import forms
from horizon import tables
from horizon.utils import functions as utils
from horizon import workflows
from monascaclient import exc
from monitoring.alarmdefs import constants
from monitoring.alarmdefs import forms as alarm_forms
from monitoring.alarmdefs import tables as alarm_tables
from monitoring.alarmdefs import workflows as alarm_workflows
from monitoring import api
from openstack_dashboard import policy
            context["page_offset"] = None
        else:
            context["page_offset"] = page_offset + limit

        if page_offset in prev_page_stack:
            index = prev_page_stack.index(page_offset)
            prev_page_stack = prev_page_stack[0:index]

        prev_page_offset = prev_page_stack[-1] if prev_page_stack else None
        if prev_page_offset is not None:
            context["prev_page_offset"] = prev_page_offset

        if len(prev_page_stack) > PREV_PAGE_LIMIT:
            del prev_page_stack[0]
        prev_page_stack.append(page_offset)
        self.request.session['prev_page_stack'] = prev_page_stack

        return context


class AlarmCreateView(workflows.WorkflowView):
    workflow_class = alarm_workflows.AlarmDefinitionWorkflow


def transform_alarm_data(obj):
    obj['match_by'] = ','.join(obj['match_by'])
    return obj


class AlarmDetailView(TemplateView):

# Path: monitoring/alarmdefs/constants.py
# URL_PREFIX = 'horizon:monitoring:alarmdefs:'
# TEMPLATE_PREFIX = 'monitoring/alarmdefs/'
# 
# Path: monitoring/alarmdefs/forms.py
# def _get_metrics_call(request, offset=None):
# def _get_metrics(request):
# def _get_notifications(request):
#     def __init__(self, initial, attrs=None):
#     def render(self, name, value, attrs=None, renderer=None):
#     def _get_metrics(self):
#     def _set_metrics(self, value):
#     def __init__(self, initial, attrs=None):
#     def render(self, name, value, attrs=None, renderer=None):
#     def __init__(self, *args, **kwargs):
#     def _get_choices(self):
#     def _set_choices(self, value):
#     def compress(self, data_list):
#     def clean(self, value):
#     def __init__(self, *args, **kwargs):
#     def render(self, name, value, attrs=None, choices=(), renderer=None):
#     def value_from_datadict(self, data, files, name):
#     def __init__(self, request, *args, **kwargs):
#     def _instantiate(cls, request, *args, **kwargs):
#     def _init_fields(self, readOnly=False, create=False, initial=None):
#     def set_notification_choices(self, request):
#     def handle(self, request, data):
# class ExpressionWidget(forms.Widget):
# class ExpressionField(forms.CharField):
# class MatchByWidget(forms.Widget):
# class NotificationField(forms.MultiValueField):
# class NotificationCreateWidget(forms.Select):
# class EditAlarmForm(forms.SelfHandlingForm):
# 
# Path: monitoring/alarmdefs/workflows.py
# class SetAlarmNotificationsAction(workflows.Action):
#     class Meta(object):
# class SetAlarmDefinitionAction(workflows.Action):
#     class Meta(object):
# class SetAlarmDefinitionExpressionAction(workflows.Action):
#     class Meta(object):
# class SetDetailsStep(workflows.Step):
# class SetExpressionStep(workflows.Step):
# class SetNotificationsStep(workflows.Step):
# class AlarmDefinitionWorkflow(workflows.Workflow):
#     def __init__(self, request, context, *args, **kwargs):
#     def clean(self):
#     def _is_alarm_def_name_unique_validator(self, value):
#     def _get_alarm_def_by_name(self, value):
#     def __init__(self, request, context, *args, **kwargs):
#     def contribute(self, data, context):
#     def format_status_message(self, message):
#     def handle(self, request, context):
# _SEVERITY_CHOICES = [("LOW", _("Low")),
#                      ("MEDIUM", _("Medium")),
#                      ("HIGH", _("High")),
#                      ("CRITICAL", _("Critical"))]


# Path: monitoring/alarmdefs/views.py
import logging
from django.contrib import messages
from django.core.paginator import EmptyPage
from django.core.paginator import Paginator
from django.urls import reverse
from django.urls import reverse_lazy
from django.utils.translation import ugettext as _  # noqa
from django.views.generic import TemplateView
from horizon import exceptions
from horizon import forms
from horizon import tables
from horizon.utils import functions as utils
from horizon import workflows
from monascaclient import exc
from monitoring.alarmdefs import constants
from monitoring.alarmdefs import forms as alarm_forms
from monitoring.alarmdefs import tables as alarm_tables
from monitoring.alarmdefs import workflows as alarm_workflows
from monitoring import api
from openstack_dashboard import policy

            context["page_offset"] = None
        else:
            context["page_offset"] = page_offset + limit

        if page_offset in prev_page_stack:
            index = prev_page_stack.index(page_offset)
            prev_page_stack = prev_page_stack[0:index]

        prev_page_offset = prev_page_stack[-1] if prev_page_stack else None
        if prev_page_offset is not None:
            context["prev_page_offset"] = prev_page_offset

        if len(prev_page_stack) > PREV_PAGE_LIMIT:
            del prev_page_stack[0]
        prev_page_stack.append(page_offset)
        self.request.session['prev_page_stack'] = prev_page_stack

        return context


class AlarmCreateView(workflows.WorkflowView):
    workflow_class = alarm_workflows.AlarmDefinitionWorkflow


def transform_alarm_data(obj):
    obj['match_by'] = ','.join(obj['match_by'])
    return obj


class AlarmDetailView(TemplateView):

    template_name = constants.TEMPLATE_PREFIX + 'detail.html'