diff --git a/res/app/control-panes/automation/automation.jade b/res/app/control-panes/automation/automation.jade new file mode 100644 index 00000000..abec6bb1 --- /dev/null +++ b/res/app/control-panes/automation/automation.jade @@ -0,0 +1,5 @@ +.row + .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"') diff --git a/res/app/control-panes/automation/index.js b/res/app/control-panes/automation/index.js new file mode 100644 index 00000000..6cdffaf8 --- /dev/null +++ b/res/app/control-panes/automation/index.js @@ -0,0 +1,9 @@ +module.exports = angular.module('stf.automation', [ + require('./store-account/index').name +]) + .run(["$templateCache", function ($templateCache) { + $templateCache.put( + 'control-panes/automation/automation.jade' + , require('./automation.jade') + ) + }]) diff --git a/res/app/control-panes/automation/store-account/index.js b/res/app/control-panes/automation/store-account/index.js new file mode 100644 index 00000000..f1c370fd --- /dev/null +++ b/res/app/control-panes/automation/store-account/index.js @@ -0,0 +1,11 @@ +require('./store-account.css') + +module.exports = angular.module('stf.store-account', [ + +]) + .run(["$templateCache", function ($templateCache) { + $templateCache.put('control-panes/automation/store-account/store-account.jade', + require('./store-account.jade') + ) + }]) + .controller('StoreAccountCtrl', require('./store-account-controller')) 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 new file mode 100644 index 00000000..cde05805 --- /dev/null +++ b/res/app/control-panes/automation/store-account/store-account-controller.js @@ -0,0 +1,18 @@ +module.exports = function StoreAccountCtrl($scope) { + $scope.addAccount = function () { + var user = $scope.storeLogin.username.$modelValue + var pass = $scope.storeLogin.password.$modelValue + + $scope.control.addAccount(user, pass).then(function () { + }).catch(function (res) { + console.log('Adding account failed', res) + }) + } + + $scope.removeAccount = 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-spec.js b/res/app/control-panes/automation/store-account/store-account-spec.js new file mode 100644 index 00000000..6a1416fe --- /dev/null +++ b/res/app/control-panes/automation/store-account/store-account-spec.js @@ -0,0 +1,17 @@ +describe('StoreAccountCtrl', function () { + + beforeEach(module('stf.store-account')); + + var scope, ctrl; + + beforeEach(inject(function ($rootScope, $controller) { + scope = $rootScope.$new(); + ctrl = $controller('StoreAccountCtrl', {$scope: scope}); + })); + + it('should ...', inject(function () { + expect(1).toEqual(1); + + })); + +}); \ No newline at end of file diff --git a/res/app/control-panes/automation/store-account/store-account.css b/res/app/control-panes/automation/store-account/store-account.css new file mode 100644 index 00000000..4b857e12 --- /dev/null +++ b/res/app/control-panes/automation/store-account/store-account.css @@ -0,0 +1,11 @@ +.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 new file mode 100644 index 00000000..205edc05 --- /dev/null +++ b/res/app/control-panes/automation/store-account/store-account.jade @@ -0,0 +1,35 @@ +.widget-container.fluid-height.stf-store-account(ng-controller='StoreAccountCtrl') + .heading + i.fa.fa-cloud + span(translate) Store Account + button.btn.btn-sm.btn-primary-outline.pull-right(ng-click='control.openStore()', + tooltip='{{"App Store" | translate}}', tooltip-placement="bottom") + i.fa.fa-shopping-cart + .widget-content.padded + div + form(name='storeLogin', novalidate) + .form-group + .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', + 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 + .form-group + .input-group + span.input-group-addon + i.fa.fa-lock.fa-fw + 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 + 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 + i.fa.fa-sign-out + span(translate) Remove Account + //input.btn.btn-danger(type='button', value='Remove Account', ng-click='removeAccount()').pull-right diff --git a/res/app/control-panes/control-panes-controller.js b/res/app/control-panes/control-panes-controller.js index 64330c11..76f11518 100644 --- a/res/app/control-panes/control-panes-controller.js +++ b/res/app/control-panes/control-panes-controller.js @@ -28,6 +28,12 @@ module.exports = // templateUrl: 'control-panes/cpu/cpu.jade', // filters: ['native', 'web'] // }, + { + title: gettext('Automation'), + icon: 'fa-road', + templateUrl: 'control-panes/automation/automation.jade', + filters: ['native', 'web'] + }, { title: gettext('Advanced'), icon: 'fa-bolt', diff --git a/res/app/control-panes/index.js b/res/app/control-panes/index.js index ed5e5134..eac24b82 100644 --- a/res/app/control-panes/index.js +++ b/res/app/control-panes/index.js @@ -6,6 +6,7 @@ module.exports = angular.module('control-panes', [ require('stf/scoped-hotkeys').name, require('./device-control').name, require('./advanced').name, + require('./automation').name, require('./cpu').name, require('./dashboard').name, require('./inspect').name,