Mercurial > libervia-web
comparison libervia/pages/merge-requests/page_meta.py @ 1302:04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 16 Jul 2020 09:08:47 +0200 |
parents | f511f8fbbf8a |
children | e3e303a30a74 |
comparison
equal
deleted
inserted
replaced
1301:ff44f822bfdd | 1302:04e7dd6b6f4d |
---|---|
2 | 2 |
3 | 3 |
4 from libervia.server.constants import Const as C | 4 from libervia.server.constants import Const as C |
5 from twisted.internet import defer | 5 from twisted.internet import defer |
6 from sat.tools.common import template_xmlui | 6 from sat.tools.common import template_xmlui |
7 from sat.tools.common import data_format | |
7 from sat.tools.common import data_objects | 8 from sat.tools.common import data_objects |
8 from sat.core.log import getLogger | 9 from sat.core.log import getLogger |
9 | 10 |
10 log = getLogger(__name__) | 11 log = getLogger(__name__) |
11 """ticket handling pages""" | 12 """ticket handling pages""" |
31 service.full(), node | 32 service.full(), node |
32 ) | 33 ) |
33 template_data["url_tickets_new"] = self.getSubPageURL(request, "merge-requests_new") | 34 template_data["url_tickets_new"] = self.getSubPageURL(request, "merge-requests_new") |
34 | 35 |
35 | 36 |
36 @defer.inlineCallbacks | 37 async def prepare_render(self, request): |
37 def prepare_render(self, request): | |
38 data = self.getRData(request) | 38 data = self.getRData(request) |
39 template_data = request.template_data | 39 template_data = request.template_data |
40 service, node = data["service"], data["node"] | 40 service, node = data["service"], data["node"] |
41 profile = self.getProfile(request) or C.SERVICE_PROFILE | 41 profile = self.getProfile(request) or C.SERVICE_PROFILE |
42 | 42 |
43 merge_requests = yield self.host.bridgeCall( | 43 merge_requests = data_format.deserialise( |
44 "mergeRequestsGet", | 44 await self.host.bridgeCall( |
45 service.full() if service else "", | 45 "mergeRequestsGet", |
46 node, | 46 service.full() if service else "", |
47 C.NO_LIMIT, | 47 node, |
48 [], | 48 C.NO_LIMIT, |
49 "", | 49 [], |
50 {"labels_as_list": C.BOOL_TRUE}, | 50 "", |
51 profile, | 51 {"labels_as_list": C.BOOL_TRUE}, |
52 profile, | |
53 ) | |
52 ) | 54 ) |
55 | |
53 template_data["tickets"] = [ | 56 template_data["tickets"] = [ |
54 template_xmlui.create(self.host, x) for x in merge_requests[0] | 57 template_xmlui.create(self.host, x) for x in merge_requests['items'] |
55 ] | 58 ] |
56 template_data["on_ticket_click"] = data_objects.OnClick( | 59 template_data["on_ticket_click"] = data_objects.OnClick( |
57 url=self.getSubPageURL(request, "merge-requests_view") + "/{item.id}" | 60 url=self.getSubPageURL(request, "merge-requests_view") + "/{item.id}" |
58 ) | 61 ) |