@@ -61,6 +61,13 @@ const ListKeys = () => {
61
61
const deleteKey = hasPermission ( CONSOLE_UI_RESOURCE , [
62
62
IAM_SCOPES . KMS_DELETE_KEY ,
63
63
] ) ;
64
+ const createKey = hasPermission ( CONSOLE_UI_RESOURCE , [
65
+ IAM_SCOPES . KMS_CREATE_KEY ,
66
+ ] ) ;
67
+
68
+ const importKey = hasPermission ( CONSOLE_UI_RESOURCE , [
69
+ IAM_SCOPES . KMS_IMPORT_KEY ,
70
+ ] ) ;
64
71
65
72
const displayKeys = hasPermission ( CONSOLE_UI_RESOURCE , [
66
73
IAM_SCOPES . KMS_LIST_KEYS ,
@@ -111,14 +118,15 @@ const ListKeys = () => {
111
118
}
112
119
} ;
113
120
114
- const tableActions = [
115
- {
121
+ const tableActions : any [ ] = [ ] ;
122
+ if ( deleteKey ) {
123
+ tableActions . push ( {
116
124
type : "delete" ,
117
125
onClick : confirmDeleteKey ,
118
126
sendOnlyId : true ,
119
127
disableButtonFunction : ( ) => ! deleteKey ,
120
- } ,
121
- ] ;
128
+ } ) ;
129
+ }
122
130
123
131
useEffect ( ( ) => {
124
132
dispatch ( setHelpName ( "list_keys" ) ) ;
@@ -178,39 +186,43 @@ const ListKeys = () => {
178
186
/>
179
187
</ TooltipWrapper >
180
188
</ SecureComponent >
181
- < SecureComponent
182
- scopes = { [ IAM_SCOPES . KMS_IMPORT_KEY ] }
183
- resource = { CONSOLE_UI_RESOURCE }
184
- errorProps = { { disabled : true } }
185
- >
186
- < TooltipWrapper tooltip = { "Import Key" } >
187
- < Button
188
- id = { "import-key" }
189
- variant = { "regular" }
190
- icon = { < UploadIcon /> }
191
- onClick = { ( ) => {
192
- navigate ( IAM_PAGES . KMS_KEYS_IMPORT ) ;
193
- } }
194
- />
195
- </ TooltipWrapper >
196
- </ SecureComponent >
197
- < SecureComponent
198
- scopes = { [ IAM_SCOPES . KMS_CREATE_KEY ] }
199
- resource = { CONSOLE_UI_RESOURCE }
200
- errorProps = { { disabled : true } }
201
- >
202
- < TooltipWrapper tooltip = { "Create Key" } >
203
- < Button
204
- id = { "create-key" }
205
- label = { "Create Key" }
206
- variant = { "callAction" }
207
- icon = { < AddIcon /> }
208
- onClick = { ( ) => navigate ( IAM_PAGES . KMS_KEYS_ADD ) }
209
- />
210
- </ TooltipWrapper >
211
- </ SecureComponent >
189
+ { importKey ? (
190
+ < SecureComponent
191
+ scopes = { [ IAM_SCOPES . KMS_IMPORT_KEY ] }
192
+ resource = { CONSOLE_UI_RESOURCE }
193
+ errorProps = { { disabled : true } }
194
+ >
195
+ < TooltipWrapper tooltip = { "Import Key" } >
196
+ < Button
197
+ id = { "import-key" }
198
+ variant = { "regular" }
199
+ icon = { < UploadIcon /> }
200
+ onClick = { ( ) => {
201
+ navigate ( IAM_PAGES . KMS_KEYS_IMPORT ) ;
202
+ } }
203
+ />
204
+ </ TooltipWrapper >
205
+ </ SecureComponent >
206
+ ) : null }
207
+ { createKey ? (
208
+ < SecureComponent
209
+ scopes = { [ IAM_SCOPES . KMS_CREATE_KEY ] }
210
+ resource = { CONSOLE_UI_RESOURCE }
211
+ errorProps = { { disabled : true } }
212
+ >
213
+ < TooltipWrapper tooltip = { "Create Key" } >
214
+ < Button
215
+ id = { "create-key" }
216
+ label = { "Create Key" }
217
+ variant = { "callAction" }
218
+ icon = { < AddIcon /> }
219
+ onClick = { ( ) => navigate ( IAM_PAGES . KMS_KEYS_ADD ) }
220
+ />
221
+ </ TooltipWrapper >
222
+ </ SecureComponent >
223
+ ) : null }
212
224
</ Grid >
213
- < Grid item xs = { 12 } >
225
+ < Grid item xs = { 12 } sx = { { marginTop : "5px" } } >
214
226
< SecureComponent
215
227
scopes = { [ IAM_SCOPES . KMS_LIST_KEYS ] }
216
228
resource = { CONSOLE_UI_RESOURCE }
0 commit comments