|
284 | 284 | var vfHeader = this.options.valueFilter ? " " + this.msg("audit.dashlet.valuefilteredOn") + " " + this.options.valueFilter : "";
|
285 | 285 | // valid limit parameter values : strictly positive integers. other values are ignored
|
286 | 286 | var validLimit = this.options.limit != "" && !isNaN(this.options.limit) && !((this.options.limit * 1) < 1 );
|
287 |
| - var limitHeader = validLimit ? " ("+ this.options.limit.replace(/0+/,'') + " max)" : ""; // remove leading zeros, if any |
| 287 | + var limitHeader = validLimit ? " ("+ this.options.limit.replace(/^0+/,'') + " max)" : ""; // trim leading zeros, if any |
288 | 288 |
|
289 | 289 | this.titleContainer.innerHTML = this.msg("audit.dashlet.header.default")+ " : " + appHeader + vfHeader + limitHeader;
|
290 | 290 |
|
|
600 | 600 | {
|
601 | 601 | var currentCount = res.results.length;
|
602 | 602 |
|
603 |
| - if(req) |
| 603 | + if(currentCount > 0) |
604 | 604 | {
|
605 |
| - var filterOutput = dashlet.applyRegexFilterOnResponse(req,res); |
606 |
| - res.results = filterOutput.filtered; |
607 |
| - |
608 |
| - if(filterOutput.regexStatus == "valid") |
| 605 | + // show the search box if it was hidden |
| 606 | + Dom.removeClass(dashlet.searchBoxContainer,'shy'); |
| 607 | + Dom.removeClass(dashlet.searchBoxLabelContainer,'shy'); |
| 608 | + |
| 609 | + if(req) |
609 | 610 | {
|
610 |
| - //switch the search background to valid. no need to test with hasClass, YUI dom already does this internally |
611 |
| - Dom.removeClass(dashlet.searchBoxContainer,'invalid-regex'); |
612 |
| - Dom.addClass(dashlet.searchBoxContainer,'valid-regex'); |
| 611 | + var filterOutput = dashlet.applyRegexFilterOnResponse(req,res); |
| 612 | + res.results = filterOutput.filtered; |
| 613 | + |
| 614 | + if(filterOutput.regexStatus == "valid") |
| 615 | + { |
| 616 | + //switch the search background to valid. no need to test with hasClass, YUI dom already does this internally |
| 617 | + Dom.removeClass(dashlet.searchBoxContainer,'invalid-regex'); |
| 618 | + Dom.addClass(dashlet.searchBoxContainer,'valid-regex'); |
| 619 | + |
| 620 | + // update the message containing the number of new (now filtered out) results |
| 621 | + var filteredCount = filterOutput.filtered.length; |
| 622 | + dashlet.searchBoxLabelContainer.innerHTML = dashlet.msg("audit.dashlet.filteredResults", filteredCount, currentCount - filteredCount) +" :"; |
| 623 | + } |
| 624 | + else if(filterOutput.regexStatus == "invalid") |
| 625 | + { |
| 626 | + //switch the search background to invalid |
| 627 | + Dom.removeClass(dashlet.searchBoxContainer,'valid-regex'); |
| 628 | + Dom.addClass(dashlet.searchBoxContainer,'invalid-regex'); |
613 | 629 |
|
614 |
| - // update the message containing the number of new (now filtered out) results |
615 |
| - var filteredCount = filterOutput.filtered.length; |
616 |
| - dashlet.searchBoxLabelContainer.innerHTML = dashlet.msg("audit.dashlet.filteredResults", filteredCount, currentCount - filteredCount) +" :"; |
| 630 | + dashlet.searchBoxLabelContainer.innerHTML = dashlet.msg("audit.dashlet.invalidSearch") +" :"; |
| 631 | + } |
617 | 632 | }
|
618 |
| - else if(filterOutput.regexStatus == "invalid") |
| 633 | + else |
619 | 634 | {
|
620 |
| - //switch the search background to invalid |
| 635 | + //we're back to an empty filter. remove the invalid-regex styling, if present |
| 636 | + Dom.removeClass(dashlet.searchBoxContainer,'invalid-regex'); |
621 | 637 | Dom.removeClass(dashlet.searchBoxContainer,'valid-regex');
|
622 |
| - Dom.addClass(dashlet.searchBoxContainer,'invalid-regex'); |
623 | 638 |
|
624 |
| - dashlet.searchBoxLabelContainer.innerHTML = dashlet.msg("audit.dashlet.invalidSearch") +" :"; |
| 639 | + dashlet.searchBoxLabelContainer.innerHTML = dashlet.msg("audit.dashlet.searchWithinResults", currentCount) +" :"; |
625 | 640 | }
|
626 | 641 | }
|
627 | 642 | else
|
628 | 643 | {
|
629 |
| - //we're back to an empty filter. remove the invalid-regex styling, if present |
630 |
| - Dom.removeClass(dashlet.searchBoxContainer,'invalid-regex'); |
631 |
| - Dom.removeClass(dashlet.searchBoxContainer,'valid-regex'); |
632 |
| - |
633 |
| - dashlet.searchBoxLabelContainer.innerHTML = dashlet.msg("audit.dashlet.searchWithinResults", currentCount) +" :"; |
| 644 | + // don't show the search box if there are no results from the datasource |
| 645 | + Dom.addClass(dashlet.searchBoxContainer,'shy'); |
| 646 | + Dom.addClass(dashlet.searchBoxLabelContainer,'shy'); |
634 | 647 | }
|
635 | 648 |
|
636 | 649 |
|
|
1008 | 1021 | this.options.application = Dom.get(this.configDialog.id + "-application").value;
|
1009 | 1022 | this.options.valueFilter = Dom.get(this.configDialog.id + "-valueFilter").value;
|
1010 | 1023 |
|
1011 |
| - this.options.limit = Dom.get(this.configDialog.id + "-limit").value.replace(/0+/,''); // remove leading zeros, if any |
| 1024 | + this.options.limit = Dom.get(this.configDialog.id + "-limit").value.replace(/^0+/,''); // trim leading zeros, if any |
1012 | 1025 | if(isNaN(this.options.limit) || (this.options.limit * 1) < 1 )
|
1013 | 1026 | this.options.limit = ""; // invalid values (not strictly positive integers ) are dropped
|
1014 | 1027 |
|
1015 |
| - this.options.rowsPerPage = Dom.get(this.configDialog.id + "-rowsPerPage").value.replace(/0+/,''); // remove leading zeros, if any |
| 1028 | + this.options.rowsPerPage = Dom.get(this.configDialog.id + "-rowsPerPage").value.replace(/^0+/,''); // trim leading zeros, if any |
1016 | 1029 | if(isNaN(this.options.rowsPerPage) || (this.options.rowsPerPage * 1) < 1 )
|
1017 | 1030 | this.options.rowsPerPage = this.options.defaultRowsPerPage; // invalid values (not strictly positive integers ) are dropped
|
1018 | 1031 |
|
|
1039 | 1052 | if(isNaN(this.options.limit) || (this.options.limit * 1) < 1 )
|
1040 | 1053 | Dom.get(this.configDialog.id + "-limit").value = "";
|
1041 | 1054 | else
|
1042 |
| - Dom.get(this.configDialog.id + "-limit").value = this.options.limit.replace(/0+/,''); // remove leading zeros, if any |
| 1055 | + Dom.get(this.configDialog.id + "-limit").value = this.options.limit.replace(/^0+/,''); // trim leading zeros, if any |
1043 | 1056 |
|
1044 | 1057 | // invalid values (not strictly positive integers ) are dropped
|
1045 | 1058 | if(isNaN(this.options.rowsPerPage) || (this.options.rowsPerPage * 1) < 1 )
|
1046 | 1059 | Dom.get(this.configDialog.id + "-rowsPerPage").value = this.options.defaultRowsPerPage;
|
1047 | 1060 | else
|
1048 |
| - Dom.get(this.configDialog.id + "-rowsPerPage").value = this.options.rowsPerPage.replace(/0+/,''); // remove leading zeros, if any |
| 1061 | + Dom.get(this.configDialog.id + "-rowsPerPage").value = this.options.rowsPerPage.replace(/^0+/,''); // trim leading zeros, if any |
1049 | 1062 |
|
1050 | 1063 | // additional audit API server side query params
|
1051 | 1064 | Dom.get(this.configDialog.id + "-additionalQueryParams").value = this.options.additionalQueryParams;
|
|
0 commit comments