Address part of the performance problem with the type aheads by adding adding a delay (400ms for local data and 600ms for remote data).
Create a new end point at /typeahead-vocabulary-word/ for the Controlled Vocabulary.
This end point will perform a case-insensitive contains fetch, returning all matches.
The matches themselves are reduced in size by using newly created SimpleVocabularyWordView and ContactsVocabularyWordView.
There are two directives that that need to be updated, each with a slightly different structure.
For both cases, a standard typeAhead structure like the following is implemented:
The search is the search to use.
The loading is a boolean that designates whether or not the data is being asynchronously fetched.
The loading allows for future work in adding something like a spinner or locking the field from edits until a response is received.
The loading is otherwise not used or implemented before setting this up.
The list is the list that contains that fetched array.
The list is and should always be cleared using .length(0) rather than re-assignment because it is being asynchronously populated.
The list ends up being used as the select list drop down.
The ControlledVocabularyRepo is updated to contain the new function typeAhead() that fetches the needed data.
This function is wrapped in a defer promise so that the uib-typeahead knows that it is a callback and responds to the resolve() callback.
Being a type ahead, this should always return an array on success or failure.
On failure, an empty array is returned.
The Javascript unit tests are updated, adding tests for the new typeAhead.
It seems that the directives have not always been fully tested in the past.
This changes the mocking behavior to allow for the vocabulary repository to be mocked for potential testing in the directives.
There are currently no thorough directive units tests written and so figuring out how to do the directive unit tests is left for another time.
The Controlled Vocabulary Repository test is implemented and does do testing against the newly added typeAhead() repository method.
This does not address problems regarding the performance of the page loading and only addresses the type ahead performance problem.
This is left to another commit or PR as appropriate.
Warning: There is an existing bug where the contacts Field Value for any Field Predicate does not show up on fresh page load.
This is because the contacts in the FieldValue class is missing the needed @JsonView.
This should be fixed to get the functionality in this commit fully working as expected.
Partially resolves #1842
Address part of the performance problem with the type aheads by adding adding a delay (400ms for local data and 600ms for remote data). Create a new end point at
/typeahead-vocabulary-word/
for the Controlled Vocabulary. This end point will perform a case-insensitive contains fetch, returning all matches. The matches themselves are reduced in size by using newly createdSimpleVocabularyWordView
andContactsVocabularyWordView
.There are two directives that that need to be updated, each with a slightly different structure. For both cases, a standard
typeAhead
structure like the following is implemented:The
search
is the search to use. Theloading
is a boolean that designates whether or not the data is being asynchronously fetched. Theloading
allows for future work in adding something like a spinner or locking the field from edits until a response is received. Theloading
is otherwise not used or implemented before setting this up. Thelist
is the list that contains that fetched array. Thelist
is and should always be cleared using.length(0)
rather than re-assignment because it is being asynchronously populated. Thelist
ends up being used as the select list drop down.The
ControlledVocabularyRepo
is updated to contain the new functiontypeAhead()
that fetches the needed data. This function is wrapped in a defer promise so that theuib-typeahead
knows that it is a callback and responds to theresolve()
callback. Being a type ahead, this should always return an array on success or failure. On failure, an empty array is returned.The Javascript unit tests are updated, adding tests for the new typeAhead. It seems that the directives have not always been fully tested in the past. This changes the mocking behavior to allow for the vocabulary repository to be mocked for potential testing in the directives. There are currently no thorough directive units tests written and so figuring out how to do the directive unit tests is left for another time. The Controlled Vocabulary Repository test is implemented and does do testing against the newly added
typeAhead()
repository method.This does not address problems regarding the performance of the page loading and only addresses the type ahead performance problem. This is left to another commit or PR as appropriate.
Warning: There is an existing bug where the contacts Field Value for any Field Predicate does not show up on fresh page load. This is because the
contacts
in theFieldValue
class is missing the needed@JsonView
. This should be fixed to get the functionality in this commit fully working as expected.The fix needs only be the following: