Mercurial > libervia-web
annotate libervia/pages/merge-requests/page_meta.py @ 1364:df40708c4c76
server: renamed `--dev_mode` to `--dev-mode` and set it as a flag:
good practice is to use a dash instead of underscode for CLI arguments.
This options is actually a flag, no need to specify the value.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 20 Nov 2020 17:53:01 +0100 |
parents | 04e7dd6b6f4d |
children | e3e303a30a74 |
rev | line source |
---|---|
1216 | 1 #!/usr/bin/env python3 |
1239 | 2 |
991
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 from libervia.server.constants import Const as C |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 from twisted.internet import defer |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 from sat.tools.common import template_xmlui |
1302
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
7 from sat.tools.common import data_format |
991
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 from sat.tools.common import data_objects |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 from sat.core.log import getLogger |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1098
diff
changeset
|
10 |
1145
29eb15062416
pages: set __name__ for imported pages
Goffi <goffi@goffi.org>
parents:
1124
diff
changeset
|
11 log = getLogger(__name__) |
991
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 """ticket handling pages""" |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 |
1216 | 14 name = "merge-requests" |
991
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 access = C.PAGES_ACCESS_PUBLIC |
1216 | 16 template = "ticket/overview.html" |
991
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 def parse_url(self, request): |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1098
diff
changeset
|
20 self.getPathArgs(request, ["service", "node"], service="jid") |
1081
ed67265205c4
pages (merge-requests): added a discovery page similar to tickets one:
Goffi <goffi@goffi.org>
parents:
1043
diff
changeset
|
21 data = self.getRData(request) |
1216 | 22 service, node = data["service"], data["node"] |
1081
ed67265205c4
pages (merge-requests): added a discovery page similar to tickets one:
Goffi <goffi@goffi.org>
parents:
1043
diff
changeset
|
23 if node is None: |
1216 | 24 self.pageRedirect("merge-requests_disco", request) |
25 if node == "@": | |
26 node = data["node"] = "" | |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1098
diff
changeset
|
27 self.checkCache( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1098
diff
changeset
|
28 request, C.CACHE_PUBSUB, service=service, node=node, short="merge-requests" |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1098
diff
changeset
|
29 ) |
991
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 template_data = request.template_data |
1216 | 31 template_data["url_tickets_list"] = self.getPageByName("merge-requests").getURL( |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1098
diff
changeset
|
32 service.full(), node |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1098
diff
changeset
|
33 ) |
1216 | 34 template_data["url_tickets_new"] = self.getSubPageURL(request, "merge-requests_new") |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1098
diff
changeset
|
35 |
991
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 |
1302
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
37 async def prepare_render(self, request): |
991
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 data = self.getRData(request) |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 template_data = request.template_data |
1216 | 40 service, node = data["service"], data["node"] |
991
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 profile = self.getProfile(request) or C.SERVICE_PROFILE |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 |
1302
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
43 merge_requests = data_format.deserialise( |
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
44 await self.host.bridgeCall( |
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
45 "mergeRequestsGet", |
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
46 service.full() if service else "", |
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
47 node, |
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
48 C.NO_LIMIT, |
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
49 [], |
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
50 "", |
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
51 {"labels_as_list": C.BOOL_TRUE}, |
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
52 profile, |
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
53 ) |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1098
diff
changeset
|
54 ) |
1302
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
55 |
1216 | 56 template_data["tickets"] = [ |
1302
04e7dd6b6f4d
pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
57 template_xmlui.create(self.host, x) for x in merge_requests['items'] |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1098
diff
changeset
|
58 ] |
1216 | 59 template_data["on_ticket_click"] = data_objects.OnClick( |
60 url=self.getSubPageURL(request, "merge-requests_view") + "/{item.id}" | |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1098
diff
changeset
|
61 ) |