From 087d66694e76d66e4bb962c547f2d9d96cf37d25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20F=C3=B6rderreuther?= Date: Fri, 28 Jul 2017 02:24:48 +0200 Subject: [PATCH] Added filter to device list "show devices visible to ip-address" If filter is active it will only show the devices that are visible for the given ip-address. Filter setting is saved until browser tab is closed. --- src/main/resources/public/scripts/app.js | 17 ++++++++++++++++- .../resources/public/views/configuration.html | 14 +++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/main/resources/public/scripts/app.js b/src/main/resources/public/scripts/app.js index 4bf6dc1..6c4de53 100644 --- a/src/main/resources/public/scripts/app.js +++ b/src/main/resources/public/scripts/app.js @@ -134,7 +134,7 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n this.state = {base: "./api/devices", bridgelocation: ".", systemsbase: "./system", huebase: "./api", configs: [], backups: [], devices: [], device: {}, mapandid: [], type: "", settings: [], myToastMsg: [], logMsgs: [], loggerInfo: [], mapTypes: [], olddevicename: "", logShowAll: false, isInControl: false, showVera: false, showHarmony: false, showNest: false, showHue: false, showHal: false, showMqtt: false, showHass: false, - showDomoticz: false, showSomfy: false, showLifx: false, habridgeversion: {}, viewDevId: "", queueDevId: "", securityInfo: {}}; + showDomoticz: false, showSomfy: false, showLifx: false, habridgeversion: {}, viewDevId: "", queueDevId: "", securityInfo: {}, filterDevicesByIpAddress: null}; this.displayWarn = function(errorTitle, error) { var toastContent = errorTitle; @@ -3462,6 +3462,21 @@ app.filter('configuredSomfyDevices', function (bridgeService) { } }); +app.filter('filterDevicesByRequester', function () { + return function(input,search) { + var out = []; + if(input === undefined || input === null || input.length === undefined) + return out; + var pattern = new RegExp(search); + for (var i = 0; i < input.length; i++) { + if(pattern.test(input[i].requesterAddress) || !input[i].requesterAddress || input[i].requesterAddress.length === 0){ + out.push(input[i]); + } + } + return out; + } +}); + app.controller('LoginController', function ($scope, $location, Auth) { $scope.failed = false; $scope.loggedIn = Auth.isLoggedIn(); diff --git a/src/main/resources/public/views/configuration.html b/src/main/resources/public/views/configuration.html index a3664e7..0060600 100644 --- a/src/main/resources/public/views/configuration.html +++ b/src/main/resources/public/views/configuration.html @@ -31,10 +31,14 @@
-

- - -

+
+ + + + +
+ @@ -51,7 +55,7 @@ - +
Actions
{{$index+1}} {{device.id}} {{device.name}}