Skip to content

Commit 475c83e

Browse files
allow to select and enter values into the input field
1 parent 03bdf11 commit 475c83e

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

ui/src/views/project/AddAccountOrUserToProject.vue

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,25 @@
3131
<template #label>
3232
<tooltip-label :title="$t('label.account')" :tooltip="apiParams.addAccountToProject.account.description"/>
3333
</template>
34-
<a-select
34+
<a-auto-complete
3535
show-search
3636
v-model:value="form.account"
3737
:placeholder="apiParams.addAccountToProject.account.description"
3838
v-focus="true"
39-
:filterOption="false"
40-
@search="fetchAccounts"
41-
>
42-
<template v-if="load.accounts" #notFoundContent>
43-
<a-spin size="small" />
44-
</template>
45-
<template v-if="!load.accounts">
46-
<a-select-option v-for="account in accounts" :key="account.name" :value="account.name">
47-
<span v-if="account.icon">
48-
<resource-icon :image="account.icon.base64image" size="1x" style="margin-right: 5px"/>
49-
</span>
50-
<block-outlined v-else style="margin-right: 5px" />
51-
{{ account.name }}
52-
</a-select-option>
53-
</template>
54-
</a-select>
39+
:filterOption="filterOption"
40+
:options="accounts"
41+
>
42+
<template v-if="load.accounts" #notFoundContent>
43+
<a-spin size="small" />
44+
</template>
45+
<template v-if="!load.accounts" #option="item">
46+
<span v-if="item.icon">
47+
<resource-icon :image="item.icon.base64image" size="1x" style="margin-right: 5px"/>
48+
</span>
49+
<block-outlined v-else style="margin-right: 5px" />
50+
{{ item.value }}
51+
</template>
52+
</a-auto-complete>
5553
</a-form-item>
5654
<a-form-item name="email" ref="email">
5755
<template #label>
@@ -254,6 +252,11 @@ export default {
254252
this.fetchProjectRoles()
255253
}
256254
},
255+
filterOption (input, option) {
256+
return (
257+
option.value.toUpperCase().indexOf(input.toUpperCase()) >= 0
258+
)
259+
},
257260
fetchUsers (keyword) {
258261
this.load.users = true
259262
const params = { listall: true, showicon: true }
@@ -276,6 +279,14 @@ export default {
276279
}
277280
api('listAccounts', params).then(response => {
278281
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+
}
279290
}).catch(error => {
280291
this.$notifyError(error)
281292
}).finally(() => {

0 commit comments

Comments
 (0)