Passed
Push — master ( 62d7d9...8230b1 )
by Alexander
03:29
created

tcms/bugs/static/bugs/js/search.js (4 issues)

Severity
1
2
$(document).ready(function() {
3
    var table = $("#resultsTable").DataTable({
4
        ajax: function(data, callback, settings) {
0 ignored issues
show
The parameter settings is not used and could be removed.

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.

Loading history...
5
            var params = {};
6
7
            if ($('#id_summary').val()) {
8
                params['summary__icontains'] = $('#id_summary').val();
9
            }
10
11
            if ($('#id_product').val()) {
12
                params['product'] = $('#id_product').val();
13
            };
14
15
            if ($('#id_version').val()) {
16
                params['version'] = $('#id_version').val();
17
            };
18
19
            if ($('#id_build').val()) {
20
                params['build'] = $('#id_build').val();
21
            };
22
23
            if ($('#id_reporter').val()) {
24
                params['reporter__username__startswith'] = $('#id_reporter').val();
25
            };
26
27
            if ($('#id_assignee').val()) {
28
                params['assignee__username__startswith'] = $('#id_assignee').val();
29
            };
30
31
            if ($('#id_before').val()) {
32
                params['created_at__lte'] = $('#id_before').data('DateTimePicker').date().format('YYYY-MM-DD 23:59:59');
33
            }
34
35
            if ($('#id_after').val()) {
36
                params['created_at__gte'] = $('#id_after').data('DateTimePicker').date().format('YYYY-MM-DD 00:00:00');
37
            }
38
39
            params['status'] = $('#id_status').is(':checked');
40
41
            dataTableJsonRPC('Bug.filter', params, callback);
42
        },
43
        columns: [
44
            { data: "pk" },
45
            {
46
                data: null,
47
                render: function (data, type, full, meta) {
0 ignored issues
show
The parameter type is not used and could be removed.

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.

Loading history...
The parameter full is not used and could be removed.

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.

Loading history...
The parameter meta is not used and could be removed.

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.

Loading history...
48
                    return '<a href="/bugs/'+ data.pk + '/" target="_parent">' + escapeHTML(data.summary) + '</a>';
49
                }
50
            },
51
            { data: "created_at" },
52
            { data: "product__name" },
53
            { data: "version__value"},
54
            { data: "build__name"},
55
            { data: "reporter__username" },
56
            { data: "assignee__username" },
57
        ],
58
        dom: "t",
59
        language: {
60
            loadingRecords: '<div class="spinner spinner-lg"></div>',
61
            processing: '<div class="spinner spinner-lg"></div>',
62
            zeroRecords: "No records found"
63
        },
64
        order: [[ 0, 'asc' ]],
65
    });
66
67
    hookIntoPagination('#resultsTable', table);
68
69
    $('#btn_search').click(function() {
70
        table.ajax.reload();
71
        return false; // so we don't actually send the form
72
    });
73
74
    $('#id_product').change(function() {
75
        update_version_select_from_product();
76
        update_build_select_from_product(true);
77
    });
78
79
    $('.bootstrap-switch').bootstrapSwitch();
80
81
    $('.selectpicker').selectpicker();
82
});
83