mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 12:53:31 +02:00
Add Access Tokens base.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
module.exports = function AccessTokensCtrl($scope) {
|
||||
|
||||
}
|
||||
17
res/app/settings/keys/access-tokens/access-tokens-spec.js
Normal file
17
res/app/settings/keys/access-tokens/access-tokens-spec.js
Normal file
@@ -0,0 +1,17 @@
|
||||
describe('AccessTokensCtrl', function () {
|
||||
|
||||
beforeEach(angular.mock.module(require('./index').name))
|
||||
|
||||
var scope, ctrl
|
||||
|
||||
beforeEach(inject(function ($rootScope, $controller) {
|
||||
scope = $rootScope.$new()
|
||||
ctrl = $controller('AccessTokensCtrl', {$scope: scope})
|
||||
}))
|
||||
|
||||
it('should ...', inject(function () {
|
||||
expect(1).toEqual(1)
|
||||
|
||||
}))
|
||||
|
||||
})
|
||||
3
res/app/settings/keys/access-tokens/access-tokens.css
Normal file
3
res/app/settings/keys/access-tokens/access-tokens.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.stf-access-tokens {
|
||||
|
||||
}
|
||||
33
res/app/settings/keys/access-tokens/access-tokens.jade
Normal file
33
res/app/settings/keys/access-tokens/access-tokens.jade
Normal file
@@ -0,0 +1,33 @@
|
||||
.widget-container.fluid-height.stf-access-tokens(ng-controller='AccessTokensCtrl')
|
||||
.heading
|
||||
i.fa.fa-key
|
||||
span(translate) Access Tokens
|
||||
|
||||
button.btn.pull-right.btn-sm(
|
||||
ng-click='showAdd = !showAdd',
|
||||
ng-class='{ "btn-primary-outline": !showAdd, "btn-primary": showAdd }')
|
||||
i.fa.fa-plus.fa-fw
|
||||
|
||||
a(ng-href='/#!/docs/access-tokens').pull-right.btn.btn-sm
|
||||
i.fa.fa-question-circle(tooltip='{{"More about Access Tokens" | translate}}', tooltip-placement='left')
|
||||
|
||||
.widget-content.padded
|
||||
|
||||
//add-adb-key(show-clipboard='true', show-add='showAdd')
|
||||
|
||||
nothing-to-show(icon='fa-key', message='{{"No access tokens" | translate}}',
|
||||
ng-if='!adbKeys.length && !showAdd')
|
||||
|
||||
|
||||
|
||||
ul.list-group.key-list
|
||||
li.list-group-item(ng-repeat='key in adbKeys').animate-repeat
|
||||
a
|
||||
i.fa.fa-key.fa-2x.fa-fw.key-list-icon
|
||||
.key-list-details.selectable
|
||||
.key-list-title(ng-bind='key.title')
|
||||
.key-list-fingerprint(ng-bind='key.fingerprint')
|
||||
|
||||
button.btn.btn-xs.btn-danger-outline.pull-right.key-list-remove(ng-click='removeKey(key)')
|
||||
i.fa.fa-trash-o
|
||||
span(translate) Remove
|
||||
11
res/app/settings/keys/access-tokens/index.js
Normal file
11
res/app/settings/keys/access-tokens/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
require('./access-tokens.css')
|
||||
|
||||
module.exports = angular.module('stf.access-tokens', [
|
||||
require('stf/common-ui').name
|
||||
])
|
||||
.run(["$templateCache", function ($templateCache) {
|
||||
$templateCache.put(
|
||||
'settings/keys/access-tokens/access-tokens.jade', require('./access-tokens.jade')
|
||||
)
|
||||
}])
|
||||
.controller('AccessTokensCtrl', require('./access-tokens-controller'))
|
||||
24
res/app/settings/keys/adb-keys/adb-keys-controller.js
Normal file
24
res/app/settings/keys/adb-keys/adb-keys-controller.js
Normal file
@@ -0,0 +1,24 @@
|
||||
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 = [
|
||||
{
|
||||
title: 'A11251@PC1264.local',
|
||||
fingerprint: 'bb:86:60:39:d7:a2:e3:09:93:09:cc:f6:e8:37:99:3f'
|
||||
},
|
||||
{
|
||||
title: 'A11251@MobileMac.local',
|
||||
fingerprint: '97:ca:ae:fa:09:0b:c4:fe:22:94:7d:b2:be:77:66:a1'
|
||||
}
|
||||
]
|
||||
|
||||
$scope.removeKey = function (key) {
|
||||
console.log('Remove key', key)
|
||||
$scope.adbKeys.splice($scope.adbKeys.indexOf(key), 1)
|
||||
}
|
||||
|
||||
}
|
||||
12
res/app/settings/keys/adb-keys/adb-keys-service.js
Normal file
12
res/app/settings/keys/adb-keys/adb-keys-service.js
Normal file
@@ -0,0 +1,12 @@
|
||||
module.exports = function AdbKeysServiceFactory() {
|
||||
var service = {}
|
||||
|
||||
service.hostNameFromKey = function (key) {
|
||||
if (key.match(/.+= (.+)/)) {
|
||||
return key.replace(/.+= (.+)/g, '$1').replace(/(\.local)?/g, '')
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
return service
|
||||
}
|
||||
17
res/app/settings/keys/adb-keys/adb-keys-spec.js
Normal file
17
res/app/settings/keys/adb-keys/adb-keys-spec.js
Normal file
@@ -0,0 +1,17 @@
|
||||
describe('AdbKeysCtrl', function () {
|
||||
|
||||
beforeEach(angular.mock.module(require('./index').name))
|
||||
|
||||
var scope, ctrl
|
||||
|
||||
beforeEach(inject(function ($rootScope, $controller) {
|
||||
scope = $rootScope.$new()
|
||||
ctrl = $controller('AdbKeysCtrl', {$scope: scope})
|
||||
}))
|
||||
|
||||
it('should ...', inject(function () {
|
||||
expect(1).toEqual(1)
|
||||
|
||||
}))
|
||||
|
||||
})
|
||||
52
res/app/settings/keys/adb-keys/adb-keys.css
Normal file
52
res/app/settings/keys/adb-keys/adb-keys.css
Normal file
@@ -0,0 +1,52 @@
|
||||
.stf-adb-keys .key-list-icon {
|
||||
|
||||
}
|
||||
|
||||
.stf-adb-keys .key-list a {
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid #dddddd;
|
||||
}
|
||||
|
||||
.stf-adb-keys .key-list-details {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.stf-adb-keys .key-list-title {
|
||||
color: #007aff;
|
||||
font-size: 14px;
|
||||
font-weight: 300;
|
||||
margin: 2px 0 6px;
|
||||
}
|
||||
|
||||
.stf-adb-keys .key-list-fingerprint {
|
||||
font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
|
||||
font-size: 10px;
|
||||
margin-bottom: 2px;
|
||||
color: #999999;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.stf-adb-keys .key-list-remove {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.animate-repeat.ng-move,
|
||||
.animate-repeat.ng-enter,
|
||||
.animate-repeat.ng-leave {
|
||||
-webkit-transition: all ease-out 150ms;
|
||||
transition: all ease-out 150ms;
|
||||
}
|
||||
|
||||
.animate-repeat.ng-leave.ng-leave-active,
|
||||
.animate-repeat.ng-move,
|
||||
.animate-repeat.ng-enter {
|
||||
opacity: 0;
|
||||
max-height: 0;
|
||||
}
|
||||
|
||||
.animate-repeat.ng-leave,
|
||||
.animate-repeat.ng-move.ng-move-active,
|
||||
.animate-repeat.ng-enter.ng-enter-active {
|
||||
opacity: 1;
|
||||
max-height: 100px;
|
||||
}
|
||||
114
res/app/settings/keys/adb-keys/adb-keys.jade
Normal file
114
res/app/settings/keys/adb-keys/adb-keys.jade
Normal file
@@ -0,0 +1,114 @@
|
||||
.widget-container.fluid-height.stf-adb-keys(ng-controller='AdbKeysCtrl')
|
||||
.heading
|
||||
i.fa.fa-android
|
||||
span(translate) ADB Keys
|
||||
|
||||
|
||||
|
||||
button.btn.pull-right.btn-sm(
|
||||
ng-click='showAdd = !showAdd',
|
||||
ng-class='{ "btn-primary-outline": !showAdd, "btn-primary": showAdd }')
|
||||
//(tooltip='{{ "Add ADB Key" | translate }}')
|
||||
i.fa.fa-plus.fa-fw
|
||||
|
||||
a(ng-href='/#!/docs/adb-keys').pull-right.btn.btn-sm
|
||||
i.fa.fa-question-circle(tooltip='{{"More about ADB Keys" | translate}}', tooltip-placement='left')
|
||||
|
||||
.widget-content.padded
|
||||
|
||||
add-adb-key(show-clipboard='true', show-add='showAdd')
|
||||
|
||||
nothing-to-show(icon='fa-android', message='{{"No ADB keys" | translate}}',
|
||||
ng-if='!adbKeys.length && !showAdd')
|
||||
|
||||
|
||||
//accordion(ng-if='showAdd').pointer
|
||||
accordion-group(is-open='showAdd')
|
||||
accordion-heading.pointer
|
||||
i.fa.fa-fw.fa-key
|
||||
span(translateX) Add ADB Key
|
||||
|
||||
form.form-horizontal(name='adbkeyform', ng-submit='addKey(key)')
|
||||
|
||||
.alert.alert-info.selectable <strong>Tip: </strong>Run this command to copy the key to your clipboard
|
||||
a(ng-href='/#!/docs/adb-keys').pull-right
|
||||
i.fa.fa-question-circle(tooltip='{{"More about ADB Keys" | translate}}', tooltip-placement='left')
|
||||
textarea(readonly, rows='1', text-focus-select,
|
||||
).form-control.remote-debug-textarea pbcopy < ~/.android/adbkey.pub
|
||||
//<code>pbcopy < ~/.android/adbkey.pub</code>
|
||||
|
||||
br
|
||||
|
||||
.form-group
|
||||
label.control-label.col-md-1
|
||||
i.fa.fa-key.fa-fw
|
||||
span(translate) Key
|
||||
.col-md-11
|
||||
textarea(rows='4', ng-model='key', ng-required='true',
|
||||
autocorrect='off', autocapitalize='off', spellcheck='false',
|
||||
focus-element='focusAddKey').form-control
|
||||
|
||||
.form-group
|
||||
label.control-label.col-md-1
|
||||
i.fa.fa-laptop.fa-fw
|
||||
span(translate) Device
|
||||
.col-md-11
|
||||
input(type='text', ng-model='title', ng-required='true',
|
||||
text-focus-select, focus-element='focusAddTitle').form-control
|
||||
|
||||
button.btn.btn-primary-outline.btn-sm.pull-right(type='submit')
|
||||
i.fa.fa-plus.fa-fw
|
||||
span(translate) Add Key
|
||||
|
||||
//.panel.panel-default(ng-show='showAdd')
|
||||
.panel-heading
|
||||
h3.panel-title(translate) Add ADB Key
|
||||
.panel-body
|
||||
form.form-horizontal(name='adbkeyform', ng-submit='addKey(key)')
|
||||
|
||||
.alert.alert-info.selectable <strong>Tip: </strong>Run this command to copy the key to your clipboard
|
||||
a(ng-href='/#!/docs/adb-keys').pull-right
|
||||
i.fa.fa-question-circle(tooltip='{{"More about ADB Keys" | translate}}', tooltip-placement='left')
|
||||
textarea(readonly, rows='1', text-focus-select, ng-copy='focusAddKey = true'
|
||||
).form-control.remote-debug-textarea pbcopy < ~/.android/adbkey.pub
|
||||
//<code>pbcopy < ~/.android/adbkey.pub</code>
|
||||
|
||||
br
|
||||
|
||||
.form-group
|
||||
label.control-label.col-md-1
|
||||
i.fa.fa-key.fa-fw
|
||||
span(translate) Key
|
||||
.col-md-11
|
||||
textarea(rows='4', ng-model='key', ng-required='true',
|
||||
autocorrect='off', autocapitalize='off', spellcheck='false',
|
||||
focus-element='focusAddKey', ng-paste='focusAddTitle = true').form-control
|
||||
|
||||
.form-group
|
||||
label.control-label.col-md-1
|
||||
i.fa.fa-laptop.fa-fw
|
||||
span(translate) Device
|
||||
.col-md-11
|
||||
input(type='text', ng-model='title', ng-required='true',
|
||||
text-focus-select, focus-element='focusAddTitle').form-control
|
||||
|
||||
|
||||
|
||||
button.btn.btn-primary-outline.btn-sm.pull-right(type='submit')
|
||||
i.fa.fa-plus.fa-fw
|
||||
span(translate) Add Key
|
||||
|
||||
//error-message(message='{{error}}')
|
||||
|
||||
|
||||
ul.list-group.key-list
|
||||
li.list-group-item(ng-repeat='key in adbKeys').animate-repeat
|
||||
a
|
||||
i.fa.fa-key.fa-2x.fa-fw.key-list-icon
|
||||
.key-list-details.selectable
|
||||
.key-list-title(ng-bind='key.title')
|
||||
.key-list-fingerprint(ng-bind='key.fingerprint')
|
||||
|
||||
button.btn.btn-xs.btn-danger-outline.pull-right.key-list-remove(ng-click='removeKey(key)')
|
||||
i.fa.fa-trash-o
|
||||
span(translate) Remove
|
||||
12
res/app/settings/keys/adb-keys/index.js
Normal file
12
res/app/settings/keys/adb-keys/index.js
Normal file
@@ -0,0 +1,12 @@
|
||||
require('./adb-keys.css')
|
||||
|
||||
module.exports = angular.module('stf.settings.adb-keys', [
|
||||
require('stf/common-ui').name,
|
||||
require('stf/keys/add-adb-key').name
|
||||
])
|
||||
.run(["$templateCache", function ($templateCache) {
|
||||
$templateCache.put(
|
||||
'settings/keys/adb-keys/adb-keys.jade', require('./adb-keys.jade')
|
||||
)
|
||||
}])
|
||||
.controller('AdbKeysCtrl', require('./adb-keys-controller'))
|
||||
12
res/app/settings/keys/index.js
Normal file
12
res/app/settings/keys/index.js
Normal file
@@ -0,0 +1,12 @@
|
||||
require('./keys.css')
|
||||
|
||||
module.exports = angular.module('stf.keys', [
|
||||
require('./adb-keys').name,
|
||||
require('./access-tokens').name
|
||||
])
|
||||
.run(["$templateCache", function ($templateCache) {
|
||||
$templateCache.put(
|
||||
'settings/keys/keys.jade', require('./keys.jade')
|
||||
)
|
||||
}])
|
||||
.controller('KeysCtrl', require('./keys-controller'))
|
||||
3
res/app/settings/keys/keys-controller.js
Normal file
3
res/app/settings/keys/keys-controller.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = function KeysCtrl($scope) {
|
||||
|
||||
}
|
||||
17
res/app/settings/keys/keys-spec.js
Normal file
17
res/app/settings/keys/keys-spec.js
Normal file
@@ -0,0 +1,17 @@
|
||||
describe('KeysCtrl', function () {
|
||||
|
||||
beforeEach(angular.mock.module(require('./index').name))
|
||||
|
||||
var scope, ctrl
|
||||
|
||||
beforeEach(inject(function ($rootScope, $controller) {
|
||||
scope = $rootScope.$new()
|
||||
ctrl = $controller('KeysCtrl', {$scope: scope})
|
||||
}))
|
||||
|
||||
it('should ...', inject(function () {
|
||||
expect(1).toEqual(1)
|
||||
|
||||
}))
|
||||
|
||||
})
|
||||
3
res/app/settings/keys/keys.css
Normal file
3
res/app/settings/keys/keys.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.stf-keys {
|
||||
|
||||
}
|
||||
5
res/app/settings/keys/keys.jade
Normal file
5
res/app/settings/keys/keys.jade
Normal file
@@ -0,0 +1,5 @@
|
||||
.row
|
||||
.col-md-6
|
||||
div(ng-include='"settings/keys/access-tokens/access-tokens.jade"')
|
||||
.col-md-6
|
||||
div(ng-include='"settings/keys/adb-keys/adb-keys.jade"')
|
||||
Reference in New Issue
Block a user