mirror of
https://github.com/openstf/stf
synced 2025-10-04 18:29:17 +02:00
Show errors in case of Duplicate adbkey
This commit is contained in:
parent
20d8c35603
commit
42b55889ae
4 changed files with 27 additions and 3 deletions
|
@ -397,8 +397,15 @@ module.exports = function(options) {
|
||||||
, wireutil.envelope(new wire.AdbKeysUpdatedMessage())
|
, wireutil.envelope(new wire.AdbKeysUpdatedMessage())
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
.catch(dbapi.DuplicateSecondaryIndexError, function() {
|
.catch(dbapi.DuplicateSecondaryIndexError, function(err) {
|
||||||
// No-op
|
socket.emit('user.keys.adb.error', {
|
||||||
|
message: 'Someone already added this key'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(Error, function(err) {
|
||||||
|
socket.emit('user.keys.adb.error', {
|
||||||
|
message: err.message
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.on('user.keys.adb.accept', function(data) {
|
.on('user.keys.adb.accept', function(data) {
|
||||||
|
|
|
@ -13,12 +13,21 @@ module.exports = function addAdbKeyDirective(AdbKeysService) {
|
||||||
, key: ''
|
, key: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.$on('user.keys.adb.error', function(event, error) {
|
||||||
|
$scope.$apply(function() {
|
||||||
|
$scope.error = error.message
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
$scope.$on('user.keys.adb.updated', function() {
|
||||||
|
$scope.closeAddKey()
|
||||||
|
})
|
||||||
|
|
||||||
$scope.addKey = function() {
|
$scope.addKey = function() {
|
||||||
UserService.addAdbKey({
|
UserService.addAdbKey({
|
||||||
title: $scope.addForm.title
|
title: $scope.addForm.title
|
||||||
, key: $scope.addForm.key
|
, key: $scope.addForm.key
|
||||||
})
|
})
|
||||||
$scope.closeAddKey()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.closeAddKey = function() {
|
$scope.closeAddKey = function() {
|
||||||
|
@ -27,6 +36,7 @@ module.exports = function addAdbKeyDirective(AdbKeysService) {
|
||||||
// TODO: cannot access to the form by name inside a directive?
|
// TODO: cannot access to the form by name inside a directive?
|
||||||
//$scope.adbkeyform.$setPristine()
|
//$scope.adbkeyform.$setPristine()
|
||||||
$scope.showAdd = false
|
$scope.showAdd = false
|
||||||
|
$scope.error = ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
link: function(scope) {
|
link: function(scope) {
|
||||||
|
|
|
@ -36,4 +36,7 @@
|
||||||
i.fa.fa-plus.fa-fw
|
i.fa.fa-plus.fa-fw
|
||||||
span(translate) Add Key
|
span(translate) Add Key
|
||||||
|
|
||||||
|
br
|
||||||
|
br
|
||||||
|
|
||||||
error-message(message='{{error}}')
|
error-message(message='{{error}}')
|
||||||
|
|
|
@ -24,6 +24,10 @@ module.exports = function UserServiceFactory(
|
||||||
socket.emit('user.keys.adb.remove', key)
|
socket.emit('user.keys.adb.remove', key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
socket.on('user.keys.adb.error', function(error) {
|
||||||
|
$rootScope.$broadcast('user.keys.adb.error', error)
|
||||||
|
})
|
||||||
|
|
||||||
socket.on('user.keys.adb.added', function(key) {
|
socket.on('user.keys.adb.added', function(key) {
|
||||||
UserService.getAdbKeys().push(key)
|
UserService.getAdbKeys().push(key)
|
||||||
$rootScope.$broadcast('user.keys.adb.updated', user.adbKeys)
|
$rootScope.$broadcast('user.keys.adb.updated', user.adbKeys)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue