Fixed the harmony button to be a label and not the name. Implementation

of multi batch add completed.
This commit is contained in:
Admin
2016-01-27 16:54:23 -06:00
parent 4bc91be88b
commit a6bb1ae3aa
5 changed files with 50 additions and 14 deletions

View File

@@ -5,7 +5,7 @@
<groupId>com.bwssystems.HABridge</groupId> <groupId>com.bwssystems.HABridge</groupId>
<artifactId>ha-bridge</artifactId> <artifactId>ha-bridge</artifactId>
<version>1.3.1b</version> <version>1.3.1c</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>HA Bridge</name> <name>HA Bridge</name>

View File

@@ -1,6 +1,4 @@
var app = angular.module('habridge', [ var app = angular.module('habridge', ['ngRoute']);
'ngRoute'
]);
app.config(function ($routeProvider) { app.config(function ($routeProvider) {
$routeProvider.when('/#', { $routeProvider.when('/#', {
@@ -557,7 +555,6 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
$scope.clearDevice(); $scope.clearDevice();
bridgeService.device = $scope.device;
$scope.vera = {base: "", port: "3480", id: ""}; $scope.vera = {base: "", port: "3480", id: ""};
$scope.vera.base = "http://" + BridgeSettings.veraaddress; $scope.vera.base = "http://" + BridgeSettings.veraaddress;
bridgeService.viewVeraDevices(); bridgeService.viewVeraDevices();
@@ -566,12 +563,12 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
bridgeService.viewHarmonyDevices(); bridgeService.viewHarmonyDevices();
bridgeService.viewNestItems(); bridgeService.viewNestItems();
$scope.bridge = bridgeService.state; $scope.bridge = bridgeService.state;
$scope.device = bridgeService.state.device;
$scope.imgButtonsUrl = "glyphicon glyphicon-plus"; $scope.imgButtonsUrl = "glyphicon glyphicon-plus";
$scope.buttonsVisible = false; $scope.buttonsVisible = false;
$scope.predicate = ''; $scope.predicate = '';
$scope.reverse = true; $scope.reverse = true;
$scope.device_dim_control = ""; $scope.device_dim_control = "";
$scope.bulk = { devices: [] };
$scope.order = function(predicate) { $scope.order = function(predicate) {
$scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false; $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
$scope.predicate = predicate; $scope.predicate = predicate;
@@ -743,7 +740,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"fan-on\"}"; $scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"fan-on\"}";
$scope.device.offUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"fan-auto\"}"; $scope.device.offUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"fan-auto\"}";
}; };
$scope.testUrl = function (device, type) { $scope.testUrl = function (device, type) {
bridgeService.testUrl(device, type); bridgeService.testUrl(device, type);
}; };
@@ -769,7 +766,34 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
function (error) { 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++) {
if(bridgeService.state.veradevices[x].id == $scope.bulk.devices[i]) {
$scope.buildDeviceUrls(bridgeService.state.veradevices[x],dim_control);
$scope.addDevice();
}
}
}
$scope.bulk = { devices: [] };
};
$scope.toggleSelection = function toggleSelection(deviceId) {
var idx = $scope.bulk.devices.indexOf(deviceId);
// is currently selected
if (idx > -1) {
$scope.bulk.devices.splice(idx, 1);
}
// is newly selected
else {
$scope.bulk.devices.push(deviceId);
}
};
$scope.toggleButtons = function () { $scope.toggleButtons = function () {
$scope.buttonsVisible = !$scope.buttonsVisible; $scope.buttonsVisible = !$scope.buttonsVisible;

View File

@@ -24,11 +24,12 @@
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Current devices</h2> <h2 class="panel-title">Current devices ({{bridge.devices.length}}) </h2>
</div> </div>
<table class="table table-bordered table-striped table-hover"> <table class="table table-bordered table-striped table-hover">
<thead> <thead>
<tr> <tr>
<th>Row</th>
<th> <th>
<a href="" ng-click="order('id')">ID</a> <a href="" ng-click="order('id')">ID</a>
<span class="sortorder" ng-show="predicate === 'id'" ng-class="{reverse:reverse}"></span></th> <span class="sortorder" ng-show="predicate === 'id'" ng-class="{reverse:reverse}"></span></th>
@@ -45,6 +46,7 @@
</tr> </tr>
</thead> </thead>
<tr ng-repeat="device in bridge.devices | orderBy:predicate:reverse"> <tr ng-repeat="device in bridge.devices | orderBy:predicate:reverse">
<td>{{$index+1}}</td>
<td>{{device.id}}</td> <td>{{device.id}}</td>
<td>{{device.name}}</td> <td>{{device.name}}</td>
<td>{{device.deviceType}}</td> <td>{{device.deviceType}}</td>

View File

@@ -46,14 +46,14 @@
<td> <td>
<select name="device-ctrlon" id="device-ctrlon" ng-model="devicectrlon"> <select name="device-ctrlon" id="device-ctrlon" ng-model="devicectrlon">
<optgroup ng-repeat="ctrlon in harmonydevice.device.controlGroup" label="{{ctrlon.name}}"> <optgroup ng-repeat="ctrlon in harmonydevice.device.controlGroup" label="{{ctrlon.name}}">
<option ng-repeat="funcon in ctrlon.function">{{funcon.name}}</option> <option ng-repeat="funcon in ctrlon.function" value="{{funcon.label}}">{{funcon.name}}</option>
</optgroup > </optgroup >
</select> </select>
</td> </td>
<td> <td>
<select name="device-ctrloff" id="device-ctrloff" ng-model="devicectrloff"> <select name="device-ctrloff" id="device-ctrloff" ng-model="devicectrloff">
<optgroup ng-repeat="ctrloff in harmonydevice.device.controlGroup" label="{{ctrloff.name}}"> <optgroup ng-repeat="ctrloff in harmonydevice.device.controlGroup" label="{{ctrloff.name}}">
<option ng-repeat="funcoff in ctrloff.function">{{funcoff.name}}</option> <option ng-repeat="funcoff in ctrloff.function" value="{{funcoff.label}}">{{funcoff.name}}</option>
</optgroup > </optgroup >
</select> </select>
</td> </td>

View File

@@ -10,13 +10,14 @@
<div class="panel panel-default bridgeServer" ng-if="!bridge.error"> <div class="panel panel-default bridgeServer" ng-if="!bridge.error">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Vera Device List</h2> <h2 class="panel-title">Vera Device List ({{bridge.veradevices.length}})</h2>
</div> </div>
<ul class="list-group"> <ul class="list-group">
<li class="list-group-item"> <li class="list-group-item">
<p class="text-muted">For any Vera Device, use the action buttons to generate the device addition information below automatically. <p class="text-muted">For any Vera Device, use the action buttons to generate the device addition information below automatically.
Then you can modify the name to anything you want that will be the keyword for Alexa. Click the 'Add Bridge Device' to finish that selection setup. Then you can modify the name to anything you want that will be the keyword for Alexa. Click the 'Add Bridge Device' to finish that selection setup.
The 'Already Configured Vera Devices' list below will show what is already setup for your Vera.</p><p>Also, use this select menu for which type of dim The 'Already Configured Vera Devices' list below will show what is already setup for your Vera.</p>
<p>Also, use this select menu for which type of dim
control you would like to be generated: control you would like to be generated:
<select name="device-dim-control" id="device-dim-control" ng-model="device_dim_control"> <select name="device-dim-control" id="device-dim-control" ng-model="device_dim_control">
<option value="">none</option> <option value="">none</option>
@@ -25,9 +26,13 @@
<option value="${intensity.math(X*1)}">Custom Math</option> <option value="${intensity.math(X*1)}">Custom Math</option>
</select> </select>
</p> </p>
<p>Use the check boxes by the names to use the bulk addition feature. Select your items and dim control type if wanted, then click bulk add below.
Your items will be added with on and off or dim and off if selected with the name of the device from the Vera.
</p>
<table class="table table-bordered table-striped table-hover"> <table class="table table-bordered table-striped table-hover">
<thead> <thead>
<tr> <tr>
<th>Row</th>
<th> <th>
<a href="" ng-click="order('name')">Name</a> <a href="" ng-click="order('name')">Name</a>
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span> <span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
@@ -48,7 +53,8 @@
</tr> </tr>
</thead> </thead>
<tr ng-repeat="veradevice in bridge.veradevices | availableVeraDeviceId | orderBy:predicate:reverse"> <tr ng-repeat="veradevice in bridge.veradevices | availableVeraDeviceId | orderBy:predicate:reverse">
<td>{{veradevice.name}}</td> <td>{{$index+1}}</td>
<td><input type="checkbox" name="bulk.devices[]" value="{{veradevice.id}}" ng-checked="bulk.devices.indexOf(veradevice.id) > -1" ng-click="toggleSelection(veradevice.id)"> {{veradevice.name}}</td>
<td>{{veradevice.id}}</td> <td>{{veradevice.id}}</td>
<td>{{veradevice.category}}</td> <td>{{veradevice.category}}</td>
<td>{{veradevice.room}}</td> <td>{{veradevice.room}}</td>
@@ -59,6 +65,10 @@
</td> </td>
</tr> </tr>
</table> </table>
<p>
<button class="btn btn-success" type="submit"
ng-click="bulkAddDevices(device_dim_control)">Bulk Add ({{bulk.devices.length}})</button>
</p>
</li> </li>
</ul> </ul>
<div class="panel-heading"> <div class="panel-heading">