mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 16:13:24 +02:00
Change function signature.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
module.exports = function AdbKeysServiceFactory() {
|
||||
var service = {}
|
||||
|
||||
service.hostNameFromKey = function (key) {
|
||||
service.commentFromKey = function (key) {
|
||||
if (key.match(/.+= (.+)/)) {
|
||||
return key.replace(/.+= (.+)/g, '$1').replace(/(\.local)?/g, '')
|
||||
return key.replace(/.+= (.+)/g, '$1')
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
@@ -22,14 +22,16 @@ module.exports = function addAdbKeyDirective(AdbKeysService) {
|
||||
scope.addForm.title = ''
|
||||
scope.addForm.key = ''
|
||||
console.log('scope', scope)
|
||||
// TODO: cannot access to the form by name?
|
||||
// TODO: cannot access to the form by name inside a directive?
|
||||
//scope.adbkeyform.$setPristine()
|
||||
scope.showAdd = false
|
||||
}
|
||||
|
||||
scope.$watch('addForm.key', function (newValue) {
|
||||
if (newValue && !scope.addForm.title) {
|
||||
scope.addForm.title = AdbKeysService.hostNameFromKey(newValue)
|
||||
// By default sets the title to the ADB key comment because
|
||||
// usually it happens to be username@hostname.
|
||||
scope.addForm.title = AdbKeysService.commentFromKey(newValue)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user