@@ -874,18 +874,18 @@ export class App {
874
874
} ;
875
875
}
876
876
877
- private addAccessKey ( ) {
878
- this . selectedServer . addAccessKey ( )
879
- . then ( async ( serverAccessKey : server . AccessKey ) => {
880
- const uiAccessKey = this . convertToUiAccessKey ( serverAccessKey ) ;
881
- ( await this . appRoot . getServerView ( this . appRoot . selectedServerId ) )
882
- . addAccessKey ( uiAccessKey ) ;
883
- this . appRoot . showNotification ( this . appRoot . localize ( 'notification-key-added' ) ) ;
884
- } )
885
- . catch ( ( error ) => {
886
- console . error ( `Failed to add access key: ${ error } ` ) ;
887
- this . appRoot . showError ( this . appRoot . localize ( 'error-key-add' ) ) ;
888
- } ) ;
877
+ private async addAccessKey ( ) {
878
+ const server = this . selectedServer ;
879
+ try {
880
+ const serverAccessKey = await server . addAccessKey ( ) ;
881
+ const uiAccessKey = this . convertToUiAccessKey ( serverAccessKey ) ;
882
+ const serverView = await this . appRoot . getServerView ( server . getId ( ) ) ;
883
+ serverView . addAccessKey ( uiAccessKey ) ;
884
+ this . appRoot . showNotification ( this . appRoot . localize ( 'notification-key-added' ) ) ;
885
+ } catch ( error ) {
886
+ console . error ( `Failed to add access key: ${ error } ` ) ;
887
+ this . appRoot . showError ( this . appRoot . localize ( 'error-key-add' ) ) ;
888
+ }
889
889
}
890
890
891
891
private renameAccessKey ( accessKeyId : string , newName : string , entry : polymer . Base ) {
@@ -1061,17 +1061,16 @@ export class App {
1061
1061
}
1062
1062
}
1063
1063
1064
- private removeAccessKey ( accessKeyId : string ) {
1065
- this . selectedServer . removeAccessKey ( accessKeyId )
1066
- . then ( async ( ) => {
1067
- ( await this . appRoot . getServerView ( this . appRoot . selectedServerId ) )
1068
- . removeAccessKey ( accessKeyId ) ;
1069
- this . appRoot . showNotification ( this . appRoot . localize ( 'notification-key-removed' ) ) ;
1070
- } )
1071
- . catch ( ( error ) => {
1072
- console . error ( `Failed to remove access key: ${ error } ` ) ;
1073
- this . appRoot . showError ( this . appRoot . localize ( 'error-key-remove' ) ) ;
1074
- } ) ;
1064
+ private async removeAccessKey ( accessKeyId : string ) {
1065
+ const server = this . selectedServer ;
1066
+ try {
1067
+ await server . removeAccessKey ( accessKeyId ) ;
1068
+ ( await this . appRoot . getServerView ( server . getId ( ) ) ) . removeAccessKey ( accessKeyId ) ;
1069
+ this . appRoot . showNotification ( this . appRoot . localize ( 'notification-key-removed' ) ) ;
1070
+ } catch ( error ) {
1071
+ console . error ( `Failed to remove access key: ${ error } ` ) ;
1072
+ this . appRoot . showError ( this . appRoot . localize ( 'error-key-remove' ) ) ;
1073
+ }
1075
1074
}
1076
1075
1077
1076
private deleteServer ( serverId : string ) {
0 commit comments