Skip to content

Commit

Permalink
Fix Issue #41 -- Button Connect/Connected
Browse files Browse the repository at this point in the history
  • Loading branch information
jnaulty committed Aug 31, 2015
1 parent 213b139 commit b577c8c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cloudbrain/subscribers/bin/osx
cloudbrain/subscribers/bin/ubuntu
cloudbrain/publishers/bin/osx
cloudbrain/publishers/bin/ubuntu
dist/
/dist/
build/
cloudbrain.egg-info/
cloudbrain/datastore/cassandra_schema.cql
Expand Down
24 changes: 18 additions & 6 deletions cloudbrain/ui/controllers/chartController.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ function ( $scope , $http , $interval , $log , apiService , dataService ) {
deviceNames: [],
};

$scope.changeColor = function () {
var color_val = 'rgba(255, 255, 255, 0.8)';
$scope.chartPolar.options.chart.backgroundColor = color_val;
$scope.chartBar.options.chart.backgroundColor = color_val;
};


apiService.refreshDeviceIds().then(function(response) {
angular.copy(response.data, $scope.model.deviceIds);
Expand Down Expand Up @@ -56,8 +50,26 @@ function ( $scope , $http , $interval , $log , apiService , dataService ) {
//$scope.url = 'http://mock.cloudbrain.rocks/data?device_name=openbci&metric=eeg&device_id=marion&callback=JSON_CALLBACK';
$scope.showClick = false;
$scope.chartMuse = false;
$scope.button = 'Connect';
$scope.disableButton = function () {
if ($scope.deviceIdForm.$invalid || $scope.deviceIdForm.$pristine) {
return true;
} else if ($scope.deviceIdForm.$valid && $scope.deviceIdForm.$dirty) {
$scope.button = 'Connect';
return false
} else {
$scope.button = 'Connected';
return false
}
}

$scope.getData = function (device, url) {

//Button UI Logic
$scope.deviceIdForm.$setPristine();
$scope.button = 'Connected';


dataService.startPowerBand(device.name, device.id, function(data) {
updatePowerBandGraph('chartPolar', data);
updatePowerBandGraph('chartBar', data);
Expand Down
6 changes: 3 additions & 3 deletions cloudbrain/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
<ng-form name="deviceIdForm" role="form">

<div class="nav_button navbar-form navbar-right">
<button type="submit" ng-click="getData(device)" class="btn btn-success">Connect</button>
<button type="submit" ng-click="getData(device)" class="btn btn-success" ng-disabled="disableButton()">{{button}}</button>
</div>
<div class="navbar-form navbar-right" style="padding-right: 10px;"><!--DeviceName-->
<select ng-model='device.name' id="deviceName" class="form-control">
<select ng-model='device.name' id="deviceName" name="deviceName" class="form-control" required>
<option selected="selected" value="">Select Device Name</option>
<option ng-repeat="deviceName in model.deviceNames">{{deviceName}}</option>
</select>
</div><!--DeviceName -->
<div class="navbar-form navbar-right"><!--DeviceId-->
<div class="form-group">
<select ng-model='device.id' id="registeredDevices" class="form-control">
<select ng-model='device.id' name="registeredDevices" id="registeredDevices" class="form-control" required>
<option selected="selected" value="">Select Device ID</option>
<option ng-repeat="deviceId in model.deviceIds">{{deviceId}}</option>
</select>
Expand Down

0 comments on commit b577c8c

Please sign in to comment.