Skip to content

Commit 88231b3

Browse files
create method for parsing listAccounts response
1 parent 475c83e commit 88231b3

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

ui/src/views/project/AddAccountOrUserToProject.vue

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@
3232
<tooltip-label :title="$t('label.account')" :tooltip="apiParams.addAccountToProject.account.description"/>
3333
</template>
3434
<a-auto-complete
35-
show-search
3635
v-model:value="form.account"
3736
:placeholder="apiParams.addAccountToProject.account.description"
38-
v-focus="true"
3937
:filterOption="filterOption"
4038
:options="accounts"
4139
>
@@ -278,21 +276,25 @@ export default {
278276
params.keyword = keyword
279277
}
280278
api('listAccounts', params).then(response => {
281-
this.accounts = response.listaccountsresponse.account || []
282-
if (this.accounts.length > 0) {
283-
this.accounts = this.accounts.map(account => {
284-
return {
285-
value: account.name,
286-
...account
287-
}
288-
})
289-
}
279+
this.accounts = this.parseAccounts(response.listaccountsresponse.account)
290280
}).catch(error => {
291281
this.$notifyError(error)
292282
}).finally(() => {
293283
this.load.accounts = false
294284
})
295285
},
286+
parseAccounts (accounts) {
287+
if (!accounts) {
288+
return []
289+
}
290+
291+
return accounts.map(account => {
292+
return {
293+
value: account.name,
294+
icon: account.icon
295+
}
296+
})
297+
},
296298
fetchProjectRoles () {
297299
this.load.projectRoles = true
298300
api('listProjectRoles', {

0 commit comments

Comments
 (0)