diff --git a/res/app/control-panes/automation/automation.jade b/res/app/control-panes/automation/automation.jade index abec6bb1..ada06d2d 100644 --- a/res/app/control-panes/automation/automation.jade +++ b/res/app/control-panes/automation/automation.jade @@ -2,4 +2,4 @@ .col-md-6 div(ng-include='"control-panes/automation/store-account/store-account.jade"') .col-md-6 - //div(ng-include='"control-panes/dashboard/clipboard/clipboard.jade"') + div(ng-include='"control-panes/automation/device-settings/device-settings.jade"') diff --git a/res/app/control-panes/automation/device-settings/device-settings-controller.js b/res/app/control-panes/automation/device-settings/device-settings-controller.js new file mode 100644 index 00000000..23ba7572 --- /dev/null +++ b/res/app/control-panes/automation/device-settings/device-settings-controller.js @@ -0,0 +1,20 @@ +module.exports = function DeviceSettingsCtrl($scope, $timeout) { + $scope.wifiEnabled = true + + var getWifiStatus = function () { + $scope.control.getWifiStatus().then(function (result) { + $scope.$apply(function () { + $scope.wifiEnabled = (result.lastData === 'wifi_enabled') + }) + }) + } + getWifiStatus() + + $scope.toggleWifi = function () { + $scope.control.setWifiEnabled(!$scope.wifiEnabled) + $scope.wifiEnabled = !$scope.wifiEnabled + $timeout(getWifiStatus, 500) + } + + +} diff --git a/res/app/control-panes/automation/device-settings/device-settings-spec.js b/res/app/control-panes/automation/device-settings/device-settings-spec.js new file mode 100644 index 00000000..a6b26465 --- /dev/null +++ b/res/app/control-panes/automation/device-settings/device-settings-spec.js @@ -0,0 +1,17 @@ +describe('DeviceSettingsCtrl', function () { + + beforeEach(module('stf.device-settings')); + + var scope, ctrl; + + beforeEach(inject(function ($rootScope, $controller) { + scope = $rootScope.$new(); + ctrl = $controller('DeviceSettingsCtrl', {$scope: scope}); + })); + + it('should ...', inject(function () { + expect(1).toEqual(1); + + })); + +}); \ No newline at end of file diff --git a/res/app/control-panes/automation/device-settings/device-settings.css b/res/app/control-panes/automation/device-settings/device-settings.css new file mode 100644 index 00000000..e7801807 --- /dev/null +++ b/res/app/control-panes/automation/device-settings/device-settings.css @@ -0,0 +1,3 @@ +.stf-device-settings { + +} \ No newline at end of file diff --git a/res/app/control-panes/automation/device-settings/device-settings.jade b/res/app/control-panes/automation/device-settings/device-settings.jade new file mode 100644 index 00000000..9b03dc56 --- /dev/null +++ b/res/app/control-panes/automation/device-settings/device-settings.jade @@ -0,0 +1,11 @@ +.widget-container.fluid-height.stf-device-settings(ng-controller='DeviceSettingsCtrl') + .heading + i.fa.fa-gears + span(translate) Device Settings + .widget-content.padded + div {{ sdStatus }} + + button.btn.btn-sm.btn-primary-outline(ng-click='toggleWifi()', + ng-model='wifiEnabled', btn-checkbox) + i.fa.fa-signal(ng-show='wifiEnabled', tooltip='{{"Disable WiFi" | translate}}', tooltip-placement='bottom') + i.fa.fa-signal(ng-hide='wifiEnabled', tooltip='{{"Enable WiFi" | translate}}', tooltip-placement='bottom') diff --git a/res/app/control-panes/automation/device-settings/index.js b/res/app/control-panes/automation/device-settings/index.js new file mode 100644 index 00000000..afb17e7e --- /dev/null +++ b/res/app/control-panes/automation/device-settings/index.js @@ -0,0 +1,11 @@ +require('./device-settings.css') + +module.exports = angular.module('stf.device-settings', [ + +]) + .run(["$templateCache", function ($templateCache) { + $templateCache.put('control-panes/automation/device-settings/device-settings.jade', + require('./device-settings.jade') + ) + }]) + .controller('DeviceSettingsCtrl', require('./device-settings-controller')) diff --git a/res/app/control-panes/automation/index.js b/res/app/control-panes/automation/index.js index 6cdffaf8..0cf1e9f5 100644 --- a/res/app/control-panes/automation/index.js +++ b/res/app/control-panes/automation/index.js @@ -1,5 +1,6 @@ module.exports = angular.module('stf.automation', [ - require('./store-account/index').name + require('./store-account').name, + require('./device-settings').name ]) .run(["$templateCache", function ($templateCache) { $templateCache.put( diff --git a/res/app/control-panes/automation/store-account/store-account-controller.js b/res/app/control-panes/automation/store-account/store-account-controller.js index cde05805..ba045dd5 100644 --- a/res/app/control-panes/automation/store-account/store-account-controller.js +++ b/res/app/control-panes/automation/store-account/store-account-controller.js @@ -9,7 +9,7 @@ module.exports = function StoreAccountCtrl($scope) { }) } - $scope.removeAccount = function () { + $scope.removeAccounts = function () { $scope.control.removeAccount().then(function (res) { }).catch(function (res) { console.log('Removing account failed', res) diff --git a/res/app/control-panes/automation/store-account/store-account.css b/res/app/control-panes/automation/store-account/store-account.css index 4b857e12..7475041b 100644 --- a/res/app/control-panes/automation/store-account/store-account.css +++ b/res/app/control-panes/automation/store-account/store-account.css @@ -1,11 +1,3 @@ .stf-store-account { } - -/*input.ng-invalid.ng-dirty {*/ - /*background-color: #FA787E;*/ -/*}*/ - -/*input.ng-valid.ng-dirty {*/ - /*background-color: #78FA89;*/ -/*}*/ diff --git a/res/app/control-panes/automation/store-account/store-account.jade b/res/app/control-panes/automation/store-account/store-account.jade index 205edc05..eff41f14 100644 --- a/res/app/control-panes/automation/store-account/store-account.jade +++ b/res/app/control-panes/automation/store-account/store-account.jade @@ -12,10 +12,10 @@ .input-group span.input-group-addon i.fa.fa-user.fa-fw - input.form-control(ng-model='username', name='username', required, type='text', placeholder='User name', + input.form-control(ng-model='username', name='username', required, type='text', placeholder='Username', autocorrect='off', autocapitalize='off', spellcheck='false', autocomplete='store-login username') .alert.alert-warning(ng-show='storeLogin.username.$dirty && storeLogin.username.$invalid') - span(ng-show='storeLogin.username.$error.required', translate) Please enter your LDAP username + span(ng-show='storeLogin.username.$error.required', translate) Please enter your Store username .form-group .input-group span.input-group-addon @@ -23,13 +23,10 @@ input.form-control(ng-model='password', name='password', required, type='password', placeholder='Password', autocorrect='off', autocapitalize='off', spellcheck='false', autocomplete='store-login password') .alert.alert-warning(ng-show='storeLogin.password.$dirty && storeLogin.password.$invalid') - span(translate) Please enter your password + span(translate) Please enter your Store password button.btn.btn-primary(ng-click='addAccount()', ng-disabled='storeLogin.$invalid') i.fa.fa-sign-in span(translate) Add Account - //input.btn.btn-primary(type='submit', value='Add Account') - i.fa.fa-sign-in - button.btn.btn-danger(ng-click='removeAccount()', ng-disabled='storeLogin.$invalid').pull-right + button.btn.btn-danger(ng-click='removeAccounts()').pull-right i.fa.fa-sign-out - span(translate) Remove Account - //input.btn.btn-danger(type='button', value='Remove Account', ng-click='removeAccount()').pull-right + span(translate) Remove Accounts