winterhazel commented on code in PR #13896:
URL: https://github.com/apache/cloudstack/pull/13896#discussion_r3803715317


##########
ui/src/components/view/ApiKeyPairsTab.vue:
##########
@@ -287,34 +287,17 @@ export default {
       this.fetchLoading = true
       try {
         await Promise.all(keypairs.map(async keypair => {
-          try {
-            const jobId = await this.deleteKeyPair({
-              keypairid: keypair.id
-            })
-            await this.$pollJob({
-              jobId,
-              action: {
-                isFetchData: false
-              },
-              successMethod: () => {
-                eventBus.emit('update-resource-state', { selectedItems: 
this.selectedItems, resource: keypair.id, state: 'success' })
-              },
-              catchMethod: () => {
-                eventBus.emit('update-resource-state', { selectedItems: 
this.selectedItems, resource: keypair.id, state: 'failed' })
-              }
-            })
-          } catch (e) {
+          await postAPI('deleteUserKeys', { keypairid: keypair.id 
}).then(response => {
+            eventBus.emit('update-resource-state', { selectedItems: 
this.selectedItems, resource: keypair.id, state: 'success' })
+          }).catch(error => {
             eventBus.emit('update-resource-state', { selectedItems: 
this.selectedItems, resource: keypair.id, state: 'failed' })
-          }
+            this.$notifyError(error)

Review Comment:
   @bernardodemarco I think the UI should show the exception returned by the 
API, instead of showing a generic message.
   
   ~I am actually inclined to change the error handling performed for 
`registerUserKeys` now :)~
   Edit: nevermind, the error handling for `registerUserKeys` already shows the 
API exception (diff didn't show it). No need to change anything.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to