Show More
@@ -723,12 +723,12 b' class MyAccountView(BaseAppView, DataGri' | |||||
723 |
|
723 | |||
724 | pull_requests = PullRequestModel().get_im_participating_in( |
|
724 | pull_requests = PullRequestModel().get_im_participating_in( | |
725 | user_id=self._rhodecode_user.user_id, |
|
725 | user_id=self._rhodecode_user.user_id, | |
726 | statuses=statuses, |
|
726 | statuses=statuses, query=search_q, | |
727 | offset=start, length=limit, order_by=order_by, |
|
727 | offset=start, length=limit, order_by=order_by, | |
728 | order_dir=order_dir) |
|
728 | order_dir=order_dir) | |
729 |
|
729 | |||
730 | pull_requests_total_count = PullRequestModel().count_im_participating_in( |
|
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 | data = [] |
|
733 | data = [] | |
734 | comments_model = CommentsModel() |
|
734 | comments_model = CommentsModel() |
@@ -355,7 +355,7 b' class PullRequestModel(BaseModel):' | |||||
355 | PullRequestReviewers.user_id == user_id).all() |
|
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 | order_by=None, order_dir='desc'): |
|
359 | order_by=None, order_dir='desc'): | |
360 | q = PullRequest.query() |
|
360 | q = PullRequest.query() | |
361 | if user_id: |
|
361 | if user_id: | |
@@ -372,6 +372,13 b' class PullRequestModel(BaseModel):' | |||||
372 | if statuses: |
|
372 | if statuses: | |
373 | q = q.filter(PullRequest.status.in_(statuses)) |
|
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 | if order_by: |
|
382 | if order_by: | |
376 | order_map = { |
|
383 | order_map = { | |
377 | 'name_raw': PullRequest.pull_request_id, |
|
384 | 'name_raw': PullRequest.pull_request_id, | |
@@ -386,19 +393,19 b' class PullRequestModel(BaseModel):' | |||||
386 |
|
393 | |||
387 | return q |
|
394 | return q | |
388 |
|
395 | |||
389 | def count_im_participating_in(self, user_id=None, statuses=None): |
|
396 | def count_im_participating_in(self, user_id=None, statuses=None, query=''): | |
390 | q = self._prepare_participating_query(user_id, statuses=statuses) |
|
397 | q = self._prepare_participating_query(user_id, statuses=statuses, query=query) | |
391 | return q.count() |
|
398 | return q.count() | |
392 |
|
399 | |||
393 | def get_im_participating_in( |
|
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 | length=None, order_by=None, order_dir='desc'): |
|
402 | length=None, order_by=None, order_dir='desc'): | |
396 | """ |
|
403 | """ | |
397 | Get all Pull requests that i'm participating in, or i have opened |
|
404 | Get all Pull requests that i'm participating in, or i have opened | |
398 | """ |
|
405 | """ | |
399 |
|
406 | |||
400 | q = self._prepare_participating_query( |
|
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 | order_dir=order_dir) |
|
409 | order_dir=order_dir) | |
403 |
|
410 | |||
404 | if length: |
|
411 | if length: |
@@ -2,11 +2,29 b'' | |||||
2 |
|
2 | |||
3 | <div class="panel panel-default"> |
|
3 | <div class="panel panel-default"> | |
4 | <div class="panel-body"> |
|
4 | <div class="panel-body"> | |
5 | %if c.closed: |
|
5 | <div style="height: 35px"> | |
6 | ${h.checkbox('show_closed',checked="checked", label=_('Show Closed Pull Requests'))} |
|
6 | <% | |
7 | %else: |
|
7 | selected_filter = 'all' | |
8 | ${h.checkbox('show_closed',label=_('Show Closed Pull Requests'))} |
|
8 | if c.closed: | |
9 | %endif |
|
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 | </div> |
|
28 | </div> | |
11 | </div> |
|
29 | </div> | |
12 |
|
30 | |||
@@ -22,15 +40,6 b'' | |||||
22 | <script type="text/javascript"> |
|
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 | // participating object list |
|
45 | // participating object list | |
@@ -41,26 +50,58 b'' | |||||
41 | "url": "${h.route_path('my_account_pullrequests_data')}", |
|
50 | "url": "${h.route_path('my_account_pullrequests_data')}", | |
42 | "data": function (d) { |
|
51 | "data": function (d) { | |
43 | d.closed = "${c.closed}"; |
|
52 | d.closed = "${c.closed}"; | |
|
53 | }, | |||
|
54 | "dataSrc": function (json) { | |||
|
55 | return json.data; | |||
44 | } |
|
56 | } | |
45 | }, |
|
57 | }, | |
|
58 | ||||
46 | dom: 'rtp', |
|
59 | dom: 'rtp', | |
47 | pageLength: ${c.visual.dashboard_items}, |
|
60 | pageLength: ${c.visual.dashboard_items}, | |
48 |
order: [[ |
|
61 | order: [[2, "desc"]], | |
49 | columns: [ |
|
62 | columns: [ | |
50 | { data: {"_": "target_repo", |
|
63 | { | |
51 | "sort": "target_repo"}, title: "${_('Target Repo')}", className: "td-targetrepo", orderable: false}, |
|
64 | data: { | |
52 |
|
|
65 | "_": "target_repo", | |
53 | "sort": "status"}, title: "", className: "td-status", orderable: false}, |
|
66 | "sort": "target_repo" | |
54 | { data: {"_": "name", |
|
67 | }, title: "${_('Target Repo')}", className: "td-targetrepo", orderable: false | |
55 | "sort": "name_raw"}, title: "${_('Id')}", className: "td-componentname", "type": "num" }, |
|
68 | }, | |
56 | { data: {"_": "title", |
|
69 | { | |
57 | "sort": "title"}, title: "${_('Title')}", className: "td-description" }, |
|
70 | data: { | |
58 |
|
|
71 | "_": "status", | |
59 | "sort": "author_raw"}, title: "${_('Author')}", className: "td-user", orderable: false }, |
|
72 | "sort": "status" | |
60 | { data: {"_": "comments", |
|
73 | }, title: "", className: "td-status", orderable: false | |
61 | "sort": "comments_raw"}, title: "", className: "td-comments", orderable: false}, |
|
74 | }, | |
62 | { data: {"_": "updated_on", |
|
75 | { | |
63 | "sort": "updated_on_raw"}, title: "${_('Last Update')}", className: "td-time" } |
|
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 | } | |||
64 | ], |
|
105 | ], | |
65 | language: { |
|
106 | language: { | |
66 | paginate: DEFAULT_GRID_PAGINATION, |
|
107 | paginate: DEFAULT_GRID_PAGINATION, | |
@@ -87,5 +128,17 b'' | |||||
87 | $pullRequestListTable.on('preXhr.dt', function(e, settings, data){ |
|
128 | $pullRequestListTable.on('preXhr.dt', function (e, settings, data) { | |
88 | $pullRequestListTable.css('opacity', 0.3); |
|
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 | </script> |
|
144 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now