Migrate remaining gr-autocomplete usages from error dialog to dropdown.
Rest API failures currently show a dialog. With this change they will
show as dropdown introduced in https://gerrit-review.googlesource.com/c/gerrit/+/353121
After this change the only usages left will be in plugins.
Google-Bug-Id: b/257213270
Release-Notes: skip
Change-Id: Ie291529b38513ce6e9ca20abb95b860f2d1908a0
diff --git a/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor.ts b/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor.ts
index 15ec512..2996e50 100644
--- a/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor.ts
+++ b/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor.ts
@@ -21,6 +21,7 @@
import {when} from 'lit/directives/when.js';
import {fire} from '../../../utils/event-util';
import {PropertiesOfType} from '../../../utils/type-util';
+import {throwingErrorCallback} from '../../shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper';
type NotificationKey = PropertiesOfType<Required<ProjectWatchInfo>, boolean>;
@@ -193,13 +194,15 @@
// private but used in tests.
getProjectSuggestions(input: string) {
- return this.restApiService.getSuggestedRepos(input).then(response => {
- const repos: AutocompleteSuggestion[] = [];
- for (const [name, repo] of Object.entries(response ?? {})) {
- repos.push({name, value: repo.id});
- }
- return repos;
- });
+ return this.restApiService
+ .getSuggestedRepos(input, /* n=*/ undefined, throwingErrorCallback)
+ .then(response => {
+ const repos: AutocompleteSuggestion[] = [];
+ for (const [name, repo] of Object.entries(response ?? {})) {
+ repos.push({name, value: repo.id});
+ }
+ return repos;
+ });
}
private handleRemoveProject(project: ProjectWatchInfo) {