Exemple #1
0
    def get_event_data(self):

        prev_marker = self.request.GET.get(
            event_tables.EventsTable._meta.prev_pagination_param, None)

        if prev_marker is not None:
            marker = prev_marker
        else:
            marker = self.request.GET.get(
                event_tables.EventsTable._meta.pagination_param, None)
        reversed_order = prev_marker is not None

        node_id = self.tab_group.kwargs['node_id']
        try:
            filters = {"obj_id": node_id}
            events, self._more, self._prev = senlin.event_list(
                self.request,
                marker=marker,
                paginate=True,
                reversed_order=reversed_order,
                filters=filters)
        except Exception:
            self._prev = self._more = False
            events = []
            exceptions.handle(self.request,
                              _('Unable to retrieve node event list.'))
        return events
 def get_event_data(self):
     node_id = self.tab_group.kwargs['node_id']
     try:
         params = {"obj_id": node_id}
         events = senlin.event_list(self.request, params)
     except Exception:
         events = []
         exceptions.handle(self.request,
                           _('Unable to retrieve node event list.'))
     return sorted(events, reverse=True, key=lambda y: y.timestamp)
Exemple #3
0
    def get(self, request, obj_id):
        """Get a list of events."""

        events, has_more_data, has_prev_data = senlin.event_list(
            request, filters={"obj_id": obj_id}, paginate=False)

        return {
            'items': [e.to_dict() for e in events],
            'has_more_data': has_more_data,
            'has_prev_data': has_prev_data,
        }
Exemple #4
0
    def get(self, request, obj_id):
        """Get a list of events."""

        events, has_more_data, has_prev_data = senlin.event_list(
            request, filters={"obj_id": obj_id}, paginate=False)

        return {
            'items': [e.to_dict() for e in events],
            'has_more_data': has_more_data,
            'has_prev_data': has_prev_data,
        }