mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-16 15:45:04 +08:00
Filter the tool shed user select from the loaded users
SelectUser copied the user list into its options when it was set up, before GET /api/users returned, and only re-copied it for an empty filter. Typing a name into the select before the users arrived filtered the empty copy and never showed the user. test_frontend_push_access failed this way in both standalone tool shed jobs. The options are now computed from the users and the filter text.
This commit is contained in:
@@ -20,8 +20,11 @@ void usersStore.getAll()
|
||||
|
||||
const { users } = storeToRefs(usersStore)
|
||||
|
||||
const allOptions = computed(() => users?.value.map((u) => u.username))
|
||||
const options = ref(allOptions.value)
|
||||
const needle = ref("")
|
||||
// Computed rather than copied on filter, so users loaded after the menu opened still show up.
|
||||
const options = computed(() =>
|
||||
users.value.map((u) => u.username).filter((v) => v.toLocaleLowerCase().indexOf(needle.value) > -1),
|
||||
)
|
||||
const selected = ref(null)
|
||||
|
||||
const emit = defineEmits(["selectedUser", "cleared"])
|
||||
@@ -39,11 +42,7 @@ watch(selected, (user) => {
|
||||
|
||||
function filterFn(val: string, update: (cbFn: () => void) => void) {
|
||||
update(() => {
|
||||
const needle = val.toLocaleLowerCase()
|
||||
if (needle == "") {
|
||||
options.value = allOptions.value
|
||||
}
|
||||
options.value = options.value.filter((v) => v.toLocaleLowerCase().indexOf(needle) > -1)
|
||||
needle.value = val.toLocaleLowerCase()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user