Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Minimum Character Length for Autocomplete in "Freigabe" and in "Workflow" #75

Open
wants to merge 3 commits into
base: maven/develop
Choose a base branch
from

Conversation

Edmondi-Kacaj
Copy link
Contributor

This update introduces the ability for administrators to specify the minimum number of characters required for autocomplete suggestions in the "Freigabe" and "Workflow" panels. With this enhancement, users will only see suggestions that match the initial characters they enter.

We aim to include this implementation in either version 8.1 or 9.0.

Identification of Dead Code

In the AuthoritySearchInputComponent, we have two sections of code:

this.suggestionGroups$ = this.input.valueChanges.pipe(
    startWith(''),
    debounceTime(500),
    filter(() => {
        if (this.input.value?.length < 2) {
            this.suggestionLoading.next(false);
            return false;
        }
        return true;
    }),
    tap(() => this.suggestionLoading.next(true)),
    switchMap((value) => this.getSuggestions(value)),
    tap(() => this.suggestionLoading.next(false)),
);

and also

getSuggestions(inputValue: string): Observable<SuggestionGroup[]> {
    if (inputValue.length < 2) {
        if (this.showRecent && this.restConnector.getCurrentLogin()?.currentScope == null) {
            return this.getRecentSuggestions();
        } else {
            return of(null);
        }
    } else {
        switch (this.mode) {
            case AuthoritySearchMode.Users:
                return this.getUsersSuggestions(inputValue);
            case AuthoritySearchMode.UsersAndGroups:
                return this.getUsersAndGroupsSuggestions(inputValue);
            case AuthoritySearchMode.Organizations:
                return this.getOrganizationsSuggestions(inputValue);
        }
    }
}

Upon review, looks like the code inside the if block in the getSuggestions

method will never be executed due to the condition in the first part of the code block.

P.S: The logic, for this pull request, has been implemented in both sections.

@Edmondi-Kacaj
Copy link
Contributor Author

Hello @torsten-simon, any news about this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant