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())
|
||||
])
|
||||
})
|
||||
.catch(dbapi.DuplicateSecondaryIndexError, function() {
|
||||
// No-op
|
||||
.catch(dbapi.DuplicateSecondaryIndexError, function(err) {
|
||||
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) {
|
||||
|
|
|
@ -13,12 +13,21 @@ module.exports = function addAdbKeyDirective(AdbKeysService) {
|
|||
, 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() {
|
||||
UserService.addAdbKey({
|
||||
title: $scope.addForm.title
|
||||
, key: $scope.addForm.key
|
||||
})
|
||||
$scope.closeAddKey()
|
||||
}
|
||||
|
||||
$scope.closeAddKey = function() {
|
||||
|
@ -27,6 +36,7 @@ module.exports = function addAdbKeyDirective(AdbKeysService) {
|
|||
// TODO: cannot access to the form by name inside a directive?
|
||||
//$scope.adbkeyform.$setPristine()
|
||||
$scope.showAdd = false
|
||||
$scope.error = ''
|
||||
}
|
||||
},
|
||||
link: function(scope) {
|
||||
|
|
|
@ -36,4 +36,7 @@
|
|||
i.fa.fa-plus.fa-fw
|
||||
span(translate) Add Key
|
||||
|
||||
br
|
||||
br
|
||||
|
||||
error-message(message='{{error}}')
|
||||
|
|
|
@ -24,6 +24,10 @@ module.exports = function UserServiceFactory(
|
|||
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) {
|
||||
UserService.getAdbKeys().push(key)
|
||||
$rootScope.$broadcast('user.keys.adb.updated', user.adbKeys)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue