Show More
@@ -723,12 +723,12 b' class MyAccountView(BaseAppView, DataGri' | |||
|
723 | 723 | |
|
724 | 724 | pull_requests = PullRequestModel().get_im_participating_in( |
|
725 | 725 | user_id=self._rhodecode_user.user_id, |
|
726 | statuses=statuses, | |
|
726 | statuses=statuses, query=search_q, | |
|
727 | 727 | offset=start, length=limit, order_by=order_by, |
|
728 | 728 | order_dir=order_dir) |
|
729 | 729 | |
|
730 | 730 | pull_requests_total_count = PullRequestModel().count_im_participating_in( |
|
731 | user_id=self._rhodecode_user.user_id, statuses=statuses) | |
|
731 | user_id=self._rhodecode_user.user_id, statuses=statuses, query=search_q) | |
|
732 | 732 | |
|
733 | 733 | data = [] |
|
734 | 734 | comments_model = CommentsModel() |
@@ -355,7 +355,7 b' class PullRequestModel(BaseModel):' | |||
|
355 | 355 | PullRequestReviewers.user_id == user_id).all() |
|
356 | 356 | ] |
|
357 | 357 | |
|
358 | def _prepare_participating_query(self, user_id=None, statuses=None, | |
|
358 | def _prepare_participating_query(self, user_id=None, statuses=None, query='', | |
|
359 | 359 | order_by=None, order_dir='desc'): |
|
360 | 360 | q = PullRequest.query() |
|
361 | 361 | if user_id: |
@@ -372,6 +372,13 b' class PullRequestModel(BaseModel):' | |||
|
372 | 372 | if statuses: |
|
373 | 373 | q = q.filter(PullRequest.status.in_(statuses)) |
|
374 | 374 | |
|
375 | if query: | |
|
376 | like_expression = u'%{}%'.format(safe_unicode(query)) | |
|
377 | q = q.filter(or_( | |
|
378 | cast(PullRequest.pull_request_id, String).ilike(like_expression), | |
|
379 | PullRequest.title.ilike(like_expression), | |
|
380 | PullRequest.description.ilike(like_expression), | |
|
381 | )) | |
|
375 | 382 | if order_by: |
|
376 | 383 | order_map = { |
|
377 | 384 | 'name_raw': PullRequest.pull_request_id, |
@@ -386,19 +393,19 b' class PullRequestModel(BaseModel):' | |||
|
386 | 393 | |
|
387 | 394 | return q |
|
388 | 395 | |
|
389 | def count_im_participating_in(self, user_id=None, statuses=None): | |
|
390 | q = self._prepare_participating_query(user_id, statuses=statuses) | |
|
396 | def count_im_participating_in(self, user_id=None, statuses=None, query=''): | |
|
397 | q = self._prepare_participating_query(user_id, statuses=statuses, query=query) | |
|
391 | 398 | return q.count() |
|
392 | 399 | |
|
393 | 400 | def get_im_participating_in( |
|
394 | self, user_id=None, statuses=None, offset=0, | |
|
401 | self, user_id=None, statuses=None, query='', offset=0, | |
|
395 | 402 | length=None, order_by=None, order_dir='desc'): |
|
396 | 403 | """ |
|
397 | 404 | Get all Pull requests that i'm participating in, or i have opened |
|
398 | 405 | """ |
|
399 | 406 | |
|
400 | 407 | q = self._prepare_participating_query( |
|
401 | user_id, statuses=statuses, order_by=order_by, | |
|
408 | user_id, statuses=statuses, query=query, order_by=order_by, | |
|
402 | 409 | order_dir=order_dir) |
|
403 | 410 | |
|
404 | 411 | if length: |
@@ -2,11 +2,29 b'' | |||
|
2 | 2 | |
|
3 | 3 | <div class="panel panel-default"> |
|
4 | 4 | <div class="panel-body"> |
|
5 | %if c.closed: | |
|
6 | ${h.checkbox('show_closed',checked="checked", label=_('Show Closed Pull Requests'))} | |
|
7 | %else: | |
|
8 | ${h.checkbox('show_closed',label=_('Show Closed Pull Requests'))} | |
|
9 | %endif | |
|
5 | <div style="height: 35px"> | |
|
6 | <% | |
|
7 | selected_filter = 'all' | |
|
8 | if c.closed: | |
|
9 | selected_filter = 'all_closed' | |
|
10 | %> | |
|
11 | ||
|
12 | <ul class="button-links"> | |
|
13 | <li class="btn ${h.is_active('all', selected_filter)}"><a href="${h.route_path('my_account_pullrequests')}">${_('All')}</a></li> | |
|
14 | <li class="btn ${h.is_active('all_closed', selected_filter)}"><a href="${h.route_path('my_account_pullrequests', _query={'pr_show_closed':1})}">${_('All + Closed')}</a></li> | |
|
15 | </ul> | |
|
16 | ||
|
17 | <div class="grid-quick-filter"> | |
|
18 | <ul class="grid-filter-box"> | |
|
19 | <li class="grid-filter-box-icon"> | |
|
20 | <i class="icon-search"></i> | |
|
21 | </li> | |
|
22 | <li class="grid-filter-box-input"> | |
|
23 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/> | |
|
24 | </li> | |
|
25 | </ul> | |
|
26 | </div> | |
|
27 | </div> | |
|
10 | 28 | </div> |
|
11 | 29 | </div> |
|
12 | 30 | |
@@ -20,72 +38,107 b'' | |||
|
20 | 38 | </div> |
|
21 | 39 | |
|
22 | 40 | <script type="text/javascript"> |
|
23 | $(document).ready(function() { | |
|
41 | $(document).ready(function () { | |
|
24 | 42 | |
|
25 | $('#show_closed').on('click', function(e){ | |
|
26 | if($(this).is(":checked")){ | |
|
27 | window.location = "${h.route_path('my_account_pullrequests', _query={'pr_show_closed':1})}"; | |
|
28 | } | |
|
29 | else{ | |
|
30 | window.location = "${h.route_path('my_account_pullrequests')}"; | |
|
31 | } | |
|
32 | }); | |
|
33 | ||
|
34 | var $pullRequestListTable = $('#pull_request_list_table'); | |
|
43 | var $pullRequestListTable = $('#pull_request_list_table'); | |
|
35 | 44 | |
|
36 | 45 | // participating object list |
|
37 | 46 | $pullRequestListTable.DataTable({ |
|
38 | processing: true, | |
|
39 | serverSide: true, | |
|
40 | ajax: { | |
|
41 | "url": "${h.route_path('my_account_pullrequests_data')}", | |
|
42 | "data": function (d) { | |
|
43 | d.closed = "${c.closed}"; | |
|
44 | } | |
|
45 | }, | |
|
46 | dom: 'rtp', | |
|
47 | pageLength: ${c.visual.dashboard_items}, | |
|
48 | order: [[ 2, "desc" ]], | |
|
49 | columns: [ | |
|
50 | { data: {"_": "target_repo", | |
|
51 | "sort": "target_repo"}, title: "${_('Target Repo')}", className: "td-targetrepo", orderable: false}, | |
|
52 | { data: {"_": "status", | |
|
53 | "sort": "status"}, title: "", className: "td-status", orderable: false}, | |
|
54 | { data: {"_": "name", | |
|
55 | "sort": "name_raw"}, title: "${_('Id')}", className: "td-componentname", "type": "num" }, | |
|
56 |
|
|
|
57 | "sort": "title"}, title: "${_('Title')}", className: "td-description" }, | |
|
58 | { data: {"_": "author", | |
|
59 | "sort": "author_raw"}, title: "${_('Author')}", className: "td-user", orderable: false }, | |
|
60 | { data: {"_": "comments", | |
|
61 | "sort": "comments_raw"}, title: "", className: "td-comments", orderable: false}, | |
|
62 |
|
|
|
63 | "sort": "updated_on_raw"}, title: "${_('Last Update')}", className: "td-time" } | |
|
64 | ], | |
|
65 | language: { | |
|
47 | processing: true, | |
|
48 | serverSide: true, | |
|
49 | ajax: { | |
|
50 | "url": "${h.route_path('my_account_pullrequests_data')}", | |
|
51 | "data": function (d) { | |
|
52 | d.closed = "${c.closed}"; | |
|
53 | }, | |
|
54 | "dataSrc": function (json) { | |
|
55 | return json.data; | |
|
56 | } | |
|
57 | }, | |
|
58 | ||
|
59 | dom: 'rtp', | |
|
60 | pageLength: ${c.visual.dashboard_items}, | |
|
61 | order: [[2, "desc"]], | |
|
62 | columns: [ | |
|
63 | { | |
|
64 | data: { | |
|
65 | "_": "target_repo", | |
|
66 | "sort": "target_repo" | |
|
67 | }, title: "${_('Target Repo')}", className: "td-targetrepo", orderable: false | |
|
68 | }, | |
|
69 | { | |
|
70 | data: { | |
|
71 | "_": "status", | |
|
72 | "sort": "status" | |
|
73 | }, title: "", className: "td-status", orderable: false | |
|
74 | }, | |
|
75 | { | |
|
76 | data: { | |
|
77 | "_": "name", | |
|
78 | "sort": "name_raw" | |
|
79 | }, title: "${_('Id')}", className: "td-componentname", "type": "num" | |
|
80 | }, | |
|
81 | { | |
|
82 | data: { | |
|
83 | "_": "title", | |
|
84 | "sort": "title" | |
|
85 | }, title: "${_('Title')}", className: "td-description" | |
|
86 | }, | |
|
87 | { | |
|
88 | data: { | |
|
89 | "_": "author", | |
|
90 | "sort": "author_raw" | |
|
91 | }, title: "${_('Author')}", className: "td-user", orderable: false | |
|
92 | }, | |
|
93 | { | |
|
94 | data: { | |
|
95 | "_": "comments", | |
|
96 | "sort": "comments_raw" | |
|
97 | }, title: "", className: "td-comments", orderable: false | |
|
98 | }, | |
|
99 | { | |
|
100 | data: { | |
|
101 | "_": "updated_on", | |
|
102 | "sort": "updated_on_raw" | |
|
103 | }, title: "${_('Last Update')}", className: "td-time" | |
|
104 | } | |
|
105 | ], | |
|
106 | language: { | |
|
66 | 107 | paginate: DEFAULT_GRID_PAGINATION, |
|
67 | 108 | sProcessing: _gettext('loading...'), |
|
68 | 109 | emptyTable: _gettext("There are currently no open pull requests requiring your participation.") |
|
69 | }, | |
|
70 |
"drawCallback": function( |
|
|
71 | timeagoActivate(); | |
|
72 | tooltipActivate(); | |
|
73 | }, | |
|
74 |
"createdRow": function ( |
|
|
75 | if (data['closed']) { | |
|
76 | $(row).addClass('closed'); | |
|
77 | } | |
|
78 | if (data['owned']) { | |
|
79 | $(row).addClass('owned'); | |
|
80 | } | |
|
81 | } | |
|
110 | }, | |
|
111 | "drawCallback": function (settings, json) { | |
|
112 | timeagoActivate(); | |
|
113 | tooltipActivate(); | |
|
114 | }, | |
|
115 | "createdRow": function (row, data, index) { | |
|
116 | if (data['closed']) { | |
|
117 | $(row).addClass('closed'); | |
|
118 | } | |
|
119 | if (data['owned']) { | |
|
120 | $(row).addClass('owned'); | |
|
121 | } | |
|
122 | } | |
|
82 | 123 | }); |
|
83 | $pullRequestListTable.on('xhr.dt', function(e, settings, json, xhr){ | |
|
124 | $pullRequestListTable.on('xhr.dt', function (e, settings, json, xhr) { | |
|
84 | 125 | $pullRequestListTable.css('opacity', 1); |
|
85 | 126 | }); |
|
86 | 127 | |
|
87 | $pullRequestListTable.on('preXhr.dt', function(e, settings, data){ | |
|
128 | $pullRequestListTable.on('preXhr.dt', function (e, settings, data) { | |
|
88 | 129 | $pullRequestListTable.css('opacity', 0.3); |
|
89 | 130 | }); |
|
131 | ||
|
132 | // filter | |
|
133 | $('#q_filter').on('keyup', | |
|
134 | $.debounce(250, function () { | |
|
135 | $pullRequestListTable.DataTable().search( | |
|
136 | $('#q_filter').val() | |
|
137 | ).draw(); | |
|
138 | }) | |
|
139 | ); | |
|
140 | ||
|
90 | 141 | }); |
|
142 | ||
|
143 | ||
|
91 | 144 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now