How to use usage method in istanbul

Best JavaScript code snippet using istanbul

data.js

Source:data.js Github

copy

Full Screen

1const data = [2 { "floor": 1 },3 { courseName: "courseName", teacherName: "张爱玲", className: "101", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },4 { courseName: "courseName", teacherName: "张爱玲", className: "102", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },5 { courseName: "courseName", teacherName: "张爱玲", className: "103", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },6 { courseName: "courseName", teacherName: "张爱玲", className: "104", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },7 { courseName: "courseName", teacherName: "张爱玲", className: "105", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },8 { courseName: "courseName", teacherName: "张爱玲", className: "104", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },9 { courseName: "courseName", teacherName: "张爱玲", className: "105", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },10 { "floor": 2 },11 { courseName: "courseName", teacherName: "张爱玲", className: "101", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },12 { courseName: "courseName", teacherName: "张爱玲", className: "102", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },13 { courseName: "courseName", teacherName: "张爱玲", className: "103", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },14 { courseName: "courseName", teacherName: "张爱玲", className: "104", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },15 { courseName: "courseName", teacherName: "张爱玲", className: "105", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },16 { courseName: "courseName", teacherName: "张爱玲", className: "104", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },17 { courseName: "courseName", teacherName: "张爱玲", className: "105", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },18 { "floor": 3 },19 { courseName: "courseName", teacherName: "张爱玲", className: "101", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },20 { courseName: "courseName", teacherName: "张爱玲", className: "102", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },21 { courseName: "courseName", teacherName: "张爱玲", className: "103", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },22 { courseName: "courseName", teacherName: "张爱玲", className: "104", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },23 { courseName: "courseName", teacherName: "张爱玲", className: "105", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },24 { courseName: "courseName", teacherName: "张爱玲", className: "104", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },25 { courseName: "courseName", teacherName: "张爱玲", className: "105", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },26]27const classInfoData2 = [28 { floor: 1, courseName: "courseName", teacherName: "张爱玲", className: "101", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },29 { floor: 1, courseName: "courseName", teacherName: "张爱玲", className: "102", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },30 { floor: 1, courseName: "courseName", teacherName: "张爱玲", className: "103", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },31 { floor: 1, courseName: "courseName", teacherName: "张爱玲", className: "104", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },32 { floor: 1, courseName: "courseName", teacherName: "张爱玲", className: "105", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },33 { floor: 1, courseName: "courseName", teacherName: "张爱玲", className: "104", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },34 { floor: 1, courseName: "courseName", teacherName: "张爱玲", className: "105", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },35 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },36 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },37 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },38 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },39 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },40 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },41 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },42 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },43 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },44 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },45 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },46 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },47 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },48 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },49 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },50 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },51 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },52 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },53 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },54 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },55 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },56 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },57 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },58 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },59 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },60 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },61 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },62 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },63 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },64 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },65 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },66 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },67 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },68 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },69 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },70 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },71 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },72 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },73 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },74 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },75 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },76 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },77 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },78 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },79 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },80 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },81 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },82 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },83 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },84 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },85 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },86 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },87 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },88 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },89 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },90 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },91 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },92 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },93 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },94 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: new Date().getTime() },95 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: new Date().getTime() },96]97const classInfoData3 = [98 {99 floor: 1,100 classes: [101 { floor: 1, courseName: "courseName", teacherName: "张爱玲", className: "101", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },102 { floor: 1, courseName: "courseName", teacherName: "张爱玲", className: "102", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },103 { floor: 1, courseName: "courseName", teacherName: "张爱玲", className: "103", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },104 { floor: 1, courseName: "courseName", teacherName: "张爱玲", className: "104", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },105 { floor: 1, courseName: "courseName", teacherName: "张爱玲", className: "105", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },106 { floor: 1, courseName: "courseName", teacherName: "张爱玲", className: "104", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },107 { floor: 1, courseName: "courseName", teacherName: "张爱玲", className: "105", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },108 ]109 }, {110 floor: 2,111 classes: [112 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },113 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },114 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },115 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },116 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },117 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },118 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },119 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },120 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },121 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },122 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },123 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },124 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },125 { floor: 2, courseName: "courseName", teacherName: "张爱玲", className: "201", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },126 ]127 }, {128 floor: 3,129 classes: [130 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },131 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },132 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },133 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },134 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },135 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },136 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },137 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },138 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },139 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },140 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },141 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },142 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },143 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },144 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },145 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },146 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },147 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },148 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },149 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },150 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },151 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },152 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },153 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },154 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },155 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },156 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },157 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },158 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },159 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },160 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },161 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },162 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },163 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },164 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },165 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },166 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },167 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },168 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },169 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },170 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },171 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },172 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },173 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },174 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },175 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: false, usageRate: 23.4, nextTime: "15h 33m" },176 { floor: 3, courseName: "courseName", teacherName: "张爱玲", className: "301", isonclass: true, usageRate: 23.4, nextTime: "15h 33m" },177 ]178 }179]180const testRenderData = (data) => {181 console.log(1, data);182 // 假设能放5行183 var rowNum = 5;184 // 有5列185 var rolNum = 5;186 var index = 1187 var renderData = []188 // setInterval(() => {189 this.test1(data, rowNum, rolNum, rowNum, rowNum * rolNum, renderData)190 // }, 5000);191}192const test1 = (data, rowNum, rolNum, useRow, maxLen, renderData) => {193 console.log(1, data);194 var data = data195 var renderData = renderData196 var useRow = useRow197 // 如果第一组数据的 classes 的长度 小于或等于可放置的长度198 if (data[0].classes.length < maxLen || data[0].classes.length === maxLen) {199 // 表示第一组数据可以在一页显示完200 // 余下多少行201 useRow = rowNum - Math.ceil(data[0].classes.length / rolNum)202 renderData.push(data[0])203 // 删除添加进去的组204 data.splice(0, 1);205 if (useRow > 0) {206 // this.test1(data, rowNum, rolNum, useRow, useRow * 5, renderData)207 }208 } else {209 // 第一组数据的长度大于了剩余长度 则截取剩余长度 的数据出来210 // 复制第一组数据211 var firstData = data[0]212 // 剩余长度213 var maxLen = maxLen214 }215}...

Full Screen

Full Screen

commands.js

Source:commands.js Github

copy

Full Screen

1require("dotenv").config();2const Discord = require("discord.js");3const Command = require("../../structures/Commandos.js");4const GuildModel = require("../../models/guild.js");5const {6 DiscordMenus,7 ButtonBuilder,8 MenuBuilder9} = require("discord-menus");10const fs = require("fs");11require("discord-reply");12let descripcion, usage;13let encendido = false;14module.exports = class Commands extends Command {15 constructor(client) {16 super(client, {17 name: "commands",18 description: [19 "List all of my commands and its uses.",20 "Muestra todos mis comandos y la información de los mismos.",21 ],22 cooldown: 5,23 alias: ["comandos", "commandos", "comands"],24 usage: ["<command>", "<commando>"],25 botpermissions: ["ADD_REACTIONS"],26 category: "Info",27 });28 }29 async run(client, message, args, prefix, lang, webhookClient, ipc) {30 try {31 // if (message.member.user.OLDMODE) {32 // let mod = new MessageButton()33 // .setStyle("blurple") //default: blurple34 // .setLabel(` ${client.language.COMMANDS[1]}`) //default: NO_LABEL_PROVIDED35 // .setEmoji("🔒")36 // .setID("b1");37 // let games = new MessageButton()38 // .setStyle("blurple") //default: blurple39 // .setLabel(` ${client.language.COMMANDS[2]}`) //default: NO_LABEL_PROVIDED40 // .setEmoji("🎮")41 // .setID("b2");42 // let music = new MessageButton()43 // .setStyle("blurple") //default: blurple44 // .setLabel(` ${client.language.COMMANDS[3]}`) //default: NO_LABEL_PROVIDED45 // .setEmoji("🎶")46 // .setID("b3");47 // let utility = new MessageButton()48 // .setStyle("blurple") //default: blurple49 // .setLabel(` ${client.language.COMMANDS[4]}`) //default: NO_LABEL_PROVIDED50 // .setEmoji("🌐")51 // .setID("b4");52 // let info = new MessageButton()53 // .setStyle("blurple") //default: blurple54 // .setLabel(` ${client.language.COMMANDS[5]}`) //default: NO_LABEL_PROVIDED55 // .setEmoji("🛠️")56 // .setID("b5");57 // let ButtonArray = [mod, games, music, utility, info];58 // const embed = new Discord.MessageEmbed()59 // .setColor(process.env.EMBED_COLOR)60 // .setDescription(61 // `<a:828830816486293608:836296002893381682> ${client.language.COMMANDS[6]} \`${message.guild.prefix}help <${client.language.COMMANDS[7]}>\` ${client.language.COMMANDS[8]}.`62 // )63 // .addField(client.language.COMMANDS[9], client.language.COMMANDS[10])64 // .setThumbnail(message.author.avatarURL({65 // dynamic: true66 // }))67 // .setTitle(`✨ - ${client.language.COMMANDS[11]}`);68 // //let user = client.users.cache.get(message.author.id)69 // //message.lineReply('¡Te he enviado un mensaje privado con mis comandos!')70 // message.channel.send({71 // embeds: embed,72 // buttons: ButtonArray,73 // });74 // if (encendido == false) {75 // client.on("clickButton", async (button, err) => {76 // if (err) return;77 // try {78 // if (button.id === "b1") {79 // let test = "";80 // client.commands.forEach((cmd) => {81 // descripcion =82 // lang == "en_US" ? cmd.description[0] : cmd.description[1];83 // if (cmd.usage) {84 // usage = lang == "en_US" ? cmd.usage[0] : cmd.usage[1];85 // } else {86 // usage = "";87 // }88 // if (cmd.category === "Moderacion") {89 // if (90 // usage &&91 // !cmd.inactive &&92 // !cmd.production &&93 // cmd.role != "dev"94 // ) {95 // test += ` **${message.guild.prefix}${cmd.name} ** -${descripcion} | \`${message.guild.prefix}${cmd.name} ${usage}\` \n `;96 // } else if (97 // !usage &&98 // !cmd.inactive &&99 // !cmd.production &&100 // cmd.role != "dev"101 // ) {102 // test += `**${message.guild.prefix}${cmd.name}** - ${descripcion} | \`${message.guild.prefix}${cmd.name}\` \n `;103 // }104 // }105 // });106 // const embed = new Discord.MessageEmbed().setDescription(test);107 // await button.reply.send({108 // embed: embed,109 // ephemeral: true110 // });111 // } else if (button.id === "b2") {112 // let test = "";113 // client.commands.forEach((cmd) => {114 // if (cmd.usage) {115 // usage = lang == "en_US" ? cmd.usage[0] : cmd.usage[1];116 // } else {117 // usage = "";118 // }119 // descripcion =120 // lang == "en_US" ? cmd.description[0] : cmd.description[1];121 // if (cmd.category === "Juego") {122 // if (123 // usage &&124 // !cmd.inactive &&125 // !cmd.production &&126 // cmd.role !== "dev"127 // ) {128 // test += `**${message.guild.prefix}${cmd.name}** - ${descripcion} | \`${message.guild.prefix}${cmd.name} ${usage}\` \n `;129 // } else if (130 // !usage &&131 // !cmd.inactive &&132 // !cmd.production &&133 // cmd.role !== "dev"134 // ) {135 // test += `**${message.guild.prefix}${cmd.name}** - ${descripcion} | \`${message.guild.prefix}${cmd.name}\` \n `;136 // }137 // }138 // });139 // const embed = new Discord.MessageEmbed().setDescription(test);140 // await button.reply.send({141 // embed: embed,142 // ephemeral: true143 // });144 // } else if (button.id === "b3") {145 // let test = "";146 // client.commands.forEach((cmd) => {147 // if (cmd.usage) {148 // usage = lang == "en_US" ? cmd.usage[0] : cmd.usage[1];149 // } else {150 // usage = "";151 // }152 // descripcion =153 // lang == "en_US" ? cmd.description[0] : cmd.description[1];154 // if (cmd.category === "Musica") {155 // if (156 // usage &&157 // !cmd.inactive &&158 // !cmd.production &&159 // cmd.role !== "dev"160 // ) {161 // test += `**${message.guild.prefix}${cmd.name}** - ${descripcion} | \`${message.guild.prefix}${cmd.name} ${usage}\` \n `;162 // } else if (163 // !usage &&164 // !cmd.inactive &&165 // !cmd.production &&166 // cmd.role !== "dev"167 // ) {168 // test += `**${message.guild.prefix}${cmd.name}** - ${descripcion} | \`${message.guild.prefix}${cmd.name}\` \n `;169 // }170 // }171 // });172 // const embed = new Discord.MessageEmbed().setDescription(test);173 // await button.reply.send("", {174 // embed: embed,175 // ephemeral: true176 // });177 // } else if (button.id === "b4") {178 // let test = "";179 // client.commands.forEach((cmd) => {180 // if (cmd.usage) {181 // usage = lang == "en_US" ? cmd.usage[0] : cmd.usage[1];182 // } else {183 // usage = "";184 // }185 // descripcion =186 // lang == "en_US" ? cmd.description[0] : cmd.description[1];187 // if (cmd.category === "Utils") {188 // if (189 // usage &&190 // !cmd.inactive &&191 // !cmd.production &&192 // cmd.role !== "dev"193 // ) {194 // test += `**${message.guild.prefix}${cmd.name}** - ${descripcion} | \`${message.guild.prefix}${cmd.name} ${usage}\` \n `;195 // } else if (196 // !usage &&197 // !cmd.inactive &&198 // !cmd.production &&199 // cmd.role !== "dev"200 // ) {201 // test += `**${message.guild.prefix}${cmd.name}** - ${descripcion} | \`${message.guild.prefix}${cmd.name}\` \n `;202 // }203 // }204 // });205 // const embed = new Discord.MessageEmbed().setDescription(test);206 // await button.reply.send("", {207 // embed: embed,208 // ephemeral: true209 // });210 // } else if (button.id === "b5") {211 // let test = "";212 // client.commands.forEach((cmd) => {213 // if (cmd.usage) {214 // if (cmd.usage) {215 // usage = lang == "en_US" ? cmd.usage[0] : cmd.usage[1];216 // }217 // } else {218 // usage = "";219 // }220 // descripcion =221 // lang == "en_US" ? cmd.description[0] : cmd.description[1];222 // if (cmd.category === "Info") {223 // if (224 // usage &&225 // !cmd.inactive &&226 // !cmd.production &&227 // cmd.role !== "dev"228 // ) {229 // test += `**${message.guild.prefix}${cmd.name}** - ${descripcion} | \`${message.guild.prefix}${cmd.name} ${usage}\` \n `;230 // } else if (231 // !usage &&232 // !cmd.inactive &&233 // !cmd.production &&234 // cmd.role !== "dev"235 // ) {236 // test += `**${message.guild.prefix}${cmd.name}** - ${descripcion} | \`${message.guild.prefix}${cmd.name}\` \n `;237 // }238 // }239 // });240 // const embed = new Discord.MessageEmbed().setDescription(test);241 // await button.reply.send("", {242 // embed: embed,243 // ephemeral: true244 // });245 // }246 // } catch (e) {247 // console.error(e);248 // }249 // });250 // encendido = true;251 // } else return;252 // } else {253 const MenusManager = new DiscordMenus(client);254 const myCoolMenu = new MenuBuilder()255 .addLabel(client.language.COMMANDS[18], {256 description: client.language.COMMANDS[20],257 value: "m6",258 emoji: {259 name: "🕵️‍♀️",260 },261 })262 .addLabel(client.language.COMMANDS[1], {263 description: client.language.COMMANDS[13],264 value: "m1",265 emoji: {266 name: "🔒",267 },268 })269 .addLabel(client.language.COMMANDS[2], {270 description: client.language.COMMANDS[14],271 value: "m2",272 emoji: {273 name: "🎮",274 },275 })276 .addLabel(client.language.COMMANDS[19], {277 description: client.language.COMMANDS[21],278 value: "m7",279 emoji: {280 name: "🎭",281 },282 })283 .addLabel(client.language.COMMANDS[3], {284 description: client.language.COMMANDS[15],285 value: "m3",286 emoji: {287 name: "🎶",288 },289 })290 .addLabel(client.language.COMMANDS[4], {291 description: client.language.COMMANDS[16],292 value: "m4",293 emoji: {294 name: "🌐",295 },296 })297 .addLabel(client.language.COMMANDS[5], {298 description: client.language.COMMANDS[17],299 value: "m5",300 emoji: {301 name: "🛠️",302 },303 })304 .setMaxValues(1)305 .setCustomID("menucommands")306 .setPlaceHolder(client.language.COMMANDS[12]);307 const embed = new Discord.MessageEmbed()308 .setColor(process.env.EMBED_COLOR)309 .setDescription(310 `<a:828830816486293608:836296002893381682> ${client.language.COMMANDS[6]} \`${message.guild.prefix}help <${client.language.COMMANDS[7]}>\` ${client.language.COMMANDS[8]}.`311 )312 .addField(client.language.COMMANDS[9], client.language.COMMANDS[10])313 .setFooter(314 client.language.oldDiscord,315 message.author.avatarURL({316 dynamic: true,317 })318 )319 .setThumbnail(320 message.author.avatarURL({321 dynamic: true,322 })323 )324 .setTitle(`✨ - ${client.language.COMMANDS[11]}`);325 await MenusManager.sendMenu(message, embed, {326 menu: myCoolMenu,327 });328 if (encendido == false) {329 MenusManager.on("MENU_CLICKED", async (menu) => {330 let lang;331 GuildModel.findOne({guildID: menu.guildID}).then(async (guild, err) => {332 if (err) return333 if (!guild) return334 if (client.users.cache.get(menu.member.id)) {335 lang = await client.users.cache.get(menu.member.id).LANG;336 } else {337 await client.users.fetch(menu.member.id).then(user2 => {338 lang = user2.LANG339 }).catch(e => {340 console.log(e)341 lang = "es_ES";342 })343 }344 if (menu.values[0].toLowerCase() == "m1") {345 try {346 let test = "";347 client.commands.forEach((cmd) => {348 descripcion =349 lang == "en_US" ? cmd.description[0] : cmd.description[1];350 if (cmd.usage) {351 usage = lang == "en_US" ? cmd.usage[0] : cmd.usage[1];352 } else {353 usage = "";354 }355 if (cmd.category.toLowerCase() == "moderacion") {356 if (357 usage &&358 !cmd.inactive &&359 !cmd.production &&360 cmd.role != "dev"361 ) {362 test += ` **${guild.PREFIX}${cmd.name} ** -${descripcion} | \`${guild.PREFIX}${cmd.name} ${usage}\` \n `;363 } else if (364 !usage &&365 !cmd.inactive &&366 !cmd.production &&367 cmd.role != "dev"368 ) {369 test += `**${guild.PREFIX}${cmd.name}** - ${descripcion} | \`${guild.PREFIX}${cmd.name}\` \n `;370 }371 }372 });373 const embed = new Discord.MessageEmbed().setColor(process.env.EMBED_COLOR).setDescription(test);374 await menu.reply(embed, {375 ephemeral: true,376 });377 } catch (error) {378 console.error(error);379 }380 } else if (menu.values[0].toLowerCase() == "m2") {381 try {382 let test = "";383 client.commands.forEach((cmd) => {384 if (cmd.usage) {385 usage = lang == "en_US" ? cmd.usage[0] : cmd.usage[1];386 } else {387 usage = "";388 }389 descripcion =390 lang == "en_US" ? cmd.description[0] : cmd.description[1];391 if (cmd.category.toLowerCase() == "sesiones") {392 if (393 usage &&394 !cmd.inactive &&395 !cmd.production &&396 cmd.role !== "dev"397 ) {398 test += `**${guild.PREFIX}${cmd.name}** - ${descripcion} | \`${guild.PREFIX}${cmd.name} ${usage}\` \n `;399 } else if (400 !usage &&401 !cmd.inactive &&402 !cmd.production &&403 cmd.role !== "dev"404 ) {405 test += `**${guild.PREFIX}${cmd.name}** - ${descripcion} | \`${guild.PREFIX}${cmd.name}\` \n `;406 }407 }408 });409 const embed = new Discord.MessageEmbed().setColor(process.env.EMBED_COLOR).setDescription(test);410 await menu.reply(embed, {411 ephemeral: true,412 });413 } catch (error) {414 console.error(error);415 }416 } else if (menu.values[0].toLowerCase() == "m3") {417 try {418 let test = "";419 client.commands.forEach((cmd) => {420 if (cmd.usage) {421 usage = lang == "en_US" ? cmd.usage[0] : cmd.usage[1];422 } else {423 usage = "";424 }425 descripcion =426 lang == "en_US" ? cmd.description[0] : cmd.description[1];427 if (cmd.category.toLowerCase() == "musica") {428 if (429 usage &&430 !cmd.inactive &&431 !cmd.production &&432 cmd.role !== "dev"433 ) {434 test += `**${guild.PREFIX}${cmd.name}** - ${descripcion} | \`${guild.PREFIX}${cmd.name} ${usage}\` \n `;435 } else if (436 !usage &&437 !cmd.inactive &&438 !cmd.production &&439 cmd.role !== "dev"440 ) {441 test += `**${guild.PREFIX}${cmd.name}** - ${descripcion} | \`${guild.PREFIX}${cmd.name}\` \n `;442 }443 }444 });445 const embed = new Discord.MessageEmbed().setColor(process.env.EMBED_COLOR).setDescription(test);446 await menu.reply(embed, {447 ephemeral: true,448 });449 } catch (error) {450 console.error(error);451 }452 } else if (menu.values[0].toLowerCase() == "m4") {453 try {454 let test = "";455 client.commands.forEach((cmd) => {456 if (cmd.usage) {457 usage = lang == "en_US" ? cmd.usage[0] : cmd.usage[1];458 } else {459 usage = "";460 }461 descripcion =462 lang == "en_US" ? cmd.description[0] : cmd.description[1];463 if (cmd.category.toLowerCase() == "diversion") {464 if (465 usage &&466 !cmd.inactive &&467 !cmd.production &&468 cmd.role !== "dev"469 ) {470 test += `**${guild.PREFIX}${cmd.name}** - ${descripcion} | \`${guild.PREFIX}${cmd.name} ${usage}\` \n `;471 } else if (472 !usage &&473 !cmd.inactive &&474 !cmd.production &&475 cmd.role !== "dev"476 ) {477 test += `**${guild.PREFIX}${cmd.name}** - ${descripcion} | \`${guild.PREFIX}${cmd.name}\` \n `;478 }479 }480 });481 const embed = new Discord.MessageEmbed().setColor(process.env.EMBED_COLOR).setDescription(test);482 await menu.reply(embed, {483 ephemeral: true,484 });485 } catch (error) {486 console.error(error);487 }488 } else if (menu.values[0].toLowerCase() == "m5") {489 try {490 let test = "";491 client.commands.forEach((cmd) => {492 if (cmd.usage) {493 if (cmd.usage) {494 usage = lang == "en_US" ? cmd.usage[0] : cmd.usage[1];495 }496 } else {497 usage = "";498 }499 descripcion =500 lang == "en_US" ? cmd.description[0] : cmd.description[1];501 if (cmd.category.toLowerCase() === "info") {502 if (503 usage &&504 !cmd.inactive &&505 !cmd.production &&506 cmd.role !== "dev"507 ) {508 test += `**${guild.PREFIX}${cmd.name}** - ${descripcion} | \`${guild.PREFIX}${cmd.name} ${usage}\` \n `;509 } else if (510 !usage &&511 !cmd.inactive &&512 !cmd.production &&513 cmd.role !== "dev"514 ) {515 test += `**${guild.PREFIX}${cmd.name}** - ${descripcion} | \`${guild.PREFIX}${cmd.name}\` \n `;516 }517 }518 });519 const embed = new Discord.MessageEmbed().setColor(process.env.EMBED_COLOR).setDescription(test);520 await menu.reply(embed, {521 ephemeral: true,522 });523 } catch (error) {524 console.error(error);525 }526 } else if (menu.values[0].toLowerCase() == "m6") {527 try {528 let test = "";529 client.commands.forEach((cmd) => {530 if (cmd.usage) {531 usage = lang == "en_US" ? cmd.usage[0] : cmd.usage[1];532 } else {533 usage = "";534 }535 descripcion =536 lang == "en_US" ? cmd.description[0] : cmd.description[1];537 if (cmd.category.toLowerCase() == "administracion") {538 if (539 usage &&540 !cmd.inactive &&541 !cmd.production &&542 cmd.role !== "dev"543 ) {544 test += `**${guild.PREFIX}${cmd.name}** - ${descripcion} | \`${guild.PREFIX}${cmd.name} ${usage}\` \n `;545 } else if (546 !usage &&547 !cmd.inactive &&548 !cmd.production &&549 cmd.role !== "dev"550 ) {551 test += `**${guild.PREFIX}${cmd.name}** - ${descripcion} | \`${guild.PREFIX}${cmd.name}\` \n `;552 }553 }554 });555 const embed = new Discord.MessageEmbed().setColor(process.env.EMBED_COLOR).setDescription(test);556 await menu.reply(embed, {557 ephemeral: true,558 });559 } catch (error) {560 console.error(error);561 }562 } else if (menu.values[0].toLowerCase() == "m7") {563 try {564 let test = "";565 client.commands.forEach((cmd) => {566 if (cmd.usage) {567 usage = lang == "en_US" ? cmd.usage[0] : cmd.usage[1];568 } else {569 usage = "";570 }571 descripcion =572 lang == "en_US" ? cmd.description[0] : cmd.description[1];573 if (cmd.category.toLowerCase() == "interaccion") {574 if (575 usage &&576 !cmd.inactive &&577 !cmd.production &&578 cmd.role !== "dev"579 ) {580 test += `**${guild.PREFIX}${cmd.name}** - ${descripcion} | \`${guild.PREFIX}${cmd.name} ${usage}\` \n `;581 } else if (582 !usage &&583 !cmd.inactive &&584 !cmd.production &&585 cmd.role !== "dev"586 ) {587 test += `**${guild.PREFIX}${cmd.name}** - ${descripcion} | \`${guild.PREFIX}${cmd.name}\` \n `;588 }589 }590 });591 const embed = new Discord.MessageEmbed().setColor(process.env.EMBED_COLOR).setDescription(test);592 await menu.reply(embed, {593 ephemeral: true,594 });595 } catch (error) {596 console.error(error);597 }598 }599 encendido = true;600 })601 });602 }603 //}604 } catch (e) {605 console.error(e);606 message.channel.send({ embeds: [607 new Discord.MessageEmbed()608 .setColor("RED")609 .setTitle(client.language.ERROREMBED)610 .setDescription(client.language.fatal_error)611 .setFooter(message.author.username, message.author.avatarURL())612 ]});613 webhookClient.send(614 `Ha habido un error en **${message.guild.name} [ID Server: ${message.guild.id}] [ID Usuario: ${message.author.id}] [Owner: ${message.guild.ownerId}]**. Numero de usuarios: **${message.guild.memberCount}**\nMensaje: ${message.content}\n\nError: ${e}\n\n**------------------------------------**`615 );616 try {617 message.author618 .send(619 "Oops... Ha ocurrido un eror con el comando ejecutado. Aunque ya he notificado a mis desarrolladores del problema, ¿te importaría ir a discord.gg/nodebot y dar más información?\n\nMuchísimas gracias rey <a:corazonmulticolor:836295982768586752>"620 )621 .catch(e);622 } catch (e) {}623 }624 }...

Full Screen

Full Screen

cDataUsage.js

Source:cDataUsage.js Github

copy

Full Screen

1Ext.define('Rd.controller.cDataUsage', {2 extend: 'Ext.app.Controller',3 actionIndex: function(pnl){4 var me = this; 5 if (me.populated) {6 return; 7 } 8 pnl.add({9 xtype : 'pnlDataUsage',10 border : false,11 itemId : 'tabDataUsage',12 plain : true,13 timezone_id : me.getTimezone_id()14 }); 15 me.populated = true;16 },17 views: [18 'dataUsage.pnlDataUsage',19 'components.cmbRealm',20 'components.pnlUsageGraph',21 'dataUsage.pnlDataUsageDay',22 'dataUsage.pnlDataUsageWeek',23 'dataUsage.pnlDataUsageMonth',24 'dataUsage.pnlDataUsageGraph',25 'dataUsage.pnlDataUsageUserDetail',26 //Add ON27 'dataUsage.pnlDataUsageClients',28 'dataUsage.pnlDataUsageClientsDay',29 'dataUsage.pnlDataUsageClientsWeek',30 'dataUsage.pnlDataUsageClientsMonth',31 'dataUsage.pnlDataUsageClientDetail'32 ],33 stores: [],34 models: ['mRealm','mUserStat'],35 selectedRecord: null,36 config: {37 urlUsageForRealm : '/cake3/rd_cake/data-usages/usage_for_realm.json',38 urlClientUsageForRealm : '/cake3/rd_cake/data-usages/client_usage_for_realm.json',39 username : false,40 type : 'realm', //default is realm41 mac : false,42 dateday : false,43 timezone_id : 316, //Default44 timezone_id_clients : 316 //Default45 },46 refs: [47 { ref: 'pnlDataUsageDay', selector: 'pnlDataUsageDay'},48 { ref: 'pnlDataUsageWeek', selector: 'pnlDataUsageWeek'},49 { ref: 'pnlDataUsageMonth', selector: 'pnlDataUsageMonth'},50 { ref: 'pnlDataUsage', selector: 'pnlDataUsage'},51 { ref: 'cntBanner', selector: '#cntBanner'},52 //Add ON53 { ref: 'pnlDataUsageClientsDay', selector: 'pnlDataUsageClientsDay'},54 { ref: 'pnlDataUsageClientsWeek', selector: 'pnlDataUsageClientsWeek'},55 { ref: 'pnlDataUsageClientsMonth', selector: 'pnlDataUsageClientsMonth'},56 { ref: 'pnlDataUsageClients', selector: 'pnlDataUsageClients'},57 { ref: 'cntBannerClients', selector: '#cntBannerClients'}, 58 ],59 init: function() {60 var me = this;61 if (me.inited) {62 return;63 }64 me.inited = true;65 /*66 //---FOR LATER--67 Ext.define('Ext.chart.theme.Custom', {68 extend: 'Ext.chart.theme.Base',69 singleton: true,70 alias: 'chart.theme.custom',71 config: {72 baseColor: '#adc2eb'73 }74 });75 //----76 */77 var dd = me.application.getDashboardData();78 me.setTimezone_id(dd.user.timezone_id);79 me.setTimezone_id_clients(dd.user.timezone_id);80 81 me.control({82 'pnlDataUsage' : {83 afterlayout : me.resizeSegments84 },85 '#tabDataUsage' : {86 destroy : me.appClose 87 },88 //Users89 'pnlDataUsage cmbRealm' : {90 change : me.realmChange,91 afterrender : me.afterRenderEventRealm 92 },93 'pnlDataUsage datefield' : {94 change : me.dateChange 95 },96 'pnlDataUsage #reload' : {97 click : me.reload 98 },99 'pnlDataUsage #btnShowRealm' : {100 click : me.btnShowRealmClick101 },102 'pnlDataUsage grid' : {103 rowclick : me.rowClickEvent104 },105 'pnlDataUsage #btnSeeMore' : {106 click : me.openActivityViewer107 },108 'pnlDataUsage cmbTimezones' : {109 change : me.tzChange110 },111 112 //ADD ON - RADIUS Clients113 'pnlDataUsageClients' : {114 afterlayout : me.resizeClientsSegments115 },116 'pnlDataUsageClients cmbRealm' : {117 change : me.realmClientChange,118 afterrender : me.afterRenderEventRealm 119 },120 'pnlDataUsageClients datefield' : {121 change : me.dateClientChange 122 }, 123 'pnlDataUsageClients #reload' : {124 click : me.reloadClients 125 },126 'pnlDataUsageClients #btnShowRealm' : {127 click : me.btnClientsShowRealmClick128 },129 'pnlDataUsageClients grid' : {130 rowclick : me.rowClientsClickEvent131 },132 'pnlDataUsageClients #btnSeeMore' : {133 click : me.openActivityViewer134 },135 'pnlDataUsageClients cmbTimezones' : {136 change : me.tzClientChange137 }138 139 });140 },141 appClose: function(){142 var me = this;143 me.populated = false;144 },145 reload: function(){146 var me = this;147 me.fetchDataUsage();148 },149 realmChange: function(cmb){150 var me = this;151 me.setType('realm')152 me.setUsername(cmb.getValue())153 me.fetchDataUsage();154 },155 dateChange: function(dt){156 var me = this;157 //console.log(dt.getRawValue());158 me.fetchDataUsage();159 },160 afterRenderEventRealm: function(cmb){161 var me = this;162 var dd = me.application.getDashboardData();163 var rn = dd.data_usage.realm_name;164 var r_id = dd.data_usage.realm_id;165 var rec = Ext.create('Rd.model.mRealm', {name: rn, id: r_id});166 cmb.getStore().loadData([rec],false);167 cmb.setValue(r_id);168 },169 tzChange: function(cmb){170 var me = this;171 me.setTimezone_id(cmb.getValue())172 me.fetchDataUsage();173 },174 fetchDataUsage: function(){175 var me = this; 176 me.getPnlDataUsage().setLoading(true);177 var day = me.getPnlDataUsage().down('#dtDate').getRawValue();178 me.setDateday(day);179 Ext.Ajax.request({180 url: me.getUrlUsageForRealm(),181 params: {182 type : me.getType(),183 username: me.getUsername(),184 day : day,185 mac : me.getMac(),186 timezone_id : me.getTimezone_id()187 },188 method: 'GET',189 success: function(response){190 var jsonData = Ext.JSON.decode(response.responseText);191 me.getPnlDataUsage().setLoading(false);192 193 if(jsonData.success){ 194 me.paintDataUsage(jsonData.data);195 if(me.getType()=='user'){196 me.fetchDevicesForUser();197 }198 }else{199 200 }201 }202 });203 },204 fetchDevicesForUser: function(){205 var me = this;206 Ext.data.StoreManager.lookup('dayMacStore').getProxy().setExtraParams({'username':me.getUsername(),'day':me.getDateday(),'span': 'day','type':'user'});207 Ext.data.StoreManager.lookup('dayMacStore').reload();208 209 Ext.data.StoreManager.lookup('weekMacStore').getProxy().setExtraParams({'username':me.getUsername(),'day':me.getDateday(),'span': 'week','type':'user'});210 Ext.data.StoreManager.lookup('weekMacStore').reload();211 212 Ext.data.StoreManager.lookup('monthMacStore').getProxy().setExtraParams({'username':me.getUsername(),'day':me.getDateday(),'span': 'month','type':'user'});213 Ext.data.StoreManager.lookup('monthMacStore').reload();214 },215 paintDataUsage: function(data){216 var me = this; 217 var totalDay = me.getPnlDataUsageDay().down('#dailyTotal');218 var totalWeek = me.getPnlDataUsageWeek().down('#weeklyTotal');219 var totalMonth = me.getPnlDataUsageMonth().down('#monthlyTotal');220 var cntBanner = me.getCntBanner();221 222 cntBanner.setData(data.query_info);223 224 data.daily.totals.data_in = Ext.ux.bytesToHuman(data.daily.totals.data_in);225 data.daily.totals.data_out = Ext.ux.bytesToHuman(data.daily.totals.data_out);226 data.daily.totals.data_total = Ext.ux.bytesToHuman(data.daily.totals.data_total);227 228 totalDay.setData(data.daily.totals);229 230 data.weekly.totals.data_in = Ext.ux.bytesToHuman(data.weekly.totals.data_in);231 data.weekly.totals.data_out = Ext.ux.bytesToHuman(data.weekly.totals.data_out);232 data.weekly.totals.data_total = Ext.ux.bytesToHuman(data.weekly.totals.data_total);233 234 totalWeek.setData(data.weekly.totals);235 236 data.monthly.totals.data_in = Ext.ux.bytesToHuman(data.monthly.totals.data_in);237 data.monthly.totals.data_out = Ext.ux.bytesToHuman(data.monthly.totals.data_out);238 data.monthly.totals.data_total = Ext.ux.bytesToHuman(data.monthly.totals.data_total);239 240 totalMonth.setData(data.monthly.totals);241 242 Ext.data.StoreManager.lookup('dayStore').setData(data.daily.top_ten);243 Ext.data.StoreManager.lookup('activeStore').setData(data.daily.active_sessions);244 Ext.data.StoreManager.lookup('weekStore').setData(data.weekly.top_ten); 245 Ext.data.StoreManager.lookup('monthStore').setData(data.monthly.top_ten); 246 247 me.getPnlDataUsageDay().down('cartesian').getStore().setData(data.daily.graph.items);248 me.getPnlDataUsageWeek().down('cartesian').getStore().setData(data.weekly.graph.items);249 me.getPnlDataUsageMonth().down('cartesian').getStore().setData(data.monthly.graph.items); 250 251 252 //if user; update the devicesStores253 if(data.query_info.type == 'user'){254 //Ext.data.StoreManager.lookup('dayMacStore').setData(data.daily.user_devices);255 //Ext.data.StoreManager.lookup('weekMacStore').setData(data.weekly.user_devices);256 //Ext.data.StoreManager.lookup('monthMacStore').setData(data.monthly.user_devices); 257 }258 259 if(data.user_detail != undefined){260 me.paintUserDetail(data.user_detail); 261 }else{262 me.hideUserDetail(); 263 }264 me.handleDevicesDisplay(data);265 },266 paintUserDetail: function(user_detail){267 var me = this; 268 me.getPnlDataUsageDay().down('pnlDataUsageUserDetail').paintUserDetail(user_detail);269 me.getPnlDataUsageDay().down('#plrDaily').hide();270 me.getPnlDataUsageDay().down('pnlDataUsageUserDetail').show();271 272 me.getPnlDataUsageWeek().down('pnlDataUsageUserDetail').paintUserDetail(user_detail);273 me.getPnlDataUsageWeek().down('#plrWeekly').hide();274 me.getPnlDataUsageWeek().down('pnlDataUsageUserDetail').show();275 276 me.getPnlDataUsageMonth().down('pnlDataUsageUserDetail').paintUserDetail(user_detail);277 me.getPnlDataUsageMonth().down('#plrMonthly').hide();278 me.getPnlDataUsageMonth().down('pnlDataUsageUserDetail').show();279 280 },281 handleDevicesDisplay: function(data){282 var me = this;283 //==REALMS==284 //We're not showing active connections in historical data for realms285 if((data.query_info.type == 'realm')&&286 (data.query_info.historical == true)287 ){288 me.getPnlDataUsageDay().down('#gridActive').hide();289 }290 291 if((data.query_info.type == 'realm')&&292 (data.query_info.historical == false)293 ){294 me.getPnlDataUsageDay().down('#gridActive').show();295 }296 297 if(data.query_info.type == 'realm'){298 me.getPnlDataUsageDay().down('#gridMacs').hide();299 me.getPnlDataUsageWeek().down('#gridMacs').hide();300 me.getPnlDataUsageMonth().down('#gridMacs').hide();301 }302 303 if(data.query_info.type == 'user'){304 me.getPnlDataUsageDay().down('#gridActive').hide(); //Hide this regardless when looking at user305 me.getPnlDataUsageDay().down('#gridMacs').show();306 me.getPnlDataUsageWeek().down('#gridMacs').show();307 me.getPnlDataUsageMonth().down('#gridMacs').show();308 } 309 310 },311 hideUserDetail: function(){312 var me = this; 313 me.getPnlDataUsageDay().down('#plrDaily').show();314 me.getPnlDataUsageDay().down('pnlDataUsageUserDetail').hide();315 316 me.getPnlDataUsageWeek().down('#plrWeekly').show();317 me.getPnlDataUsageWeek().down('pnlDataUsageUserDetail').hide();318 319 me.getPnlDataUsageMonth().down('#plrMonthly').show();320 me.getPnlDataUsageMonth().down('pnlDataUsageUserDetail').hide();321 322 },323 rowClickEvent: function(grid,record){324 var me = this;325 if(record.get('type') == 'device'){326 me.setType('device');327 me.setMac(record.get('mac'));328 me.getPnlDataUsage().down('#cntBanner').setStyle('background','#c2c2a3');329 }else{ 330 me.setType('user');331 me.setMac(false);332 me.getPnlDataUsage().down('#cntBanner').setStyle('background','#00cccc'); 333 } 334 var username = record.get('username'); 335 me.getPnlDataUsage().down('#btnShowRealm').show();336 me.getPnlDataUsage().down('cmbRealm').setDisabled(true);337 me.setUsername(username); 338 me.fetchDataUsage(); 339 },340 btnShowRealmClick: function(btn){341 var me = this;342 if(me.getType()=='device'){ //Back one = user (username us still suppose to be set)343 me.setType('user');344 me.setMac(false); 345 me.getPnlDataUsage().down('#cntBanner').setStyle('background','#00cccc'); 346 }else{347 me.getPnlDataUsage().down('cmbRealm').setDisabled(false);348 btn.hide();349 me.setUsername(me.getPnlDataUsage().down('cmbRealm').getValue());350 me.setType('realm'); 351 me.getPnlDataUsage().down('#cntBanner').setStyle('background','#adc2eb');352 }353 me.fetchDataUsage(); 354 },355 resizeSegments: function(pnl){356 var me = this;357 if(pnl.getHeight() > 400){358 me.getPnlDataUsageDay().setHeight((pnl.getHeight()-40-50));359 me.getPnlDataUsageWeek().setHeight((pnl.getHeight()-40-50));360 me.getPnlDataUsageMonth().setHeight((pnl.getHeight()-40-50));361 }362 },363 openActivityViewer: function(btn){364 var me = this;365 var pnl = me.getPnlDataUsage();366 me.application.runAction('cActivityMonitor','Index',pnl); 367 },368 //Add ON369 resizeClientsSegments: function(pnl){370 var me = this;371 if(pnl.getHeight() > 400){372 me.getPnlDataUsageClientsDay().setHeight((pnl.getHeight()-40-50));373 me.getPnlDataUsageClientsWeek().setHeight((pnl.getHeight()-40-50));374 me.getPnlDataUsageClientsMonth().setHeight((pnl.getHeight()-40-50));375 }376 },377 reloadClients: function(){378 var me = this;379 me.fetchDataClientsUsage();380 },381 btnClientsShowRealmClick: function(btn){382 var me = this;383 me.getPnlDataUsageClients().down('cmbRealm').setDisabled(false);384 btn.hide();385 me.setUsername(me.getPnlDataUsageClients().down('cmbRealm').getValue());386 me.setType('realm'); 387 me.fetchDataClientsUsage();388 me.getPnlDataUsageClients().down('#cntBannerClients').setStyle('background','#adc2eb'); 389 },390 fetchDataClientsUsage: function(){391 var me = this;392 me.getPnlDataUsageClients().setLoading(true);393 var day = me.getPnlDataUsageClients().down('#dtDate').getRawValue();394 Ext.Ajax.request({395 url: me.getUrlClientUsageForRealm(),396 params: {397 type : me.getType(),398 username: me.getUsername(),399 day : day,400 timezone_id : me.getTimezone_id_clients()401 },402 method: 'GET',403 success: function(response){404 var jsonData = Ext.JSON.decode(response.responseText);405 me.getPnlDataUsageClients().setLoading(false);406 me.paintDataClientUsage(jsonData.data);407 }408 });409 },410 realmClientChange: function(cmb){411 var me = this;412 me.setType('realm')413 me.setUsername(cmb.getValue())414 me.fetchDataClientsUsage();415 },416 dateClientChange: function(dt){417 var me = this;418 me.fetchDataClientsUsage();419 },420 tzClientChange: function(cmb){421 var me = this;422 me.setTimezone_id_clients(cmb.getValue())423 me.fetchDataClientsUsage();424 },425 paintDataClientUsage: function(data){426 var me = this; 427 var totalDay = me.getPnlDataUsageClientsDay().down('#dailyTotal');428 var totalWeek = me.getPnlDataUsageClientsWeek().down('#weeklyTotal');429 var totalMonth = me.getPnlDataUsageClientsMonth().down('#monthlyTotal');430 var cntBanner = me.getCntBannerClients();431 432 cntBanner.setData(data.query_info);433 434 data.daily.totals.data_in = Ext.ux.bytesToHuman(data.daily.totals.data_in);435 data.daily.totals.data_out = Ext.ux.bytesToHuman(data.daily.totals.data_out);436 data.daily.totals.data_total = Ext.ux.bytesToHuman(data.daily.totals.data_total);437 438 totalDay.setData(data.daily.totals);439 440 data.weekly.totals.data_in = Ext.ux.bytesToHuman(data.weekly.totals.data_in);441 data.weekly.totals.data_out = Ext.ux.bytesToHuman(data.weekly.totals.data_out);442 data.weekly.totals.data_total = Ext.ux.bytesToHuman(data.weekly.totals.data_total);443 444 totalWeek.setData(data.weekly.totals);445 446 data.monthly.totals.data_in = Ext.ux.bytesToHuman(data.monthly.totals.data_in);447 data.monthly.totals.data_out = Ext.ux.bytesToHuman(data.monthly.totals.data_out);448 data.monthly.totals.data_total = Ext.ux.bytesToHuman(data.monthly.totals.data_total);449 450 totalMonth.setData(data.monthly.totals);451 452 Ext.data.StoreManager.lookup('dayClientsStore').setData(data.daily.top);453 Ext.data.StoreManager.lookup('activeStore').setData(data.daily.active_sessions);454 me.getPnlDataUsageClientsDay().down('cartesian').getStore().setData(data.daily.graph.items);455 456 Ext.data.StoreManager.lookup('weekClientsStore').setData(data.weekly.top);457 me.getPnlDataUsageClientsWeek().down('cartesian').getStore().setData(data.weekly.graph.items);458 459 Ext.data.StoreManager.lookup('monthClientsStore').setData(data.monthly.top);460 me.getPnlDataUsageClientsMonth().down('cartesian').getStore().setData(data.monthly.graph.items);461 462 if(data.client_detail != undefined){463 me.paintClientsDetail(data.client_detail); 464 }else{465 me.hideClientsDetail(); 466 } 467 },468 rowClientsClickEvent: function(grid,record){ 469 var me = this;470 var nasid = record.get('nasid');471 me.getPnlDataUsageClients().down('#btnShowRealm').show();472 me.getPnlDataUsageClients().down('cmbRealm').setDisabled(true);473 me.getPnlDataUsageClients().down('#cntBannerClients').setStyle('background','#00cccc');474 me.setUsername(nasid);475 me.setType('nas_id'); 476 me.fetchDataClientsUsage();477 },478 paintClientsDetail: function(client_detail){479 var me = this; 480 me.getPnlDataUsageClientsDay().down('pnlDataUsageClientDetail').paintClientDetail(client_detail);481 me.getPnlDataUsageClientsDay().down('#plrDaily').hide();482 me.getPnlDataUsageClientsDay().down('pnlDataUsageClientDetail').show();483 484 me.getPnlDataUsageClientsWeek().down('pnlDataUsageClientDetail').paintClientDetail(client_detail);485 me.getPnlDataUsageClientsWeek().down('#plrWeekly').hide();486 me.getPnlDataUsageClientsWeek().down('pnlDataUsageClientDetail').show();487 488 me.getPnlDataUsageClientsMonth().down('pnlDataUsageClientDetail').paintClientDetail(client_detail);489 me.getPnlDataUsageClientsMonth().down('#plrMonthly').hide();490 me.getPnlDataUsageClientsMonth().down('pnlDataUsageClientDetail').show();491 492 },493 hideClientsDetail: function(){494 var me = this; 495 me.getPnlDataUsageClientsDay().down('#plrDaily').show();496 me.getPnlDataUsageClientsDay().down('pnlDataUsageClientDetail').hide();497 498 me.getPnlDataUsageClientsWeek().down('#plrWeekly').show();499 me.getPnlDataUsageClientsWeek().down('pnlDataUsageClientDetail').hide();500 501 me.getPnlDataUsageClientsMonth().down('#plrMonthly').show();502 me.getPnlDataUsageClientsMonth().down('pnlDataUsageClientDetail').hide();503 504 }...

Full Screen

Full Screen

usage.js

Source:usage.js Github

copy

Full Screen

...3var test = require('tap').test;4test('usageFail', function (t) {5 var r = checkUsage(function () {6 return optimist('-x 10 -z 20'.split(' '))7 .usage('Usage: $0 -x NUM -y NUM')8 .demand(['x','y'])9 .argv;10 });11 t.same(12 r.result,13 { x : 10, z : 20, _ : [], $0 : './usage' }14 );15 t.same(16 r.errors.join('\n').split(/\n+/),17 [18 'Usage: ./usage -x NUM -y NUM',19 'Options:',20 ' -x [required]',21 ' -y [required]',22 'Missing required arguments: y',23 ]24 );25 t.same(r.logs, []);26 t.ok(r.exit);27 t.end();28});29test('usagePass', function (t) {30 var r = checkUsage(function () {31 return optimist('-x 10 -y 20'.split(' '))32 .usage('Usage: $0 -x NUM -y NUM')33 .demand(['x','y'])34 .argv;35 });36 t.same(r, {37 result : { x : 10, y : 20, _ : [], $0 : './usage' },38 errors : [],39 logs : [],40 exit : false,41 });42 t.end();43});44test('checkPass', function (t) {45 var r = checkUsage(function () {46 return optimist('-x 10 -y 20'.split(' '))47 .usage('Usage: $0 -x NUM -y NUM')48 .check(function (argv) {49 if (!('x' in argv)) throw 'You forgot about -x';50 if (!('y' in argv)) throw 'You forgot about -y';51 })52 .argv;53 });54 t.same(r, {55 result : { x : 10, y : 20, _ : [], $0 : './usage' },56 errors : [],57 logs : [],58 exit : false,59 });60 t.end();61});62test('checkFail', function (t) {63 var r = checkUsage(function () {64 return optimist('-x 10 -z 20'.split(' '))65 .usage('Usage: $0 -x NUM -y NUM')66 .check(function (argv) {67 if (!('x' in argv)) throw 'You forgot about -x';68 if (!('y' in argv)) throw 'You forgot about -y';69 })70 .argv;71 });72 t.same(73 r.result,74 { x : 10, z : 20, _ : [], $0 : './usage' }75 );76 t.same(77 r.errors.join('\n').split(/\n+/),78 [79 'Usage: ./usage -x NUM -y NUM',80 'You forgot about -y'81 ]82 );83 t.same(r.logs, []);84 t.ok(r.exit);85 t.end();86});87test('checkCondPass', function (t) {88 function checker (argv) {89 return 'x' in argv && 'y' in argv;90 }91 var r = checkUsage(function () {92 return optimist('-x 10 -y 20'.split(' '))93 .usage('Usage: $0 -x NUM -y NUM')94 .check(checker)95 .argv;96 });97 t.same(r, {98 result : { x : 10, y : 20, _ : [], $0 : './usage' },99 errors : [],100 logs : [],101 exit : false,102 });103 t.end();104});105test('checkCondFail', function (t) {106 function checker (argv) {107 return 'x' in argv && 'y' in argv;108 }109 var r = checkUsage(function () {110 return optimist('-x 10 -z 20'.split(' '))111 .usage('Usage: $0 -x NUM -y NUM')112 .check(checker)113 .argv;114 });115 t.same(116 r.result,117 { x : 10, z : 20, _ : [], $0 : './usage' }118 );119 t.same(120 r.errors.join('\n').split(/\n+/).join('\n'),121 'Usage: ./usage -x NUM -y NUM\n'122 + 'Argument check failed: ' + checker.toString()123 );124 t.same(r.logs, []);125 t.ok(r.exit);126 t.end();127});128test('countPass', function (t) {129 var r = checkUsage(function () {130 return optimist('1 2 3 --moo'.split(' '))131 .usage('Usage: $0 [x] [y] [z] {OPTIONS}')132 .demand(3)133 .argv;134 });135 t.same(r, {136 result : { _ : [ '1', '2', '3' ], moo : true, $0 : './usage' },137 errors : [],138 logs : [],139 exit : false,140 });141 t.end();142});143test('countFail', function (t) {144 var r = checkUsage(function () {145 return optimist('1 2 --moo'.split(' '))146 .usage('Usage: $0 [x] [y] [z] {OPTIONS}')147 .demand(3)148 .argv;149 });150 t.same(151 r.result,152 { _ : [ '1', '2' ], moo : true, $0 : './usage' }153 );154 t.same(155 r.errors.join('\n').split(/\n+/),156 [157 'Usage: ./usage [x] [y] [z] {OPTIONS}',158 'Not enough non-option arguments: got 2, need at least 3',159 ]160 );...

Full Screen

Full Screen

core-moderation.js

Source:core-moderation.js Github

copy

Full Screen

1$.lang.register('moderation.usage', 'Usage: !moderation [links / caps / spam / blacklist / whitelist / cleanup / logs / togglecbenni]');2$.lang.register('moderation.links.usage', 'Usage: !moderation links [toggle / permittime]');3$.lang.register('moderation.links.toggle', 'Link moderation has been $1.');4$.lang.register('moderation.links.permit.time.usage', 'Usage: !moderation links permittime [seconds]');5$.lang.register('moderation.links.permit.time.set', 'Permit time has been set to $1 seconds!');6$.lang.register('moderation.caps.usage', 'Usage: !moderation caps [toggle / triggerlength / limitpercent]');7$.lang.register('moderation.caps.toggle', 'Cap moderation has been $1.');8$.lang.register('moderation.caps.trigger.usage', 'Usage: !moderation caps triggerlength [characters]');9$.lang.register('moderation.caps.trigger.set', 'Caps trigger limit has been set to $1%');10$.lang.register('moderation.caps.limit.usage', 'Usage: !moderation caps limitpercent [percent]');11$.lang.register('moderation.caps.limit.set', 'Caps limit has been set to $1%');12$.lang.register('moderation.long.message.usage', 'Usage: !moderation longmessage [toggle / limit]');13$.lang.register('moderation.long.message.toggle', 'Message length moderation has been $1.');14$.lang.register('moderation.long.message.limit.usage', 'Usage: !moderation longmessage limit [characters]');15$.lang.register('moderation.long.message.limit.set', 'Long message limit has been set to $1 characters!');16$.lang.register('moderation.spam.usage', 'Usage: !moderation spam [toggle / limit]');17$.lang.register('moderation.spam.toggle', 'Spam moderation has been $1.');18$.lang.register('moderation.spam.limit.usage', 'Usage: !moderation spam limit [messages]');19$.lang.register('moderation.spam.limit.set', 'Spam limit has been set to $1 messages!');20$.lang.register('moderation.blacklist.usage', 'Usage: !moderation blacklist [add / remove / list]');21$.lang.register('moderation.blacklist.add.usage', 'Usage: !moderation blacklist add [phrase]');22$.lang.register('moderation.blacklist.add.success', 'Phrase added the to the blacklist!');23$.lang.register('moderation.blacklist.remove.usage', 'Usage: !moderation blacklist remove [phrase]');24$.lang.register('moderation.blacklist.remove.404', 'That phrase is not in the blacklist.');25$.lang.register('moderation.blacklist.remove.success', 'Phrase removed from the blacklist!');26$.lang.register('moderation.blacklist.list.404', 'The blacklist is empty.');27$.lang.register('moderation.blacklist.list', 'Blacklist: ```$1```');28$.lang.register('moderation.whitelist.usage', 'Usage: !moderation whitelist [add / remove / list]');29$.lang.register('moderation.whitelist.add.usage', 'Usage: !moderation whitelist add [phrase or username#discriminator]');30$.lang.register('moderation.whitelist.add.success', 'Phrase or username added the to the whitelist!');31$.lang.register('moderation.whitelist.remove.usage', 'Usage: !moderation whitelist remove [phrase or username#discriminator]');32$.lang.register('moderation.whitelist.remove.404', 'That phrase or username is not in the whitelist.');33$.lang.register('moderation.whitelist.remove.success', 'Phrase or username removed from the whitelist!');34$.lang.register('moderation.whitelist.list.404', 'The whitelist is empty.');35$.lang.register('moderation.whitelist.list', 'Whitelist: ```$1```');36$.lang.register('moderation.cleanup.usage', 'Usage: !moderation cleanup [channel] [amount]');37$.lang.register('moderation.cleanup.err', 'You can only delete 1 to 10000 messages.');38$.lang.register('moderation.cleanup.failed', 'Failed to perform bulk message deletion: Currently deleting messages.');39$.lang.register('moderation.cleanup.failed.err', 'Failed to perform bulk message deletion.');40$.lang.register('moderation.cleanup.done', 'Deleted $1 messages!');41$.lang.register('moderation.logs.toggle.usage', 'Usage: !moderation logs [toggle / channel] - Will toggle Twitch moderation logs being posted in Discord.');42$.lang.register('moderation.logs.toggle', 'Twitch moderation logs have been $1. **[Requires bot restart]**');43$.lang.register('moderation.logs.channel.usage', 'Usage: !moderation logs channel [channel name]');44$.lang.register('moderation.logs.channel.set', 'Twitch moderation log announcements will now be made in channel #$1');...

Full Screen

Full Screen

sensor.py

Source:sensor.py Github

copy

Full Screen

...48 water_usage = self._client.get_water_usage_summary(self._location_id)49 self._today = round(water_usage["today"], 1)50 self._this_month = round(water_usage["thisMonth"], 1)51 self._this_year = round(water_usage["thisYear"], 1)52 def get_daily_usage(self):53 """Return the day's usage."""54 return self._today55 def get_monthly_usage(self):56 """Return the month's usage."""57 return self._this_month58 def get_yearly_usage(self):59 """Return the year's usage."""60 return self._this_year61class StreamLabsDailyUsage(SensorEntity):62 """Monitors the daily water usage."""63 def __init__(self, location_name, streamlabs_usage_data):64 """Initialize the daily water usage device."""65 self._location_name = location_name66 self._streamlabs_usage_data = streamlabs_usage_data67 self._state = None68 @property69 def name(self):70 """Return the name for daily usage."""71 return f"{self._location_name} {NAME_DAILY_USAGE}"72 @property73 def icon(self):74 """Return the daily usage icon."""75 return WATER_ICON76 @property77 def native_value(self):78 """Return the current daily usage."""79 return self._streamlabs_usage_data.get_daily_usage()80 @property81 def native_unit_of_measurement(self):82 """Return gallons as the unit measurement for water."""83 return VOLUME_GALLONS84 def update(self):85 """Retrieve the latest daily usage."""86 self._streamlabs_usage_data.update()87class StreamLabsMonthlyUsage(StreamLabsDailyUsage):88 """Monitors the monthly water usage."""89 @property90 def name(self):91 """Return the name for monthly usage."""92 return f"{self._location_name} {NAME_MONTHLY_USAGE}"93 @property94 def native_value(self):95 """Return the current monthly usage."""96 return self._streamlabs_usage_data.get_monthly_usage()97class StreamLabsYearlyUsage(StreamLabsDailyUsage):98 """Monitors the yearly water usage."""99 @property100 def name(self):101 """Return the name for yearly usage."""102 return f"{self._location_name} {NAME_YEARLY_USAGE}"103 @property104 def native_value(self):105 """Return the current yearly usage."""...

Full Screen

Full Screen

containerUtilization.widget.js

Source:containerUtilization.widget.js Github

copy

Full Screen

1'use strict'2const baseWidget = require('../../src/baseWidget')3class myWidget extends baseWidget() {4 constructor ({ blessed = {}, contrib = {}, screen = {}, grid = {} }) {5 super()6 this.blessed = blessed7 this.contrib = contrib8 this.screen = screen9 this.grid = grid10 this.label = 'Containers Utilization (%)'11 this.widget = this.getWidget()12 }13 init () {14 if (!this.widgetsRepo.has('containers')) {15 return null16 }17 const dockerHook = this.widgetsRepo.get('containers')18 dockerHook.on('containerUtilization', (data) => {19 return this.update(data)20 })21 }22 getWidget () {23 return this.grid.gridObj.set(...this.grid.gridLayout, this.contrib.bar, {24 label: this.label,25 style: this.getWidgetStyle({ fg: 'blue' }),26 border: {27 type: 'line',28 fg: '#00ff00'29 },30 barBgColor: 'cyan',31 barFgColor: 'white',32 barWidth: 6,33 barSpacing: 15,34 xOffset: 3,35 maxHeight: 15,36 labelColor: this.getWidgetStyle().fg37 })38 }39 update (data) {40 if (!data || (typeof data !== 'object')) {41 return42 }43 if (!data.cpu_stats || !data.precpu_stats || !data.cpu_stats.cpu_usage ||44 !data.precpu_stats.cpu_usage || !data.cpu_stats.cpu_usage.total_usage ||45 !data.precpu_stats.cpu_usage.total_usage ||46 !data.cpu_stats.system_cpu_usage || !data.precpu_stats.system_cpu_usage ||47 !data.cpu_stats.cpu_usage.percpu_usage) {48 return this.widget.setData({49 titles: ['CPU', 'Memory'],50 data: [51 0,52 053 ]54 })55 }56 // Calculate CPU usage based on delta from previous measurement57 let cpuUsageDelta = data.cpu_stats.cpu_usage.total_usage - data.precpu_stats.cpu_usage.total_usage58 let systemUsageDelta = data.cpu_stats.system_cpu_usage - data.precpu_stats.system_cpu_usage59 let cpuCoresAvail = data.cpu_stats.cpu_usage.percpu_usage ? data.cpu_stats.cpu_usage.percpu_usage.length : 060 let cpuUsagePercent = 061 if (systemUsageDelta !== 0 || cpuCoresAvail !== 0) {62 let totalUsage = systemUsageDelta * cpuCoresAvail * 10063 cpuUsagePercent = 064 if (totalUsage && totalUsage !== 0) {65 cpuUsagePercent = cpuUsageDelta / totalUsage66 }67 }68 // Calculate Memory usage69 let memUsage = data.memory_stats.usage70 let memAvail = data.memory_stats.limit71 let memUsagePercent = 072 if ((memUsage !== undefined && memAvail !== undefined) && memAvail !== 0) {73 memUsagePercent = memUsage / memAvail * 10074 }75 this.widget.setData({76 titles: ['CPU', 'Memory'],77 data: [78 Math.round(Number(cpuUsagePercent)),79 Math.round(Number(memUsagePercent))80 ]81 })82 this.screen.render()83 }84}...

Full Screen

Full Screen

handlers-gameWispHandler.js

Source:handlers-gameWispHandler.js Github

copy

Full Screen

1$.lang.register('gamewisp.usage', 'Usage: !gamewisp [ $1 ]');2$.lang.register('gamewisp.submessage.usage', 'Usage: !gamewisp submessage [message] (Currently: $1) Tags: (name) (tier) (reward)');3$.lang.register('gamewisp.submessage.success', 'Set GameWisp subscriber message to: $1');4$.lang.register('gamewisp.resubmessage.usage', 'Usage: !gamewisp resubmessage [message] (Currently: $1) Tags: (name) (tier) (reward) (months)');5$.lang.register('gamewisp.resubmessage.success', 'Set GameWisp resubscriber message to: $1');6$.lang.register('gamewisp.tierupmessage.usage', 'Usage: !gamewisp tierupmessage [message] (Currently: $1) Tags: (name) (tier)');7$.lang.register('gamewisp.tierupmessage.success', 'Set GameWisp tier upgrade message to: $1');8$.lang.register('gamewisp.togglemessage.usage', 'Usage: !gamewisp togglemessage [on/off] (Currently: $1)');9$.lang.register('gamewisp.togglemessage.success', 'Set GameWisp sub, resub and tier up message alerts to $1');10$.lang.register('gamewisp.reward.usage', 'Usage: !gamewisp reward [points] (Currently: $1)');11$.lang.register('gamewisp.reward.success', 'Set GameWisp sub reward to $1');12$.lang.register('gamewisp.resubreward.usage', 'Usage: !gamewisp resubreward [points] (Currently: $1)');13$.lang.register('gamewisp.resubreward.success', 'Set GameWisp resub reward to $1');14$.lang.register('gamewisptier.usage', 'Usage: !gamewisptier [ $1 ]');15$.lang.register('gamewisptier.songrequests.usage', 'Usage: !gamewisptier songrequests [tier] [number]');16$.lang.register('gamewisptier.songrequests.usage.tier', 'Usege: !gamewisptier songrequests [tier] [number] (Tier $1 is currently: $2)');17$.lang.register('gamewisptier.songrequests.success', 'Changed GameWisp songrequests for tier $1 from $2 to $3');18$.lang.register('gamewisptier.bonuspoints.usage', 'Usage: !gamewisptier bonuspoints [tier] [number]');19$.lang.register('gamewisptier.bonuspoints.usage.tier', 'Usage: !gamewisptier bonuspoints [tier] [number] (Tier $1 is currently $2)');20$.lang.register('gamewisptier.bonuspoints.success', 'Changed GameWisp bonuspoint percent multiplier for tier $1 from $2 to $3');21$.lang.register('gamewisptier.subbonuspoints.usage', 'Usage: !gamewisptier subbonuspoints [tier] [number]');22$.lang.register('gamewisptier.subbonuspoints.usage.tier', 'Usage: !gamewisptier subbonuspoints [tier] [number] (Tier $1 is currently $2)');...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var istanbul = require('istanbul');2var collector = new istanbul.Collector();3var reporter = new istanbul.Reporter();4var sync = false;5collector.add(__coverage__);6reporter.add('text');7reporter.addAll(['lcov', 'json']);8reporter.write(collector, sync, function () {9 console.log('All reports generated');10});

Full Screen

Using AI Code Generation

copy

Full Screen

1var istanbul = require('istanbul');2var collector = new istanbul.Collector();3var reporter = new istanbul.Reporter();4collector.add(JSON.parse(fs.readFileSync('coverage/coverage.json', 'utf8')));5reporter.addAll([ 'text-summary', 'lcov' ]);6reporter.write(collector, sync, function () {7 console.log('All reports generated');8});

Full Screen

Using AI Code Generation

copy

Full Screen

1var istanbul = require('istanbul');2var collector = new istanbul.Collector();3var reporter = new istanbul.Reporter();4var sync = false;5collector.add(__coverage__);6reporter.add('text');7reporter.addAll(['lcov', 'json', 'text-summary']);8reporter.write(collector, sync, function () {9 console.log('All reports generated');10});11{12 "scripts": {13 },14 "devDependencies": {15 }16}

Full Screen

Using AI Code Generation

copy

Full Screen

1var istanbul = require('istanbul');2var collector = new istanbul.Collector();3var reporter = new istanbul.Reporter();4var sync = false;5collector.add(__coverage__);6reporter.add('text');7reporter.addAll(['lcov', 'json', 'text-summary']);8reporter.write(collector, sync, function () {9 console.log('All reports generated');10});11{12 "scripts": {13 },14 "devDependencies": {15 }16}17Istanbul can be used to generate );18var collector = new istanbul.Collector();19sync = false;20reporter.add('text-summary');21reporter.addAll([ 'lcov', 'json', 'text', 'clovr']);22reporter.write(collector, sync, function () {23 console.log('All reports generated');24});25var = require('istanbul');

Full Screen

Using AI Code Generation

copy

Full Screen

1var istanbul = require('istanbul');2var instrumenter = new istanbul.Instrumenter();3var fs = require('fs');4var code = fs.readFileSync('index.js', 'utf8');5var instrumentedCode = instrumenter.instrumentSync(code, 'index.js');6fs.writeFileSync('instrumented.js', instrumentedCode, 'utf8');7var a = 2;8var b = 3;9var c = a + b;10var a = 2;11var b = 3;12var c = a + b;

Full Screen

Using AI Code Generation

copy

Full Screen

1var istanbul = require('istanbul');2var collector = new istanbul.Collector();3var reporter = new istanbul.Reporter();4var sync = false;5reporter.add('text-summary');6reporter.addAll([ 'lcov', 'json', 'text', 'clover' ]);7reporter.write(collector, sync, function () {8 console.log('All reports generated');9});

Full Screen

Using AI Code Generation

copy

Full Screen

1var istanbul = require('istanbul');2var collector = new istanbul.Collector();3var usage = istanbul.Usage;4var sync = false;5var istanbul = require('istanbul');6var collector = new istanbul.Collector();7var usage = istanbul.Usage;8var sync = false;9var istanbul = require('istanbul');10var collector = new istanbul.Collector();11var usage = istanbul.Usage;12var sync = false;13var istanbul = require('istanbul');14var collector = new istanbul.Collector();15var usage = istanbul.Usage;16var sync = false;17var istanbul = require('istanbul');18var collector = new istanbul.Collector();19var usage = istanbul.Usage;20var sync = false;21var istanbul = require('istanbul');22var collector = new istanbul.Collector();23var usage = istanbul.Usage;24var sync = false;25var istanbul = require('istanbul');26var collector = new istanbul.Collector();27var usage = istanbul.Usage;28var sync = false;29var istanbul = require('istanbul');30var collector = new istanbul.Collector();31var usage = istanbul.Usage;32var sync = false;33var istanbul = require('istanbul');34var collector = new istanbul.Collector();35var usage = istanbul.Usage;36var sync = false;37var istanbul = require('istanbul');38var collector = new istanbul.Collector();39var usage = istanbul.Usage;40var sync = false;

Full Screen

Using AI Code Generation

copy

Full Screen

1var istanbul = require('istanbul');2var coverage = istanbul.Coverage.createCoverageMap({});3var collector = new istanbul.Collector();4collector.add(coverage);5collector.getFinalCoverage();6collector.files();7collector.getFinalCoverage('test.js');8collector.getFinalCoverage('test.js').s;9collector.getFinalCoverage('test.js').s[1];10collector.getFinalCoverage('test.js').s[1] = 3;11collector.getFinalCoverage('test.js').s[1];12var istanbul = require('istanbul');13var coverage = istanbul.Coverage.createCoverageMap({});14var collector = new istanbul.Collector();15collector.add(coverage);16collector.getFinalCoverage();17collector.files();18collector.getFinalCoverage('test.js');19collector.getFinalCoverage('test.js').s;20collector.getFinalCoverage('test.js').s[1];21collector.getFinalCoverage('test.js').s[1] = 3;22collector.getFinalCoverage('test.js').s[1];23var istanbul = require('istanbul');24var coverage = istanbul.Coverage.createCoverageMap({});25var collector = new istanbul.Collector();26collector.add(coverage);27collector.getFinalCoverage();28collector.files();29collector.getFinalCoverage('test.js');30collector.getFinalCoverage('test.js').s;31collector.getFinalCoverage('test.js').s[1];32collector.getFinalCoverage('test.js').s[1] = 3;33collector.getFinalCoverage('test.js').s[1];34var istanbul = require('istanbul');35var coverage = istanbul.Coverage.createCoverageMap({});36var collector = new istanbul.Collector();37collector.add(coverage);38collector.getFinalCoverage();39collector.files();40collector.getFinalCoverage('test.js');41collector.getFinalCoverage('test.js').s;42collector.getFinalCoverage('test.js').s[1];43collector.getFinalCoverage('test.js').s[1] = 3;44collector.getFinalCoverage('test.js').s[1];45var istanbul = require('istanbul');46var coverage = istanbul.Coverage.createCoverageMap({});47var collector = new istanbul.Collector();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run istanbul automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful