diff --git a/pom.xml b/pom.xml index 18b108a..42d9a8d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.bwssystems.HABridge ha-bridge - 1.3.6.a + 1.3.7 jar HA Bridge diff --git a/src/main/resources/public/scripts/app.js b/src/main/resources/public/scripts/app.js index 29bbabe..e605661 100644 --- a/src/main/resources/public/scripts/app.js +++ b/src/main/resources/public/scripts/app.js @@ -38,7 +38,7 @@ app.run( function (bridgeService) { app.service('bridgeService', function ($http, $window) { var self = this; - this.state = {base: window.location.origin + "/api/devices", upnpbase: window.location.origin + "/upnp/settings", huebase: window.location.origin + "/api", backups: [], devices: [], device: [], settings: [], error: "", showVera: false, showHarmony: false, showNest: false, habridgeversion: ""}; + this.state = {base: window.location.origin + "/api/devices", upnpbase: window.location.origin + "/upnp/settings", huebase: window.location.origin + "/api", backups: [], devices: [], device: [], settings: [], olddevicename: "", error: "", showVera: false, showHarmony: false, showNest: false, habridgeversion: ""}; this.viewDevices = function () { this.state.error = ""; @@ -386,6 +386,7 @@ app.service('bridgeService', function ($http, $window) { this.editDevice = function (device) { self.state.device = device; + self.state.olddevicename = device.name; }; this.testUrl = function (device, type) { @@ -507,6 +508,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer $scope.device.contentType = null; $scope.device.contentBody = null; $scope.device.contentBodyOff = null; + $scope.bridge.olddevice.name = ""; }; $scope.buildUrlsUsingDevice = function (dim_control) { @@ -700,6 +702,27 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer }; + $scope.copyDevice = function () { + if($scope.device.name == "" && $scope.device.onUrl == "") { + $scope.clearDevice(); + return; + } + + if($scope.device.name == $scope.bridge.olddevicename) { + $scope.clearDevice(); + return; + } + $scope.device.id = null; + bridgeService.addDevice($scope.device).then( + function () { + $scope.clearDevice(); + }, + function (error) { + } + ); + + }; + $scope.bulkAddDevices = function(dim_control) { for(var i = 0; i < $scope.bulk.devices.length; i++) { for(var x = 0; x < bridgeService.state.veradevices.length; x++) { diff --git a/src/main/resources/public/views/configuration.html b/src/main/resources/public/views/configuration.html index 3920bee..967072f 100644 --- a/src/main/resources/public/views/configuration.html +++ b/src/main/resources/public/views/configuration.html @@ -57,7 +57,7 @@ + ng-click="editDevice(device)">Edit/Copy diff --git a/src/main/resources/public/views/editdevice.html b/src/main/resources/public/views/editdevice.html index b7bd74c..8973689 100644 --- a/src/main/resources/public/views/editdevice.html +++ b/src/main/resources/public/views/editdevice.html @@ -11,10 +11,11 @@
-

Edit a device

+

Edit/Copy a device

This screen allows the modification of many fields the bridge uses. Please use care when updating these fields as you may break the settings used by the bridge to call a specific end point device.

+

When copying, update the name and select the "Add Bridge Device" Button.

-
@@ -37,8 +38,8 @@
- +
@@ -56,6 +57,8 @@
+