Пример #1
0
def details(req, source_type, cluster_id, msg_id, topic_name):

    item = None
    pretty_print = asbool(req.GET.get('pretty_print'))

    input_dict = {
        'cluster_id': cluster_id,
        'msg_id': msg_id,
    }
    response = req.zato.client.invoke('zato.pubsub.message.get', input_dict)

    if response.has_data:
        item = Message()
        for name in('topic', 'producer', 'priority', 'mime_type', 'expiration', 'creation_time_utc', 'expire_at_utc', 'payload'):
            setattr(item, name, getattr(response.data, name, None))

        item.creation_time = from_utc_to_user(item.creation_time_utc+'+00:00', req.zato.user_profile)
        item.expire_at = from_utc_to_user(item.expire_at_utc+'+00:00', req.zato.user_profile)

    return_data = {
        'cluster_id': req.zato.cluster_id,
        'item': item,
        'pretty_print': not pretty_print,
        'msg_id': msg_id,
        'topic_name': topic_name,
        'source_type': source_type,
        'sub_key': req.GET.get('sub_key')
        }

    return TemplateResponse(req, 'zato/pubsub/message/details.html', return_data)
Пример #2
0
def _index(req, cluster_id, topic_name, source_name, source_type):
    items = []
    input_dict = {
        'cluster_id': cluster_id,
        'source_name': source_name,
        'source_type': source_type
    }

    for _item in req.zato.client.invoke('zato.pubsub.message.get-list',
                                        input_dict):
        _item = Message(**_item)
        _item.creation_time = from_utc_to_user(
            _item.creation_time_utc + '+00:00', req.zato.user_profile)
        _item.expire_at = from_utc_to_user(_item.expire_at_utc + '+00:00',
                                           req.zato.user_profile)
        _item.id = _item.msg_id
        items.append(_item)

    return_data = {
        'topic_name': topic_name,
        'cluster_id': req.zato.cluster_id,
        'items': items,
        'source_type': source_type,
        'source_name': source_name
    }

    return TemplateResponse(req, 'zato/pubsub/message/index.html', return_data)
Пример #3
0
def _index(req, cluster_id, topic_name, source_name, source_type):
    items = []
    input_dict = {
        'cluster_id': cluster_id,
        'source_name':source_name,
        'source_type': source_type
    }

    for _item in req.zato.client.invoke('zato.pubsub.message.get-list', input_dict):
        _item = Message(**_item)
        _item.creation_time = from_utc_to_user(_item.creation_time_utc+'+00:00', req.zato.user_profile)
        _item.expire_at = from_utc_to_user(_item.expire_at_utc+'+00:00', req.zato.user_profile)
        _item.id = _item.msg_id
        items.append(_item)

    return_data = {
        'topic_name': topic_name,
        'cluster_id': req.zato.cluster_id,
        'items': items,
        'source_type': source_type,
        'source_name': source_name
        }

    return TemplateResponse(req, 'zato/pubsub/message/index.html', return_data)