Пример #1
0
def ireport_detail(request):
    """Incident Report Detail View

    Show all available information on an incident report

    """

    logger.debug('%s view being executed.' % 'ireport.ireport_detail')

    form = DetailForm(request.GET)
    logger.debug('Form submit (GET): %s, with result: %s' %
                 ('DetailForm', form))

    if form.is_valid():
        # Obtain the cleaned data
        id = form.cleaned_data['id']

    # Bad form
    else:
        # Redirect to the admin reports page
        return HttpResponseRedirect('/admin')

    # Obain the incident report detail
    detail = Ireport.objects.filter(id=id).values('id', 'date', 'name',
                                                  'email', 'detail', 'extra',
                                                  'screenshot1', 'screenshot2')

    # Print the page
    return render_to_response('ireport/ireport_detail.html', {
        'title': 'System Status Dashboard | Incident Report Detail',
        'detail': detail,
        'nav_section': 'ireport',
        'nav_sub': 'ireport_detail'
    },
                              context_instance=RequestContext(request))
def m_detail(request):
    """Maintenance Detail View

    Show all available information on a scheduled maintenance

    """

    logger.debug('%s view being executed.' % 'maintenance.m_detail')

    form = DetailForm(request.GET)
    logger.debug('Form submit (GET): %s, with result: %s' %
                 ('DetailForm', form))

    if form.is_valid():
        # Obtain the cleaned data
        id = form.cleaned_data['id']

    # Bad form
    else:
        messages.add_message(
            request, messages.ERROR,
            'Improperly formatted maintenance ID, cannot display maintenance detail'
        )
        return HttpResponseRedirect('/')

    # Obain the maintenance detail (and make sure it's a maintenance)
    details = Event.objects.filter(id=id, type__type='maintenance').values(
        'start', 'end', 'status__status', 'description',
        'event_impact__impact', 'event_coordinator__coordinator',
        'event_email__email__email', 'user_id__first_name',
        'user_id__last_name')
    # If nothing was returned, send back to the home page
    if not details:
        messages.add_message(request, messages.ERROR,
                             'Invalid request: no such maintenance id.')
        return HttpResponseRedirect('/')

    # Which services were impacted
    services = Event.objects.filter(
        id=id).values('event_service__service__service_name')

    # Obain any maintenance updates
    updates = Event.objects.filter(id=id).values(
        'event_update__id', 'event_update__date', 'event_update__update',
        'event_update__user__first_name',
        'event_update__user__last_name').order_by('event_update__id')
    # If there are no updates, set to None
    if len(updates) == 1 and updates[0]['event_update__date'] == None:
        updates = None

    # Print the page
    return render_to_response('maintenance/m_detail.html', {
        'title': 'System Status Dashboard | Scheduled Maintenance Detail',
        'services': services,
        'id': id,
        'details': details,
        'updates': updates,
    },
                              context_instance=RequestContext(request))
Пример #3
0
def ireport_detail(request):
    """Incident Report Detail View

    Show all available information on an incident report

    """

    logger.debug('%s view being executed.' % 'ireport.ireport_detail')

    form = DetailForm(request.GET)
    logger.debug('Form submit (GET): %s, with result: %s' % ('DetailForm',form))

    if form.is_valid():
        # Obtain the cleaned data
        id = form.cleaned_data['id']

    # Bad form
    else:
        # Redirect to the admin reports page
        return HttpResponseRedirect('/admin')

    # Obain the incident report detail
    detail = Ireport.objects.filter(id=id).values(
                                                'id',
                                                'date',
                                                'name',
                                                'email',
                                                'detail',
                                                'extra',
                                                'screenshot1',
                                                'screenshot2'
                                                )

    # Print the page
    return render_to_response(
       'ireport/ireport_detail.html',
       {
          'title':'System Status Dashboard | Incident Report Detail',
          'detail':detail,
          'nav_section':'ireport',
          'nav_sub':'ireport_detail'
       },
       context_instance=RequestContext(request)
    )
Пример #4
0
def i_detail(request):
    """Incident Detail View

    Show all available information on an incident

    """

    logger.debug('%s view being executed.' % 'incidents.i_detail')

    form = DetailForm(request.GET)
    logger.debug('Form submit (GET): %s, with result: %s' % ('DetailForm',form))

    if form.is_valid():
        # Obtain the cleaned data
        id = form.cleaned_data['id']

    # Bad form
    else:
        messages.add_message(request, messages.ERROR, 'Improperly formatted incident ID, cannot display incident detail')
        return HttpResponseRedirect('/')

    # Obain the incident detail (and make sure it's an incident)
    details = Event.objects.filter(id=id,type__type='incident').values(
                                                'status__status',
                                                'start',
                                                'end',
                                                'description',
                                                'user_id__first_name',
                                                'user_id__last_name'
                                                )
    # If nothing was returned, send back to the home page
    if not details:
        messages.add_message(request, messages.ERROR, 'Invalid request: no such incident id.')
        return HttpResponseRedirect('/')

    # Which services were impacted
    services = Event.objects.filter(id=id).values('event_service__service__service_name')

    # Obain any incident updates
    updates = Event.objects.filter(id=id).values(
                                                'event_update__id',
                                                'event_update__date',
                                                'event_update__update',
                                                'event_update__user__first_name',
                                                'event_update__user__last_name'
                                                ).order_by('event_update__id')
    # If there are no updates, set to None
    if len(updates) == 1 and updates[0]['event_update__date'] == None:
        updates = None

    # Print the page
    return render_to_response(
       'incidents/i_detail.html',
       {
          'title':'System Status Dashboard | Incident Detail',
          'services':services,
          'id':id,
          'details':details,
          'updates':updates
       },
       context_instance=RequestContext(request)
    )