diff --git a/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal-service.js b/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal-service.js new file mode 100644 index 00000000..37efbeaa --- /dev/null +++ b/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal-service.js @@ -0,0 +1,45 @@ +module.exports = + function AddAdbKeyModalServiceFactory($modal) { + var service = {} + + var ModalInstanceCtrl = function ($scope, $modalInstance, data) { + $scope.modal = {} + $scope.modal.showAdd = true + $scope.modal.fingerprint = data.fingerprint + $scope.modal.title = data.title + + $scope.ok = function () { + console.log('add key') + $modalInstance.close(true) + } + + + $scope.$watch('modal.showAdd', function (newValue) { + if (newValue === false) { + $scope.ok() + } + }) + + $scope.cancel = function () { + $modalInstance.dismiss('cancel') + } + } + + service.open = function (data) { + var modalInstance = $modal.open({ + template: require('./add-adb-key-modal.jade'), + controller: ModalInstanceCtrl, + resolve: { + data: function () { + return data + } + } + }) + + modalInstance.result.then(function () { + }, function () { + }) + } + + return service + } diff --git a/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal-spec.js b/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal-spec.js new file mode 100644 index 00000000..f54a5135 --- /dev/null +++ b/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal-spec.js @@ -0,0 +1,11 @@ +describe('FatalMessageService', function() { + + beforeEach(angular.mock.module(require('./').name)); + + it('should ...', inject(function(FatalMessageService) { + + //expect(FatalMessageService.doSomething()).toEqual('something'); + + })); + +}) diff --git a/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal.jade b/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal.jade new file mode 100644 index 00000000..b28e3d6f --- /dev/null +++ b/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal.jade @@ -0,0 +1,33 @@ +.stf-add-adb-key-modal.stf-modal + .modal-header.dialog-header-confirm + button(type='button', ng-click='cancel()').close × + h4.modal-title.text-dangerX + i.fa.fa-android + .button-spacer + span(translate) Add the following ADB Key to STF? + .modal-body + //p Add the following ADB Key to STF? + + form.panel(ng-submit='ok()') + .panel-body + label.control-label + i.fa.fa-key.fa-fw + span(translate) Fingerprint + pre(ng-bind='modal.fingerprint').selectable + + label.control-label + i.fa.fa-laptop.fa-fw + span(translate) Device + pre(ng-bind='modal.title').selectable + + button.btn.btn-primary-outline.btn-sm.pull-right(type='submit') + i.fa.fa-plus.fa-fw + span(translate) Add Key + + //.modal-footer + button.btn.btn-primary(type='button', ng-click='ok()') + i.fa.fa-refresh + span(translate) Try to reconnect + button.btn.btn-success(ng-click='second()') + i.fa.fa-sitemap + span(translate) Go to Device List diff --git a/res/app/components/stf/common-ui/modals/add-adb-key-modal/index.js b/res/app/components/stf/common-ui/modals/add-adb-key-modal/index.js new file mode 100644 index 00000000..4bffd2da --- /dev/null +++ b/res/app/components/stf/common-ui/modals/add-adb-key-modal/index.js @@ -0,0 +1,5 @@ +module.exports = angular.module('stf.add-adb-key-modal', [ + require('stf/common-ui/modals/common').name, + //require('stf/keys/add-adb-key').name +]) + .factory('AddAdbKeyModalService', require('./add-adb-key-modal-service')) diff --git a/res/app/components/stf/common-ui/modals/index.js b/res/app/components/stf/common-ui/modals/index.js index e913106d..d07e866d 100644 --- a/res/app/components/stf/common-ui/modals/index.js +++ b/res/app/components/stf/common-ui/modals/index.js @@ -1,4 +1,5 @@ module.exports = angular.module('stf.modals', [ require('./fatal-message').name, - require('./version-update').name + require('./version-update').name, + require('./add-adb-key-modal').name ]) diff --git a/res/app/settings/adb-keys/adb-keys-controller.js b/res/app/settings/adb-keys/adb-keys-controller.js index 75f4bb15..a68ad2e1 100644 --- a/res/app/settings/adb-keys/adb-keys-controller.js +++ b/res/app/settings/adb-keys/adb-keys-controller.js @@ -1,4 +1,9 @@ -module.exports = function AdbKeysCtrl($scope, AdbKeysService) { +module.exports = function AdbKeysCtrl($scope, AddAdbKeyModalService) { + + //AddAdbKeyModalService.open({ + // title: 'PC1264', + // fingerprint: 'bb:86:60:39:d7:a2:e3:09:93:09:cc:f6:e8:37:99:3f' + //}) $scope.adbKeys = [ { @@ -16,6 +21,4 @@ module.exports = function AdbKeysCtrl($scope, AdbKeysService) { $scope.adbKeys.splice($scope.adbKeys.indexOf(key), 1) } - - }