Completed
Push — master ( e1ba59...cb8392 )
by Dimas
07:55
created

etc/superuser/users/index.js   A

Complexity

Total Complexity 5
Complexity/F 1

Size

Lines of Code 74
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 53
c 0
b 0
f 0
dl 0
loc 74
rs 10
wmc 5
mnd 0
bc 0
fnc 5
bpm 0
cpm 1
noi 1

1 Function

Rating   Name   Duplication   Size   Complexity  
B index.js ➔ loadDT 0 51 5
1
var table;
2
$(document).ready(function () {
3
  load_module(
4
    [
5
      "datatables.net",
6
      "datatables.net-bs4",
7
      "datatables.net-colreorder",
8
      "datatables.net-rowreorder",
9
      "datatables.net-scroller",
10
      "datatables.net-select",
11
      "datatables.net-buttons",
12
      "datatables.net-buttons-html5",
13
    ],
14
    function () {
15
      loadCSS([
16
        "https://adminlte.io/themes/v3/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css",
17
        "https://adminlte.io/themes/v3/plugins/datatables-responsive/css/responsive.bootstrap4.min.css",
18
      ]);
19
      datatables_init().then(loadDT);
20
    }
21
  );
22
});
23
24
function loadDT() {
25
  table = $("#list").DataTable({
26
    destroy: true,
27
    //dom: "Bfrtip",
28
    processing: false,
29
    serverSide: false,
30
    stateSave: false,
31
    autoWidth: false,
32
    responsive: true,
33
    deferRender: true,
34
    paging: true,
35
    lengthMenu: [5, 10, 15, 20, 25, 30, 100, 200, 300, 400, 500, "All"],
36
    ajax: {
37
      url: "list",
38
      method: "POST",
39
      data: {
40
        "list-user": guid(),
41
      },
42
      dataSrc: function (res) {
43
        console.log(res);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
44
45
        return res;
46
      },
47
    },
48
    columns: [
49
      {
50
        title: "username",
51
        data: "username",
52
      },
53
      {
54
        title: "name",
55
        data: "display_name",
56
      },
57
      {
58
        title: "email",
59
        data: "email",
60
      },
61
      {
62
        title: "Role",
63
        data: "role",
64
      },
65
      {
66
        title: "Last seen",
67
        data: "last_seen",
68
      },
69
    ],
70
  });
71
  table.on("init.dt", function () {
72
    $(this).removeClass("table-loader").show();
73
  });
74
}
75