Skip to content

Commit fc14970

Browse files
add ignoreIP on fail2ban menu
1 parent 8c923db commit fc14970

File tree

7 files changed

+157
-67
lines changed

7 files changed

+157
-67
lines changed

app/helper/Util.js

Lines changed: 69 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Ext.define('Helper.Util', {
1818
noValue: t('No'),
1919
activeValue: t('Active'),
2020
inactiveValue: t('Inactive'),
21-
getListFilter: function(combo, name) {
21+
getListFilter: function (combo, name) {
2222
var store,
2323
labelField;
2424
combo = Ext.widget(combo);
@@ -32,7 +32,7 @@ Ext.define('Helper.Util', {
3232
idField: combo.valueField
3333
};
3434
},
35-
formatQueueState: function(value) {
35+
formatQueueState: function (value) {
3636
switch (value) {
3737
case 'ringing':
3838
value = '<span style="color:blue; font-weight: bold; ">' + t('Receiving') + '</span>';
@@ -46,7 +46,7 @@ Ext.define('Helper.Util', {
4646
}
4747
return value;
4848
},
49-
formatQueueAgentState: function(value) {
49+
formatQueueAgentState: function (value) {
5050
switch (value) {
5151
case 'Not in use':
5252
value = '<span style="color:green; font-weight: bold; ">' + t('Waiting') + '</span>';
@@ -66,7 +66,7 @@ Ext.define('Helper.Util', {
6666
}
6767
return value;
6868
},
69-
enableComboRelated: function(combo, comboRelated, valueComboRelated) {
69+
enableComboRelated: function (combo, comboRelated, valueComboRelated) {
7070
var store = comboRelated.store,
7171
nameField = combo.name,
7272
valueCombo = combo.getValue(),
@@ -85,13 +85,13 @@ Ext.define('Helper.Util', {
8585
params: {
8686
filter: Ext.encode(valueFilter)
8787
},
88-
callback: function() {
88+
callback: function () {
8989
comboRelated.setValue(valueComboRelated);
9090
comboRelated.enable();
9191
}
9292
});
9393
},
94-
utf8Encode: function(argString) {
94+
utf8Encode: function (argString) {
9595
if (argString === null || typeof argString === "undefined") {
9696
return "";
9797
}
@@ -124,12 +124,12 @@ Ext.define('Helper.Util', {
124124
}
125125
return utftext;
126126
},
127-
sha1: function(str) {
128-
var rotate_left = function(n, s) {
127+
sha1: function (str) {
128+
var rotate_left = function (n, s) {
129129
var t4 = (n << s) | (n >>> (32 - s));
130130
return t4;
131131
};
132-
var cvt_hex = function(val) {
132+
var cvt_hex = function (val) {
133133
var str = "";
134134
var i;
135135
var v;
@@ -229,35 +229,35 @@ Ext.define('Helper.Util', {
229229
temp = cvt_hex(H0) + cvt_hex(H1) + cvt_hex(H2) + cvt_hex(H3) + cvt_hex(H4);
230230
return temp.toLowerCase();
231231
},
232-
formatBooleanFree: function(value) {
232+
formatBooleanFree: function (value) {
233233
var me = Helper.Util,
234234
color = value == 0 ? 'red' : value == 1 ? 'green' : value == 2 ? 'blue' : value == 3 ? 'orange' : '#FFCC00';
235235
value = value == 0 ? t('Blocked') : value == 1 ? t('Free') : value == 2 ? t('In use') : value == 3 ? t('Calling') : t('Pending');
236236
return '<span style="color:' + color + '">' + value + '</span>';
237237
},
238-
formatBoleto: function(value) {
238+
formatBoleto: function (value) {
239239
var me = Helper.Util,
240240
color = value == 'P' ? me.colorYesValue : me.colorNoValue;
241241
value = value = 'P' ? me.yesValue : me.noValue;
242242
return '<span style="color:' + color + '">' + value + '</span>';
243243
},
244-
formatPackageType: function(value) {
244+
formatPackageType: function (value) {
245245
value = value == 0 ? t('Unlimited calls') : value == 1 ? t('Number free calls') : t('Free seconds');
246246
return value;
247247
},
248-
formatBooleancallback: function(value) {
248+
formatBooleancallback: function (value) {
249249
color = value == 0 ? 'red' : value == 1 ? 'green' : value == 2 ? 'blue' : value == 3 ? 'orange' : value == 4 ? 'black' : '#FFCC00';
250250
value = value == 1 ? t('Active') : value == 2 ? t('Pending') : value == 4 ? t('Not working') : t('Sent');
251251
return '<span style="color:' + color + '">' + value + '</span>';
252252
},
253-
formatPorcente: function(value) {
253+
formatPorcente: function (value) {
254254
return value + '%';
255255
},
256-
formatBillingType: function(value) {
256+
formatBillingType: function (value) {
257257
value = value == 0 ? t('Monthly') : t('Weekly');
258258
return value;
259259
},
260-
formatDidType: function(value) {
260+
formatDidType: function (value) {
261261
switch (value) {
262262
case 0:
263263
value = t('Call to PSTN');
@@ -298,16 +298,16 @@ Ext.define('Helper.Util', {
298298
}
299299
return value;
300300
},
301-
formatLcrtype: function(value) {
301+
formatLcrtype: function (value) {
302302
var me = Helper.Util,
303303
value = value == 1 ? t('LCR According buyer Price') : value == 2 ? t('Load Balancer') : value == 0 ? t('LCR According seller Price') : '';
304304
return value;
305305
},
306-
formatMoneyDecimalWithoutColor: function(value) {
306+
formatMoneyDecimalWithoutColor: function (value) {
307307
var format = Ext.util.Format.numberRenderer('0.000');
308308
return App.user.currency + ' ' + format(value);
309309
},
310-
formatMoneyDecimal: function(value) {
310+
formatMoneyDecimal: function (value) {
311311
var me = Helper.Util,
312312
fnName = t('id') + 'Money',
313313
format = Ext.util.Format.numberRenderer('0.000');
@@ -319,7 +319,7 @@ Ext.define('Helper.Util', {
319319
return '<span style="color:blue;">' + App.user.currency + ' ' + format(value) + '</span>';
320320
}
321321
},
322-
formatMoneyDecimal4: function(value) {
322+
formatMoneyDecimal4: function (value) {
323323
var me = Helper.Util,
324324
fnName = t('id') + 'Money',
325325
format = Ext.util.Format.numberRenderer('0.' + App.user.decimalPrecision);
@@ -331,7 +331,7 @@ Ext.define('Helper.Util', {
331331
return '<span style="color:blue;">' + App.user.currency + ' ' + format(value) + '</span>';
332332
}
333333
},
334-
formatMoneyDecimal2: function(value) {
334+
formatMoneyDecimal2: function (value) {
335335
var me = Helper.Util,
336336
fnName = t('id') + 'Money',
337337
format = Ext.util.Format.numberRenderer('0.00');
@@ -343,12 +343,12 @@ Ext.define('Helper.Util', {
343343
return '<span style="color:blue;">' + App.user.currency + ' ' + format(value) + '</span>';
344344
}
345345
},
346-
formatUserType: function(value) {
346+
formatUserType: function (value) {
347347
var me = Helper.Util,
348348
value = value == 1 ? t('Admin') : value == 2 ? t('Agent') : value == 3 ? t('User') : t('NULL');
349349
return value;
350350
},
351-
formatMoney: function(value) {
351+
formatMoney: function (value) {
352352
var me = Helper.Util,
353353
fnName = 'globalMoney',
354354
format = Ext.isFunction(Ext.util.Format[fnName]) ? Ext.util.Format[fnName] : me[fnName] || Ext.util.Format.usMoney;
@@ -361,21 +361,21 @@ Ext.define('Helper.Util', {
361361
return '<span style="color:blue;">' + format(value) + '</span>';
362362
}
363363
},
364-
formattyyesno: function(value) {
364+
formattyyesno: function (value) {
365365
var me = Helper.Util,
366366
color = value ? me.colorYesValue : me.colorNoValue;
367367
value = value ? me.yesValue : me.noValue;
368368
return '<span style="color:' + color + '">' + value + '</span>';
369369
},
370-
formatCampaignType: function(value) {
370+
formatCampaignType: function (value) {
371371
value = value == 1 ? t('Voice') : t('SMS');
372372
return value;
373373
},
374-
formatDirection: function(value) {
374+
formatDirection: function (value) {
375375
value = value == 1 ? t('Outbound') : value == 2 ? t('Inbound') : t('Outbound & CallerID');
376376
return value;
377377
},
378-
formatHangupCause: function(value) {
378+
formatHangupCause: function (value) {
379379
switch (value) {
380380
case 0:
381381
value = t('Cause not defined');
@@ -500,7 +500,7 @@ Ext.define('Helper.Util', {
500500
}
501501
return value;
502502
},
503-
formatCallType: function(value) {
503+
formatCallType: function (value) {
504504
switch (value) {
505505
case 0:
506506
value = t('Standard');
@@ -535,24 +535,24 @@ Ext.define('Helper.Util', {
535535
}
536536
return value;
537537
},
538-
formatWhatsapp: function(value) {
538+
formatWhatsapp: function (value) {
539539
color = value == 0 ? 'blue' : value == 1 ? 'green' : value == 2 ? 'red' : value == 3 ? 'black' : value == 4 ? 'red' : '#FFCC00';
540540
value = value == 0 ? t('Inactive') : value == 1 ? t('Active') : value == 2 ? t('Blocked') : value == 3 ? t('Wrong identity') : value == 4 ? t('Blocked') : t('Pending');
541541
return '<span style="color:' + color + '">' + value + '</span>';
542542
},
543-
formatBoleto: function(value) {
543+
formatBoleto: function (value) {
544544
var me = Helper.Util,
545545
color = value == 'P' ? me.colorYesValue : me.colorNoValue;
546546
value = value = 'P' ? me.yesValue : me.noValue;
547547
return '<span style="color:' + color + '">' + value + '</span>';
548548
},
549-
formatBooleanActive: function(value) {
549+
formatBooleanActive: function (value) {
550550
var me = Helper.Util,
551551
color = value == 0 ? 'red' : value == 1 ? 'green' : value == 2 ? 'blue' : value == 3 ? 'green' : value == 4 ? 'red' : value == 5 ? 'orange' : '#FFCC00';
552552
value = value == 0 ? t('Inactive') : value == 1 ? t('Active') : value == 2 ? t('Pending') : value == 3 ? t('Sent') : value == 4 ? t('Blocked') : value == 5 ? t('AMD') : t('Pending');
553553
return '<span style="color:' + color + '">' + value + '</span>';
554554
},
555-
formatUserStatus: function(value) {
555+
formatUserStatus: function (value) {
556556
var me = Helper.Util;
557557
switch (value) {
558558
case 0:
@@ -578,22 +578,22 @@ Ext.define('Helper.Util', {
578578
}
579579
return '<span style="color:' + color + '">' + value + '</span>';
580580
},
581-
formatBooleanSms: function(value) {
581+
formatBooleanSms: function (value) {
582582
var me = Helper.Util,
583583
color = value == 0 ? 'red' : value == 1 ? 'green' : value == 2 ? 'blue' : '#FFCC00',
584584
value = value == 0 ? t('Error') : value == 1 ? t('Sent') : value == 2 ? t('Received') : t('Pending');
585585
return '<span style="color:' + color + '">' + value + '</span>';
586586
},
587-
formatBooleanServers: function(value) {
587+
formatBooleanServers: function (value) {
588588
var me = Helper.Util,
589589
color = value == 0 ? 'red' : value == 1 ? 'green' : value == 2 ? '#FFCC00' : '#FFCC00',
590590
value = value == 0 ? t('Inactive') : value == 1 ? t('Active') : value == 2 ? t('OffLine') : value == 3 ? t('Error') : value == 4 ? t('Alert') : t('Pending');
591591
return '<span style="color:' + color + '">' + value + '</span>';
592592
},
593-
formatLanguageImage: function(value) {
593+
formatLanguageImage: function (value) {
594594
return '<img src="resources/images/flags/' + value + '.png" />';
595595
},
596-
formatsecondsToTime: function(secs) {
596+
formatsecondsToTime: function (secs) {
597597
var hr = Math.floor(secs / 3600);
598598
var min = Math.floor((secs - (hr * 3600)) / 60);
599599
var sec = secs - (hr * 3600) - (min * 60);
@@ -609,13 +609,13 @@ Ext.define('Helper.Util', {
609609
sec = sec < 10 ? '0' + sec : sec
610610
return hr + ':' + min + ':' + sec;
611611
},
612-
formatBoleto: function(value) {
612+
formatBoleto: function (value) {
613613
var me = Helper.Util,
614614
color = value == 'P' ? me.colorYesValue : me.colorNoValue;
615615
value = value = 'P' ? me.yesValue : me.noValue;
616616
return '<span style="color:' + color + '">' + value + '</span>';
617617
},
618-
formatDialStatus: function(value) {
618+
formatDialStatus: function (value) {
619619
switch (value) {
620620
case 1:
621621
value = t('Answer');
@@ -650,7 +650,7 @@ Ext.define('Helper.Util', {
650650
}
651651
return value;
652652
},
653-
formatQueueStatus: function(value) {
653+
formatQueueStatus: function (value) {
654654
switch (value) {
655655
case 'inQue':
656656
value = '<span style="color:blue; font-weight: bold; ">' + t('Receiving') + '</span>';
@@ -667,36 +667,56 @@ Ext.define('Helper.Util', {
667667
}
668668
return value;
669669
},
670-
convertErrorsJsonToString: function(json) {
670+
formatFail2banAction: function (value) {
671+
switch (value) {
672+
case 0:
673+
value = t('Temp ban');
674+
break;
675+
case 1:
676+
value = t('Permanent ban');
677+
break;
678+
case 3:
679+
value = t('Unban');
680+
break;
681+
case 4:
682+
value = t('Callback');
683+
break;
684+
case 5:
685+
value = t('IgnoreIP');
686+
break;
687+
}
688+
return value;
689+
},
690+
convertErrorsJsonToString: function (json) {
671691
var errors = '';
672-
if (typeof(json) === 'string') {
692+
if (typeof (json) === 'string') {
673693
return json;
674694
}
675-
Ext.iterate(json, function(field) {
676-
Ext.each(json[field], function(error) {
695+
Ext.iterate(json, function (field) {
696+
Ext.each(json[field], function (error) {
677697
errors += t(error) + '<br>';
678698
});
679699
});
680700
return errors;
681701
},
682-
formatStatusImage: function(value) {
702+
formatStatusImage: function (value) {
683703
if (value.match(/^OK/g)) return '<img src="resources/images/registered.png" /> ' + t(value);
684704
else if (value.match(/^LAGGED/g)) return '<img src="resources/images/Unmonitored.png" /> ' + t(value);
685705
else return '<img src="resources/images/' + value + '.png" /> ' + t(value);
686706
},
687-
formatSipDirection: function(value) {
707+
formatSipDirection: function (value) {
688708
if (value == 'IN') return '<img src="resources/images/in.png" /> ';
689709
else return '<img src="resources/images/out.png" /> ';
690710
},
691-
formatDateTime: function(value) {
711+
formatDateTime: function (value) {
692712
if (Ext.Date.format(value, 'Y') < '2000') return '';
693713
else return value == '0000-00-00 00:00:00' ? '' : Ext.Date.format(value, 'Y-m-d H:i:s')
694714
},
695-
formatTranslate: function(value) {
715+
formatTranslate: function (value) {
696716
return t(value);
697717
}
698718
});
699-
! function(n) {
719+
! function (n) {
700720
"use strict";
701721

702722
function t(n, t) {
@@ -796,7 +816,7 @@ Ext.define('Helper.Util', {
796816
function A(n, t, r) {
797817
return t ? r ? s(t, n) : C(t, n) : r ? m(n) : p(n)
798818
}
799-
"function" == typeof define && define.amd ? define(function() {
819+
"function" == typeof define && define.amd ? define(function () {
800820
return A
801821
}) : "object" == typeof module && module.exports ? module.exports = A : n.md5 = A
802822
}(this);

build/MagnusBilling-current.tar.gz

5.09 KB
Binary file not shown.

0 commit comments

Comments
 (0)