diff options
author | 2013-09-07 22:36:23 +0530 | |
---|---|---|
committer | 2013-10-17 19:47:03 +0530 | |
commit | 5e53c1cde810b2ebff201ca33382545c000fe425 (patch) | |
tree | 480c6c5d1fbb5f8541674d6e0f02dcfc83ae3b7d | |
parent | 72431456ff08871363f611d1081b2d3a9fe9a579 (diff) |
Added support filter variables and history items
-rw-r--r-- | share/tools/web_config/partials/history.html | 6 | ||||
-rw-r--r-- | share/tools/web_config/partials/variables.html | 9 | ||||
-rw-r--r-- | share/tools/web_config/webconfig.js | 19 |
3 files changed, 30 insertions, 4 deletions
diff --git a/share/tools/web_config/partials/history.html b/share/tools/web_config/partials/history.html index c7e36fe3..3ffee162 100644 --- a/share/tools/web_config/partials/history.html +++ b/share/tools/web_config/partials/history.html @@ -1,6 +1,10 @@ +<div id="table_filter_container" style="display: block;"> + <input id="table_filter_text_box" class="filter_text_box text_box_transient" placeholder="Filter" ng-model="query"> +</div> + <table id="data_table" style="display: table;" > <tbody> - <tr class="data_table_row" ng-repeat="item in historyItems"> + <tr class="data_table_row" ng-repeat="item in historyItems | filter:query"> <td class="data_table_cell no_overflow" style="text-align: left; padding-right: 30px;">{{ item }}</td> <td class="data_table_cell" style="text-align: right; width: 25px"> <a ng-click="deleteHistoryItem(item)"> diff --git a/share/tools/web_config/partials/variables.html b/share/tools/web_config/partials/variables.html index 206b6751..2b6d5636 100644 --- a/share/tools/web_config/partials/variables.html +++ b/share/tools/web_config/partials/variables.html @@ -1,9 +1,12 @@ +<div id="table_filter_container" style="display: block;"> + <input id="table_filter_text_box" class="filter_text_box text_box_transient" placeholder="Filter" ng-model="query"> +</div> + <table id="data_table" style="display: table;"> <tbody> - <tr class="data_table_row" ng-repeat="variable in variables"> - <td class="data_table_cell no_overflow" style="text-align: left; padding-right: 30px;">{{ variable.name }}</td> + <tr class="data_table_row" ng-repeat="variable in variables | filterVariable:query"> + <td class="data_table_cell no_overflow" style="text-align: right; padding-right: 30px;">{{ variable.name }}</td> <td class="data_table_cell no_overflow" style="text-align: left; padding-right: 30px;">{{ variable.value }}</td> </tr> </tbody> </table> - diff --git a/share/tools/web_config/webconfig.js b/share/tools/web_config/webconfig.js index 7e6a1f24..001e4791 100644 --- a/share/tools/web_config/webconfig.js +++ b/share/tools/web_config/webconfig.js @@ -1,5 +1,22 @@ webconfig = angular.module("webconfig", []); +webconfig.filter("filterVariable", function() { + return function(variables, query) { + var result = [] + if (variables == undefined) return result; + if (query == null) { return variables }; + + for(i=0; i<variables.length; ++i) { + variable = variables[i]; + if (variable.name.indexOf(query) != -1 || variable.value.indexOf(query) != -1) { + result.push(variable); + } + } + + return result; + } +}); + webconfig.config( ["$routeProvider", function($routeProvider) { $routeProvider @@ -155,10 +172,12 @@ webconfig.controller("functionsController", function($scope, $http) { }); webconfig.controller("variablesController", function($scope, $http) { + $scope.query = null; $scope.fetchVariables= function() { $http.get("/variables/").success(function(data, status, headers, config) { $scope.variables = data; })}; + $scope.fetchVariables(); }); |