mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 04:41:14 -03:00
Added support filter variables and history items
This commit is contained in:
@@ -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;" >
|
<table id="data_table" style="display: table;" >
|
||||||
<tbody>
|
<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 no_overflow" style="text-align: left; padding-right: 30px;">{{ item }}</td>
|
||||||
<td class="data_table_cell" style="text-align: right; width: 25px">
|
<td class="data_table_cell" style="text-align: right; width: 25px">
|
||||||
<a ng-click="deleteHistoryItem(item)">
|
<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;">
|
<table id="data_table" style="display: table;">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="data_table_row" ng-repeat="variable in variables">
|
<tr class="data_table_row" ng-repeat="variable in variables | filterVariable:query">
|
||||||
<td class="data_table_cell no_overflow" style="text-align: left; padding-right: 30px;">{{ variable.name }}</td>
|
<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>
|
<td class="data_table_cell no_overflow" style="text-align: left; padding-right: 30px;">{{ variable.value }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,22 @@
|
|||||||
webconfig = angular.module("webconfig", []);
|
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(
|
webconfig.config(
|
||||||
["$routeProvider", function($routeProvider) {
|
["$routeProvider", function($routeProvider) {
|
||||||
$routeProvider
|
$routeProvider
|
||||||
@@ -155,10 +172,12 @@ webconfig.controller("functionsController", function($scope, $http) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
webconfig.controller("variablesController", function($scope, $http) {
|
webconfig.controller("variablesController", function($scope, $http) {
|
||||||
|
$scope.query = null;
|
||||||
$scope.fetchVariables= function() {
|
$scope.fetchVariables= function() {
|
||||||
$http.get("/variables/").success(function(data, status, headers, config) {
|
$http.get("/variables/").success(function(data, status, headers, config) {
|
||||||
$scope.variables = data;
|
$scope.variables = data;
|
||||||
})};
|
})};
|
||||||
|
|
||||||
$scope.fetchVariables();
|
$scope.fetchVariables();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user