Mercurial > libervia-web
comparison libervia/web/pages/merge-requests/page_meta.py @ 1518:eb00d593801d
refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 02 Jun 2023 16:49:28 +0200 |
parents | libervia/pages/merge-requests/page_meta.py@106bae41f5c8 |
children |
comparison
equal
deleted
inserted
replaced
1517:b8ed9726525b | 1518:eb00d593801d |
---|---|
1 #!/usr/bin/env python3 | |
2 | |
3 | |
4 from libervia.web.server.constants import Const as C | |
5 from libervia.backend.tools.common import template_xmlui | |
6 from libervia.backend.tools.common import data_format | |
7 from libervia.backend.tools.common import data_objects | |
8 from libervia.backend.core.log import getLogger | |
9 | |
10 log = getLogger(__name__) | |
11 | |
12 | |
13 name = "merge-requests" | |
14 access = C.PAGES_ACCESS_PUBLIC | |
15 template = "list/overview.html" | |
16 | |
17 | |
18 def parse_url(self, request): | |
19 self.get_path_args(request, ["service", "node"], service="jid") | |
20 data = self.get_r_data(request) | |
21 service, node = data["service"], data["node"] | |
22 if node is None: | |
23 self.page_redirect("merge-requests_disco", request) | |
24 if node == "@": | |
25 node = data["node"] = "" | |
26 self.check_cache( | |
27 request, C.CACHE_PUBSUB, service=service, node=node, short="merge-requests" | |
28 ) | |
29 template_data = request.template_data | |
30 template_data["url_list_items"] = self.get_page_by_name("merge-requests").get_url( | |
31 service.full(), node | |
32 ) | |
33 template_data["url_list_new"] = self.get_sub_page_url(request, "merge-requests_new") | |
34 | |
35 | |
36 async def prepare_render(self, request): | |
37 data = self.get_r_data(request) | |
38 template_data = request.template_data | |
39 service, node = data["service"], data["node"] | |
40 profile = self.get_profile(request) or C.SERVICE_PROFILE | |
41 | |
42 merge_requests = data_format.deserialise( | |
43 await self.host.bridge_call( | |
44 "merge_requests_get", | |
45 service.full() if service else "", | |
46 node, | |
47 C.NO_LIMIT, | |
48 [], | |
49 "", | |
50 data_format.serialise({"labels_as_list": C.BOOL_TRUE}), | |
51 profile, | |
52 ) | |
53 ) | |
54 | |
55 template_data["list_items"] = [ | |
56 template_xmlui.create(self.host, x) for x in merge_requests['items'] | |
57 ] | |
58 template_data["on_list_item_click"] = data_objects.OnClick( | |
59 url=self.get_sub_page_url(request, "merge-requests_view") + "/{item.id}" | |
60 ) |