@@ -34,7 +34,7 @@ const SSH_KEY_DOCUMENTATION = 'https://developers.clever-cloud.com/doc/account/s
34
34
*/
35
35
const SKELETON_KEYS = [
36
36
{
37
- state : 'idle' ,
37
+ type : 'idle' ,
38
38
name : fakeString ( 15 ) ,
39
39
fingerprint : fakeString ( 32 ) ,
40
40
} ,
@@ -55,7 +55,7 @@ class SshPublicKeyValidator {
55
55
}
56
56
57
57
/**
58
- * @typedef {import('./cc-ssh-key-list.types.js').KeyDataState } KeyDataState
58
+ * @typedef {import('./cc-ssh-key-list.types.js').SshKeyListState } SshKeyListState
59
59
* @typedef {import('./cc-ssh-key-list.types.js').SshKeyState } SshKeyState
60
60
* @typedef {import('./cc-ssh-key-list.types.js').CreateSshKeyFormState } CreateSshKeyFormState
61
61
* @typedef {import('./cc-ssh-key-list.types.js').NewKey } NewKey
@@ -86,7 +86,7 @@ export class CcSshKeyList extends LitElement {
86
86
static get properties ( ) {
87
87
return {
88
88
createKeyFormState : { type : Object , attribute : false } ,
89
- keyData : { type : Object , attribute : 'key-data' } ,
89
+ keyListState : { type : Object , attribute : false } ,
90
90
} ;
91
91
}
92
92
@@ -96,8 +96,8 @@ export class CcSshKeyList extends LitElement {
96
96
/** @type {CreateSshKeyFormState } create key form state. */
97
97
this . createKeyFormState = { type : 'idle' } ;
98
98
99
- /** @type {KeyDataState } personal and GitHub lists of registered SSH keys. */
100
- this . keyData = { state : 'loading' } ;
99
+ /** @type {SshKeyListState } personal and GitHub lists of registered SSH keys. */
100
+ this . keyListState = { type : 'loading' } ;
101
101
102
102
/** @type {HTMLFormElementRef } */
103
103
this . _createFormRef = createRef ( ) ;
@@ -141,14 +141,14 @@ export class CcSshKeyList extends LitElement {
141
141
/** @param {SshKeyState } sshKeyState */
142
142
_onDeleteKey ( sshKeyState ) {
143
143
// removing state property that belongs to internal component implementation
144
- const { state, ...sshKey } = sshKeyState ;
144
+ const { type : state , ...sshKey } = sshKeyState ;
145
145
dispatchCustomEvent ( this , 'delete' , sshKey ) ;
146
146
}
147
147
148
148
/** @param {SshKeyState } sshKeyState */
149
149
_onImportKey ( sshKeyState ) {
150
150
// removing state property that belongs to internal component implementation
151
- const { state, ...sshKey } = sshKeyState ;
151
+ const { type : state , ...sshKey } = sshKeyState ;
152
152
dispatchCustomEvent ( this , 'import' , sshKey ) ;
153
153
}
154
154
@@ -169,26 +169,26 @@ export class CcSshKeyList extends LitElement {
169
169
<cc- block- section slot= "content-body" >
170
170
<div slot= "title" >
171
171
<span> ${ i18n ( 'cc-ssh-key-list.personal.title' ) } </ span>
172
- ${ this . keyData . state === 'loaded' && this . keyData . personalKeys . length > 2
173
- ? html ` <cc- badge circle> ${ this . keyData . personalKeys . length } </ cc- badge> `
172
+ ${ this . keyListState . type === 'loaded' && this . keyListState . personalKeys . length > 2
173
+ ? html ` <cc- badge circle> ${ this . keyListState . personalKeys . length } </ cc- badge> `
174
174
: '' }
175
175
</ div>
176
176
<div slot= "info" > ${ i18n ( 'cc-ssh-key-list.personal.info' ) } </ div>
177
177
178
- ${ this . keyData . state === 'loading' ? html ` ${ this . _renderKeyList ( 'skeleton' , SKELETON_KEYS ) } ` : '' }
179
- ${ this . keyData . state === 'loaded'
178
+ ${ this . keyListState . type === 'loading' ? html ` ${ this . _renderKeyList ( 'skeleton' , SKELETON_KEYS ) } ` : '' }
179
+ ${ this . keyListState . type === 'loaded'
180
180
? html `
181
- ${ this . keyData . personalKeys . length === 0
181
+ ${ this . keyListState . personalKeys . length === 0
182
182
? html `
183
183
<p class= "info-msg" id = "personal- keys- empty- msg" tabindex= "-1">
184
184
${ i18n ( 'cc-ssh-key-list.personal.empty' ) }
185
185
</ p>
186
186
`
187
187
: '' }
188
- ${ this . _renderKeyList ( 'personal' , this . keyData . personalKeys ) }
188
+ ${ this . _renderKeyList ( 'personal' , this . keyListState . personalKeys ) }
189
189
`
190
190
: '' }
191
- ${ this . keyData . state === 'error'
191
+ ${ this . keyListState . type === 'error'
192
192
? html ` <cc- not ice intent= "warning" message = "${ i18n ( 'cc-ssh-key-list.error.loading' ) } "> </ cc- not ice> `
193
193
: '' }
194
194
</ cc- block- section>
@@ -197,29 +197,31 @@ export class CcSshKeyList extends LitElement {
197
197
<cc- block- section slot= "content-body" >
198
198
<div slot= "title" >
199
199
<span> ${ i18n ( 'cc-ssh-key-list.github.title' ) } </ span>
200
- ${ this . keyData . state === 'loaded' && this . keyData . isGithubLinked && this . keyData . githubKeys . length > 2
201
- ? html ` <cc- badge circle> ${ this . keyData . githubKeys . length } </ cc- badge> `
200
+ ${ this . keyListState . type === 'loaded' &&
201
+ this . keyListState . isGithubLinked &&
202
+ this . keyListState . githubKeys . length > 2
203
+ ? html ` <cc- badge circle> ${ this . keyListState . githubKeys . length } </ cc- badge> `
202
204
: '' }
203
205
</ div>
204
206
<div slot= "info" > ${ i18n ( 'cc-ssh-key-list.github.info' ) } </ div>
205
207
206
- ${ this . keyData . state === 'loading' ? html ` ${ this . _renderKeyList ( 'skeleton' , SKELETON_KEYS ) } ` : '' }
207
- ${ this . keyData . state === 'loaded' && ! this . keyData . isGithubLinked
208
+ ${ this . keyListState . type === 'loading' ? html ` ${ this . _renderKeyList ( 'skeleton' , SKELETON_KEYS ) } ` : '' }
209
+ ${ this . keyListState . type === 'loaded' && ! this . keyListState . isGithubLinked
208
210
? html ` <p class= "info-msg" > ${ i18n ( 'cc-ssh-key-list.github.unlinked' ) } </ p> `
209
211
: '' }
210
- ${ this . keyData . state === 'loaded' && this . keyData . isGithubLinked
212
+ ${ this . keyListState . type === 'loaded' && this . keyListState . isGithubLinked
211
213
? html `
212
- ${ this . keyData . githubKeys . length === 0
214
+ ${ this . keyListState . githubKeys . length === 0
213
215
? html `
214
216
<p class= "info-msg" id = "github- keys- empty- msg" tabindex= "-1">
215
217
${ i18n ( 'cc-ssh-key-list.github.empty' ) }
216
218
</ p>
217
219
`
218
220
: '' }
219
- ${ this . _renderKeyList ( 'github' , this . keyData . githubKeys ) }
221
+ ${ this . _renderKeyList ( 'github' , this . keyListState . githubKeys ) }
220
222
`
221
223
: '' }
222
- ${ this . keyData . state === 'error'
224
+ ${ this . keyListState . type === 'error'
223
225
? html ` <cc- not ice intent= "warning" message = "${ i18n ( 'cc-ssh-key-list.error.loading' ) } "> </ cc- not ice> `
224
226
: '' }
225
227
</ cc- block- section>
@@ -285,7 +287,7 @@ export class CcSshKeyList extends LitElement {
285
287
( key ) => key . name ,
286
288
( key ) => {
287
289
const name = key . name ;
288
- const isWaiting = ! skeleton && key . state !== 'idle' ;
290
+ const isWaiting = ! skeleton && key . type !== 'idle' ;
289
291
const classes = {
290
292
'key--personal' : type === 'personal' ,
291
293
'key--github' : type === 'github' ,
0 commit comments