1 | var tcDeps = null;
|
2 |
|
3 | function initDeps(){
|
4 |
|
5 |
|
6 | tcDeps = new TableCreator();
|
7 | tcDeps.init({ elementId: "DependenciesDiv",
|
8 | clickable: false,
|
9 |
|
10 | showRecordsPerPageSelector: false,
|
11 | showFieldsSelector: true,
|
12 | columns: [
|
13 | {title: "Namespace", dataKey: "namespace"},
|
14 | {title: "Function", dataKey: "name"},
|
15 | {title: "Arguments", dataKey: "arguments", width: "270px"},
|
16 | {title: "Server ID", dataKey: "serverId", visible: false},
|
17 | {title: "Server", dataKey: "serverName"}
|
18 | ],
|
19 | dataSource: async function(onData){
|
20 | let response = await req('get-dependencies');
|
21 | let deps = await response.json()
|
22 | for(let f of deps){
|
23 | f.arguments = formatFunctionArgsAsString(f.args);
|
24 | }
|
25 | onData(deps);
|
26 | },
|
27 | deleteRecord: {
|
28 | onDelete: async function(record, cb){await req("remove-dependency", record);cb();}
|
29 | },
|
30 | editRecord: {
|
31 | fields: [
|
32 | {name: "namespace", title: "Namespace"}
|
33 | ],
|
34 | onEdit: async function(oldRecord, newRecord, cb){
|
35 | newRecord.oldNamespace = oldRecord.namespace
|
36 | await req("update-dependency", newRecord);
|
37 | cb();
|
38 | }
|
39 | }
|
40 | })
|
41 | tcDeps.draw();
|
42 | }
|
43 |
|
44 | $(function() {
|
45 | initDeps();
|
46 | });
|
47 |
|
48 | function refreshDeps(){
|
49 | tcDeps.reloadData();
|
50 | }
|