1 | |||
2 | $(document).ready(function () { |
||
3 | const table = $('#resultsTable').DataTable({ |
||
4 | pageLength: $('#navbar').data('defaultpagesize'), |
||
5 | ajax: function (data, callback, settings) { |
||
0 ignored issues
–
show
|
|||
6 | const params = {} |
||
7 | |||
8 | if ($('#id_summary').val()) { |
||
9 | params.summary__icontains = $('#id_summary').val() |
||
10 | } |
||
11 | |||
12 | if ($('#id_product').val()) { |
||
13 | params.product = $('#id_product').val() |
||
14 | }; |
||
15 | |||
16 | if ($('#id_version').val()) { |
||
17 | params.version = $('#id_version').val() |
||
18 | }; |
||
19 | |||
20 | if ($('#id_build').val()) { |
||
21 | params.build = $('#id_build').val() |
||
22 | }; |
||
23 | |||
24 | if ($('#id_reporter').val()) { |
||
25 | params.reporter__username__startswith = $('#id_reporter').val() |
||
26 | }; |
||
27 | |||
28 | if ($('#id_assignee').val()) { |
||
29 | params.assignee__username__startswith = $('#id_assignee').val() |
||
30 | }; |
||
31 | |||
32 | if ($('#id_before').val()) { |
||
33 | params.created_at__lte = $('#id_before').data('DateTimePicker').date().format('YYYY-MM-DD 23:59:59') |
||
34 | } |
||
35 | |||
36 | if ($('#id_after').val()) { |
||
37 | params.created_at__gte = $('#id_after').data('DateTimePicker').date().format('YYYY-MM-DD 00:00:00') |
||
38 | } |
||
39 | |||
40 | params.status = $('#id_status').is(':checked') |
||
41 | |||
42 | dataTableJsonRPC('Bug.filter', params, callback) |
||
43 | }, |
||
44 | columns: [ |
||
45 | { data: 'pk' }, |
||
46 | { |
||
47 | data: null, |
||
48 | render: function (data, type, full, meta) { |
||
0 ignored issues
–
show
|
|||
49 | return '<a href="/bugs/' + data.pk + '/" target="_parent">' + escapeHTML(data.summary) + '</a>' |
||
50 | } |
||
51 | }, |
||
52 | { data: 'created_at' }, |
||
53 | { data: 'product__name' }, |
||
54 | { data: 'version__value' }, |
||
55 | { data: 'build__name' }, |
||
56 | { data: 'reporter__username' }, |
||
57 | { data: 'assignee__username' } |
||
58 | ], |
||
59 | dom: 't', |
||
60 | language: { |
||
61 | loadingRecords: '<div class="spinner spinner-lg"></div>', |
||
62 | processing: '<div class="spinner spinner-lg"></div>', |
||
63 | zeroRecords: 'No records found' |
||
64 | }, |
||
65 | order: [[0, 'asc']] |
||
66 | }) |
||
67 | |||
68 | hookIntoPagination('#resultsTable', table) |
||
69 | |||
70 | $('#btn_search').click(function () { |
||
71 | table.ajax.reload() |
||
72 | return false // so we don't actually send the form |
||
73 | }) |
||
74 | |||
75 | $('#id_product').change(function () { |
||
76 | updateVersionSelectFromProduct() |
||
77 | }) |
||
78 | |||
79 | $('#id_version').change(function () { |
||
80 | updateBuildSelectFromVersion(true) |
||
81 | }) |
||
82 | |||
83 | $('.bootstrap-switch').bootstrapSwitch() |
||
84 | |||
85 | $('.selectpicker').selectpicker() |
||
86 | }) |
||
87 |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.