-
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add webui patch to allow filtering via regex
Closes #2028
- Loading branch information
Showing
3 changed files
with
93,562 additions
and
0 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
buildroot-external/patches/occu/0170-WebUI-RegexSearchInDeviceLists.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
--- occu/WebUI/www/webui/webui.js.orig | ||
+++ occu/WebUI/www/webui/webui.js | ||
@@ -7872,26 +7872,21 @@ | ||
}; | ||
|
||
/** | ||
- * Pr�ft, ob der Filter auf einen Text zutrifft | ||
+ * Prüft, ob der Filter auf einen Text zutrifft | ||
**/ | ||
this.match = function(text) | ||
{ | ||
if (false === isSet()) { return true; } | ||
|
||
var patternList = m_value.toLowerCase().split("|"); | ||
- //var patternList = m_value.split("|"); | ||
text = text.toLowerCase(); | ||
- | ||
- for (var i = 0, len = patternList.length; i < len; i++) | ||
- { | ||
- if (0 <= text.indexOf(patternList[i])) { return true; } | ||
- } | ||
- | ||
+ var r = new RegExp(m_value.toLowerCase()); | ||
+ if (r.test(text) === true) {return true; } | ||
return false; | ||
}; | ||
|
||
/** | ||
- * Schlie�t den Filter und ruft dei Callback-Funktion auf | ||
+ * Schließt den Filter und ruft dei Callback-Funktion auf | ||
**/ | ||
this.set = function() | ||
{ | ||
@@ -32410,7 +32405,8 @@ | ||
{ | ||
if (typeof obj['type'] != 'undefined') { | ||
if (obj['type'] === "") { return false; } | ||
- if (obj['type'].toLowerCase().indexOf(this.filType) == -1) { return false; } | ||
+ var r = new RegExp(this.filType); | ||
+ if (r.test(obj['type'].toLowerCase()) === false) {return false; } | ||
} | ||
} | ||
if (this.filDesc !== "") | ||
@@ -32420,7 +32416,8 @@ | ||
{ | ||
//conInfo( "iseFilter: desc="+obj['desc'] ); | ||
if (obj['desc'] === "") { return false; } | ||
- if (obj['desc'].toLowerCase().indexOf(this.filDesc) == -1) { return false; } | ||
+ var r = new RegExp(this.filDesc); | ||
+ if (r.test(obj['desc'].toLowerCase()) === false) {return false; } | ||
} | ||
} | ||
if (this.filName !== "") | ||
@@ -32429,7 +32426,8 @@ | ||
{ | ||
if (obj['name'] === "") { return false; } | ||
var transName = translateString(obj['name']); | ||
- if (transName.toLowerCase().indexOf(this.filName) == -1) { return false; } | ||
+ var r = new RegExp(this.filName); | ||
+ if (r.test(transName.toLowerCase()) === false) {return false; } | ||
} | ||
} | ||
if (this.filSn !== "") | ||
@@ -32437,7 +32435,8 @@ | ||
if (typeof obj['sn'] != 'undefined') | ||
{ | ||
if (obj['sn'] === "") { return false; } | ||
- if (obj['sn'].toLowerCase().indexOf(this.filSn) == -1) { return false; } | ||
+ var r = new RegExp(this.filSn); | ||
+ if (r.test(obj['sn'].toLowerCase()) === false) {return false; } | ||
} | ||
} | ||
if (this.filUnit !== "") | ||
@@ -32445,7 +32444,8 @@ | ||
if (typeof obj['unit'] != 'undefined') | ||
{ | ||
if (obj['unit'] === "") { return false; } | ||
- if (obj['unit'].toLowerCase().indexOf(this.filUnit) == -1) { return false; } | ||
+ var r = new RegExp(this.filUnit); | ||
+ if (r.test(obj['unit'].toLowerCase()) === false) {return false; } | ||
} | ||
} | ||
|
||
@@ -32469,7 +32469,8 @@ | ||
if (this.filChnLink !== "") | ||
{ | ||
if (obj['chn'] === "") { return false; } | ||
- if (obj['chn'].toLowerCase().indexOf(this.filChnLink) == -1) { return false; } | ||
+ var r = new RegExp(this.filChnLink); | ||
+ if (r.test(obj['chn'].toLowerCase()) === false) {return false; } | ||
} | ||
/* | ||
if (this.filVarTypes !== "") |
Oops, something went wrong.