示例#1
0
文件: groups.py 项目: Supy/sentry
def group_event_details(request, project, group, event_id):
    event = get_object_or_404(group.event_set, id=event_id)

    base_qs = group.event_set.exclude(id=event_id)
    try:
        next_event = base_qs.filter(
            datetime__gte=event.datetime).order_by('datetime')[0:1].get()
    except Event.DoesNotExist:
        next_event = None

    try:
        prev_event = base_qs.filter(
            datetime__lte=event.datetime).order_by('-datetime')[0:1].get()
    except Event.DoesNotExist:
        prev_event = None

    local_tz = getattr(django_settings, 'TIME_ZONE', 'UTC')

    return render_to_response(
        'sentry/groups/event.html', {
            'project': project,
            'page': 'event',
            'group': group,
            'event': event,
            'next_event': next_event,
            'prev_event': prev_event,
            'timezone': local_tz,
            'json_data': event.data.get('extra', {}),
            'version_data': event.data.get('modules', None),
            'can_admin_event': can_admin_group(request.user, group),
        }, request)
示例#2
0
文件: base.py 项目: beyondtime/sentry
    def get_view_response(self, request, group):
        from sentry.models import Event
        from sentry.permissions import can_admin_group

        self.selected = request.path == self.get_url(group)

        if not self.selected:
            return

        response = self.view(request, group)

        if not response:
            return

        if isinstance(response, HttpResponseRedirect):
            return response

        if not isinstance(response, Response):
            raise NotImplementedError("Use self.render() when returning responses.")

        event = group.get_latest_event() or Event()
        event.group = group

        return response.respond(
            request,
            {
                "plugin": self,
                "project": group.project,
                "group": group,
                "event": event,
                "can_admin_event": can_admin_group(request.user, group),
            },
        )
示例#3
0
文件: groups.py 项目: MSylvia/sentry
def group_event_details(request, project, group, event_id):
    event = get_object_or_404(group.event_set, id=event_id)

    base_qs = group.event_set.exclude(id=event_id)
    try:
        next_event = base_qs.filter(datetime__gte=event.datetime).order_by('datetime')[0:1].get()
    except Event.DoesNotExist:
        next_event = None

    try:
        prev_event = base_qs.filter(datetime__lte=event.datetime).order_by('-datetime')[0:1].get()
    except Event.DoesNotExist:
        prev_event = None

    return render_to_response('sentry/groups/event.html', {
        'project': project,
        'page': 'event',
        'group': group,
        'event': event,
        'next_event': next_event,
        'prev_event': prev_event,
        'json_data': event.data.get('extra', {}),
        'version_data': event.data.get('modules', None),
        'can_admin_event': can_admin_group(request.user, group),
    }, request)
示例#4
0
文件: base.py 项目: abossard/sentry
    def get_view_response(self, request, group):
        from sentry.permissions import can_admin_group

        self.selected = request.path == self.get_url(group)

        if not self.selected:
            return

        response = self.view(request, group)

        if not response:
            return

        if isinstance(response, HttpResponseRedirect):
            return response

        if not isinstance(response, Response):
            raise NotImplementedError('Please use self.render() when returning responses.')

        return response.respond(request, {
            'plugin': self,
            'project': group.project,
            'group': group,
            'can_admin_event': can_admin_group(request.user, group),
        })
示例#5
0
文件: base.py 项目: xssworm/sentry
    def get_view_response(self, request, group):
        from sentry.models import Event
        from sentry.permissions import can_admin_group

        self.selected = request.path == self.get_url(group)

        if not self.selected:
            return

        response = self.view(request, group)

        if not response:
            return

        if isinstance(response, HttpResponseRedirect):
            return response

        if not isinstance(response, Response):
            raise NotImplementedError(
                'Use self.render() when returning responses.')

        event = group.get_latest_event() or Event()
        event.group = group

        return response.respond(
            request, {
                'plugin': self,
                'project': group.project,
                'group': group,
                'event': event,
                'can_admin_event': can_admin_group(request.user, group),
            })
示例#6
0
文件: groups.py 项目: acdha/sentry
def group_event_list(request, project, group):
    event_list = group.event_set.all().order_by('-datetime')

    return render_to_response('sentry/groups/event_list.html', {
        'project': project,
        'group': group,
        'event_list': event_list,
        'page': 'event_list',
        'can_admin_event': can_admin_group(request.user, group),
    }, request)
示例#7
0
def group_event_list(request, project, group):
    event_list = group.event_set.all().order_by('-datetime')

    return render_to_response('sentry/groups/event_list.html', {
        'project': project,
        'group': group,
        'event_list': event_list,
        'page': 'event_list',
        'can_admin_event': can_admin_group(request.user, group),
    }, request)
示例#8
0
文件: groups.py 项目: cwndrws/sentry
def render_with_group_context(group,
                              template,
                              context,
                              request=None,
                              event=None,
                              is_public=False):
    context.update({
        'team': group.project.team,
        'organization': group.project.organization,
        'project': group.project,
        'group': group,
        'can_admin_event': can_admin_group(request.user, group),
        'can_remove_event': can_remove_group(request.user, group),
    })

    if event:
        if event.id:
            # TODO(dcramer): we dont want to actually use gt/lt here as it should
            # be inclusive. However, that would need to ensure we have some kind
            # of way to know which event was the previous (an offset), or to add
            # a third sort key (which is not yet indexed)
            base_qs = group.event_set.exclude(id=event.id)
            try:
                next_event = base_qs.filter(datetime__gt=event.datetime,
                                            ).order_by('datetime')[0:1].get()
            except Event.DoesNotExist:
                next_event = None

            try:
                prev_event = base_qs.filter(datetime__lt=event.datetime,
                                            ).order_by('-datetime')[0:1].get()
            except Event.DoesNotExist:
                prev_event = None
        else:
            next_event = None
            prev_event = None

        if not is_public:
            extra_data = event.data.get('extra', {})
            if not isinstance(extra_data, dict):
                extra_data = {}

            context.update({
                'tags': event.get_tags(),
                'json_data': extra_data,
            })

        context.update({
            'event': event,
            'version_data': event.data.get('modules', None),
            'next_event': next_event,
            'prev_event': prev_event,
        })

    return render_to_response(template, context, request)
示例#9
0
文件: groups.py 项目: acdha/sentry
def group_tag_details(request, project, group, tag_name):
    return render_to_response('sentry/plugins/bases/tag/index.html', {
        'project': project,
        'group': group,
        'title': tag_name.replace('_', ' ').title(),
        'tag_name': tag_name,
        'unique_tags': group.get_unique_tags(tag_name),
        'group': group,
        'page': 'tag_details',
        'can_admin_event': can_admin_group(request.user, group),
    }, request)
示例#10
0
def group_tag_details(request, project, group, tag_name):
    return render_to_response(
        'sentry/plugins/bases/tag/index.html', {
            'project': project,
            'group': group,
            'title': tag_name.replace('_', ' ').title(),
            'tag_name': tag_name,
            'unique_tags': group.get_unique_tags(tag_name),
            'group': group,
            'page': 'tag_details',
            'can_admin_event': can_admin_group(request.user, group),
        }, request)
示例#11
0
文件: groups.py 项目: allanlei/sentry
def group_event_details(request, project, group, event_id):
    event = get_object_or_404(group.event_set, pk=event_id)

    return render_to_response('sentry/groups/event.html', {
        'project': project,
        'page': 'event',
        'group': group,
        'event': event,
        'json_data': event.data.get('extra', {}),
        'version_data': event.data.get('modules', None),
        'can_admin_event': can_admin_group(request.user, group),
    }, request)
示例#12
0
文件: groups.py 项目: uber/sentry
def render_with_group_context(group, template, context, request=None,
                              event=None, is_public=False):
    context.update({
        'team': group.project.team,
        'organization': group.project.organization,
        'project': group.project,
        'group': group,
        'can_admin_event': can_admin_group(request.user, group),
        'can_remove_event': can_remove_group(request.user, group),
    })

    if event:
        if event.id:
            # TODO(dcramer): we dont want to actually use gt/lt here as it should
            # be inclusive. However, that would need to ensure we have some kind
            # of way to know which event was the previous (an offset), or to add
            # a third sort key (which is not yet indexed)
            base_qs = group.event_set.exclude(id=event.id)
            try:
                next_event = base_qs.filter(
                    datetime__gt=event.datetime,
                ).order_by('datetime','id')[0:1].get()
            except Event.DoesNotExist:
                next_event = None

            try:
                prev_event = base_qs.filter(
                    datetime__lt=event.datetime,
                ).order_by('-datetime','-id')[0:1].get()
            except Event.DoesNotExist:
                prev_event = None
        else:
            next_event = None
            prev_event = None

        if not is_public:
            extra_data = event.data.get('extra', {})
            if not isinstance(extra_data, dict):
                extra_data = {}

            context.update({
                'tags': event.get_tags(),
                'json_data': extra_data,
            })

        context.update({
            'event': event,
            'version_data': event.data.get('modules', None),
            'next_event': next_event,
            'prev_event': prev_event,
        })

    return render_to_response(template, context, request)
示例#13
0
def render_with_group_context(group,
                              template,
                              context,
                              request=None,
                              event=None,
                              is_public=False):
    context.update({
        'team': group.project.team,
        'project': group.project,
        'group': group,
        'can_admin_event': can_admin_group(request.user, group),
        'can_remove_event': can_remove_group(request.user, group),
    })

    if event:
        if event.id:
            base_qs = group.event_set.exclude(id=event.id)
            try:
                next_event = base_qs.filter(datetime__gte=event.datetime,
                                            pk__gte=event.pk).order_by(
                                                'datetime', 'pk')[0:1].get()
            except Event.DoesNotExist:
                next_event = None

            try:
                prev_event = base_qs.filter(datetime__lte=event.datetime,
                                            pk__lte=event.pk).order_by(
                                                '-datetime', '-pk')[0:1].get()
            except Event.DoesNotExist:
                prev_event = None
        else:
            next_event = None
            prev_event = None

        if not is_public:
            extra_data = event.data.get('extra', {})
            if not isinstance(extra_data, dict):
                extra_data = {}

            context.update({
                'tags': event.get_tags(),
                'json_data': extra_data,
            })

        context.update({
            'event': event,
            'version_data': event.data.get('modules', None),
            'next_event': next_event,
            'prev_event': prev_event,
        })

    return render_to_response(template, context, request)
示例#14
0
def group_event_details(request, project, group, event_id):
    event = get_object_or_404(group.event_set, pk=event_id)

    return render_to_response('sentry/groups/event.html', {
        'project': project,
        'page': 'event_list',
        'group': group,
        'event': event,
        'interface_list': _get_rendered_interfaces(event),
        'json_data': event.data.get('extra', {}),
        'version_data': event.data.get('modules', None),
        'can_admin_event': can_admin_group(request.user, group),
    }, request)
示例#15
0
def group_event_list(request, project, group):
    event_list = group.event_set.all().order_by("-datetime")

    return render_to_response(
        "sentry/groups/event_list.html",
        {
            "project": project,
            "group": group,
            "event_list": event_list,
            "page": "event_list",
            "can_admin_event": can_admin_group(request.user, group),
        },
        request,
    )
示例#16
0
def group_tag_details(request, project, group, tag_name):
    return render_to_response(
        "sentry/plugins/bases/tag/index.html",
        {
            "project": project,
            "group": group,
            "title": tag_name.replace("_", " ").title(),
            "tag_name": tag_name,
            "unique_tags": group.get_unique_tags(tag_name),
            "group": group,
            "page": "tag_details",
            "can_admin_event": can_admin_group(request.user, group),
        },
        request,
    )
示例#17
0
def group(request, project, group):
    # It's possible that a message would not be created under certain
    # circumstances (such as a post_save signal failing)
    event = group.get_latest_event() or Event(group=group)

    return render_to_response('sentry/groups/details.html', {
        'project': project,
        'page': 'details',
        'group': group,
        'event': event,
        'interface_list': _get_rendered_interfaces(event),
        'json_data': event.data.get('extra', {}),
        'version_data': event.data.get('modules', None),
        'can_admin_event': can_admin_group(request.user, group),
    }, request)
示例#18
0
文件: groups.py 项目: acdha/sentry
def group(request, project, group):
    # It's possible that a message would not be created under certain
    # circumstances (such as a post_save signal failing)
    event = group.get_latest_event() or Event(group=group)

    return render_to_response('sentry/groups/details.html', {
        'project': project,
        'page': 'details',
        'group': group,
        'event': event,
        'interface_list': _get_rendered_interfaces(event),
        'json_data': event.data.get('extra', {}),
        'version_data': event.data.get('modules', None),
        'can_admin_event': can_admin_group(request.user, group),
    }, request)
示例#19
0
文件: groups.py 项目: Supy/sentry
def render_with_group_context(group, template, context, request=None):
    # It's possible that a message would not be created under certain
    # circumstances (such as a post_save signal failing)
    event = group.get_latest_event() or Event()
    event.group = group

    context.update({
        'project': group.project,
        'group': group,
        'event': event,
        'json_data': event.data.get('extra', {}),
        'version_data': event.data.get('modules', None),
        'can_admin_event': can_admin_group(request.user, group),
    })

    return render_to_response(template, context, request)
示例#20
0
文件: groups.py 项目: MSylvia/sentry
def render_with_group_context(group, template, context, request=None):
    # It's possible that a message would not be created under certain
    # circumstances (such as a post_save signal failing)
    event = group.get_latest_event() or Event()
    event.group = group

    context.update({
        'project': group.project,
        'group': group,
        'event': event,
        'json_data': event.data.get('extra', {}),
        'version_data': event.data.get('modules', None),
        'can_admin_event': can_admin_group(request.user, group),
    })

    return render_to_response(template, context, request)
示例#21
0
def group_event_details(request, project, group, event_id):
    event = get_object_or_404(group.event_set, pk=event_id)

    return render_to_response(
        "sentry/groups/event.html",
        {
            "project": project,
            "page": "event_list",
            "group": group,
            "event": event,
            "interface_list": _get_rendered_interfaces(event),
            "json_data": event.data.get("extra", {}),
            "version_data": event.data.get("modules", None),
            "can_admin_event": can_admin_group(request.user, group),
        },
        request,
    )
示例#22
0
文件: groups.py 项目: galdwulf/sentry
def render_with_group_context(group, template, context, request=None,
                              event=None, is_public=False):
    context.update({
        'team': group.project.team,
        'organization': group.project.organization,
        'project': group.project,
        'group': group,
        'can_admin_event': can_admin_group(request.user, group),
        'can_remove_event': can_remove_group(request.user, group),
    })

    if event:
        if event.id:
            base_qs = group.event_set.exclude(id=event.id)
            try:
                next_event = base_qs.filter(datetime__gte=event.datetime).order_by('datetime')[0:1].get()
            except Event.DoesNotExist:
                next_event = None

            try:
                prev_event = base_qs.filter(datetime__lte=event.datetime).order_by('-datetime')[0:1].get()
            except Event.DoesNotExist:
                prev_event = None
        else:
            next_event = None
            prev_event = None

        if not is_public:
            extra_data = event.data.get('extra', {})
            if not isinstance(extra_data, dict):
                extra_data = {}

            context.update({
                'tags': event.get_tags(),
                'json_data': extra_data,
            })

        context.update({
            'event': event,
            'version_data': event.data.get('modules', None),
            'next_event': next_event,
            'prev_event': prev_event,
        })

    return render_to_response(template, context, request)
示例#23
0
def render_with_group_context(group, template, context, request=None, event=None, is_public=False):
    context.update(
        {
            "team": group.project.team,
            "project": group.project,
            "group": group,
            "can_admin_event": can_admin_group(request.user, group),
        }
    )

    if event:
        if event.id:
            base_qs = group.event_set.exclude(id=event.id)
            try:
                next_event = base_qs.filter(datetime__gte=event.datetime).order_by("datetime")[0:1].get()
            except Event.DoesNotExist:
                next_event = None

            try:
                prev_event = base_qs.filter(datetime__lte=event.datetime).order_by("-datetime")[0:1].get()
            except Event.DoesNotExist:
                prev_event = None
        else:
            next_event = None
            prev_event = None

        if not is_public:
            extra_data = event.data.get("extra", {})
            if not isinstance(extra_data, dict):
                extra_data = {}

            context.update({"tags": event.get_tags(), "json_data": extra_data})

        context.update(
            {
                "event": event,
                "version_data": event.data.get("modules", None),
                "next_event": next_event,
                "prev_event": prev_event,
            }
        )

    return render_to_response(template, context, request)
示例#24
0
def group(request, project, group):
    # It's possible that a message would not be created under certain
    # circumstances (such as a post_save signal failing)
    event = group.get_latest_event() or Event(group=group)

    return render_to_response(
        "sentry/groups/details.html",
        {
            "project": project,
            "page": "details",
            "group": group,
            "event": event,
            "interface_list": _get_rendered_interfaces(event),
            "json_data": event.data.get("extra", {}),
            "version_data": event.data.get("modules", None),
            "can_admin_event": can_admin_group(request.user, group),
        },
        request,
    )
示例#25
0
def render_with_group_context(group, template, context, request=None, event=None):
    activity = Activity.objects.filter(
        group=group,
    ).order_by('-datetime').select_related('user')
    if event:
        activity = activity.filter(Q(event__isnull=True) | Q(event=event))

    activity = list(activity)

    context.update({
        'team': group.project.team,
        'project': group.project,
        'group': group,
        'can_admin_event': can_admin_group(request.user, group),
        'SECTION': 'events',
        'activity': activity,
    })

    if event:
        if event.id:
            base_qs = group.event_set.exclude(id=event.id)
            try:
                next_event = base_qs.filter(datetime__gte=event.datetime).order_by('datetime')[0:1].get()
            except Event.DoesNotExist:
                next_event = None

            try:
                prev_event = base_qs.filter(datetime__lte=event.datetime).order_by('-datetime')[0:1].get()
            except Event.DoesNotExist:
                prev_event = None
        else:
            next_event = None
            prev_event = None

        context.update({
            'event': event,
            'json_data': event.data.get('extra', {}),
            'version_data': event.data.get('modules', None),
            'next_event': next_event,
            'prev_event': prev_event,
        })

    return render_to_response(template, context, request)