comparison libervia/pages/merge-requests/page_meta.py @ 1378:e3e303a30a74

pages (tickets): renamed "tickets" to "lists": "lists" is more generic, and tickets is actually a specific kind of list. /!\ "tickets_trackers_json" option has been renamed to "lists_directory_json".
author Goffi <goffi@goffi.org>
date Thu, 28 Jan 2021 18:51:44 +0100
parents 04e7dd6b6f4d
children ee1d31fe7cdf
comparison
equal deleted inserted replaced
1377:46ce79eac754 1378:e3e303a30a74
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
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
6 from sat.tools.common import template_xmlui 5 from sat.tools.common import template_xmlui
7 from sat.tools.common import data_format 6 from sat.tools.common import data_format
8 from sat.tools.common import data_objects 7 from sat.tools.common import data_objects
9 from sat.core.log import getLogger 8 from sat.core.log import getLogger
10 9
11 log = getLogger(__name__) 10 log = getLogger(__name__)
12 """ticket handling pages""" 11
13 12
14 name = "merge-requests" 13 name = "merge-requests"
15 access = C.PAGES_ACCESS_PUBLIC 14 access = C.PAGES_ACCESS_PUBLIC
16 template = "ticket/overview.html" 15 template = "list/overview.html"
17 16
18 17
19 def parse_url(self, request): 18 def parse_url(self, request):
20 self.getPathArgs(request, ["service", "node"], service="jid") 19 self.getPathArgs(request, ["service", "node"], service="jid")
21 data = self.getRData(request) 20 data = self.getRData(request)
26 node = data["node"] = "" 25 node = data["node"] = ""
27 self.checkCache( 26 self.checkCache(
28 request, C.CACHE_PUBSUB, service=service, node=node, short="merge-requests" 27 request, C.CACHE_PUBSUB, service=service, node=node, short="merge-requests"
29 ) 28 )
30 template_data = request.template_data 29 template_data = request.template_data
31 template_data["url_tickets_list"] = self.getPageByName("merge-requests").getURL( 30 template_data["url_list_items"] = self.getPageByName("merge-requests").getURL(
32 service.full(), node 31 service.full(), node
33 ) 32 )
34 template_data["url_tickets_new"] = self.getSubPageURL(request, "merge-requests_new") 33 template_data["url_list_new"] = self.getSubPageURL(request, "merge-requests_new")
35 34
36 35
37 async def prepare_render(self, request): 36 async def prepare_render(self, request):
38 data = self.getRData(request) 37 data = self.getRData(request)
39 template_data = request.template_data 38 template_data = request.template_data
51 {"labels_as_list": C.BOOL_TRUE}, 50 {"labels_as_list": C.BOOL_TRUE},
52 profile, 51 profile,
53 ) 52 )
54 ) 53 )
55 54
56 template_data["tickets"] = [ 55 template_data["list_items"] = [
57 template_xmlui.create(self.host, x) for x in merge_requests['items'] 56 template_xmlui.create(self.host, x) for x in merge_requests['items']
58 ] 57 ]
59 template_data["on_ticket_click"] = data_objects.OnClick( 58 template_data["on_list_item_click"] = data_objects.OnClick(
60 url=self.getSubPageURL(request, "merge-requests_view") + "/{item.id}" 59 url=self.getSubPageURL(request, "merge-requests_view") + "/{item.id}"
61 ) 60 )