mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-20 22:27:08 +08:00
Added support filter variables and history items
This commit is contained in:
parent
72431456ff
commit
5e53c1cde8
@ -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)">
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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();
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user