Mercurial > libervia-web
annotate src/pages/merge-requests/page_meta.py @ 1106:09feea19d7b9
browser, server: added namespacesGet, so Libervia legacy app can run again
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 03 Jun 2018 13:55:09 +0200 |
parents | 01e95ec9df9e |
children | cdd389ef97bc |
rev | line source |
---|---|
991
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python2.7 |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
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 |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 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
|
8 from sat.core.log import getLogger |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 log = getLogger('pages/ticket') |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 """ticket handling pages""" |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
1081
ed67265205c4
pages (merge-requests): added a discovery page similar to tickets one:
Goffi <goffi@goffi.org>
parents:
1043
diff
changeset
|
12 name = u'merge-requests' |
991
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 access = C.PAGES_ACCESS_PUBLIC |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 template = u"ticket/overview.html" |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 def parse_url(self, request): |
1081
ed67265205c4
pages (merge-requests): added a discovery page similar to tickets one:
Goffi <goffi@goffi.org>
parents:
1043
diff
changeset
|
18 self.getPathArgs(request, ['service', 'node'], service='jid') |
ed67265205c4
pages (merge-requests): added a discovery page similar to tickets one:
Goffi <goffi@goffi.org>
parents:
1043
diff
changeset
|
19 data = self.getRData(request) |
ed67265205c4
pages (merge-requests): added a discovery page similar to tickets one:
Goffi <goffi@goffi.org>
parents:
1043
diff
changeset
|
20 service, node = data[u'service'], data[u'node'] |
ed67265205c4
pages (merge-requests): added a discovery page similar to tickets one:
Goffi <goffi@goffi.org>
parents:
1043
diff
changeset
|
21 if node is None: |
ed67265205c4
pages (merge-requests): added a discovery page similar to tickets one:
Goffi <goffi@goffi.org>
parents:
1043
diff
changeset
|
22 self.pageRedirect(u"merge-requests_disco", request) |
ed67265205c4
pages (merge-requests): added a discovery page similar to tickets one:
Goffi <goffi@goffi.org>
parents:
1043
diff
changeset
|
23 if node == u'@': |
ed67265205c4
pages (merge-requests): added a discovery page similar to tickets one:
Goffi <goffi@goffi.org>
parents:
1043
diff
changeset
|
24 node = data[u'node'] = u'' |
991
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 self.checkCache(request, C.CACHE_PUBSUB, service=service, node=node, short='merge-requests') |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 template_data = request.template_data |
1081
ed67265205c4
pages (merge-requests): added a discovery page similar to tickets one:
Goffi <goffi@goffi.org>
parents:
1043
diff
changeset
|
27 template_data[u'url_tickets_list'] = self.getPageByName('merge-requests').getURL(service.full(), node) |
991
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 template_data[u'url_tickets_new'] = self.getSubPageURL(request, 'merge-requests_new') |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 @defer.inlineCallbacks |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 def prepare_render(self, request): |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 data = self.getRData(request) |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 template_data = request.template_data |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 service, node = data[u'service'], data[u'node'] |
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 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
|
36 |
1098
01e95ec9df9e
server, pages: fixed blocking calls to bridge by using bridgeCall instead
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
37 merge_requests = yield self.host.bridgeCall("mergeRequestsGet", service.full() if service else u'', node, C.NO_LIMIT, [], '', {'labels_as_list': C.BOOL_TRUE}, profile) |
991
6ce9647011b3
pages(merge-requests): merge requests new, view and list pages implementations.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 template_data[u'tickets'] = [template_xmlui.create(self.host, x) for x in merge_requests[0]] |
1043
d8666fdb015c
pages (tickets, merge-requests): fixed items URLs
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
39 template_data[u'on_ticket_click'] = data_objects.OnClick(url=self.getSubPageURL(request, u'merge-requests_view') + u'/{item.id}') |