Merge branch 'stable-3.0'

* stable-3.0:
  Replace bazel-genfiles with bazel-bin in documentation
  Upgrade bazlets to latest stable-3.0 to build with 3.0.3 API
  Bump bazel version to 1.0.0
  [ui] add a scrollbar when the overlay is too big
  Add autocomplete for groups
  Upgrade bazlets to latest stable-2.15 to build with 2.15.17 API

Change-Id: Ibeac8499b24b984a885c85397e77369930337662
diff --git a/.bazelversion b/.bazelversion
index 25939d3..3eefcb9 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-0.29.1
+1.0.0
diff --git a/rv-reviewers/rv-edit-screen.html b/rv-reviewers/rv-edit-screen.html
index ca32849..3291e3c 100644
--- a/rv-reviewers/rv-edit-screen.html
+++ b/rv-reviewers/rv-edit-screen.html
@@ -56,6 +56,7 @@
                   reviewers="[[section.reviewers]]"
                   editing="[[section.editing]]"
                   reviewers-url="[[_getReviewersUrl(repoName)]]"
+                  repo-name="[[repoName]]"
                   plugin-rest-api="[[pluginRestApi]]"
                   can-modify-config="[[canModifyConfig]]"
                   on-reviewer-changed="_handleReviewerChanged"></rv-filter-section>
diff --git a/rv-reviewers/rv-filter-section.html b/rv-reviewers/rv-filter-section.html
index a35e130..7513675 100644
--- a/rv-reviewers/rv-filter-section.html
+++ b/rv-reviewers/rv-filter-section.html
@@ -84,6 +84,7 @@
                 reviewer="{{item}}"
                 can-modify-config="[[canModifyConfig]]"
                 plugin-rest-api="[[pluginRestApi]]"
+                repo-name="[[repoName]]"
                 on-reviewer-deleted="_handleReviewerDeleted"
                 on-reviewer-added="_handleReviewerAdded">
             </rv-reviewer>
diff --git a/rv-reviewers/rv-filter-section.js b/rv-reviewers/rv-filter-section.js
index 0ca36dc..110c27d 100644
--- a/rv-reviewers/rv-filter-section.js
+++ b/rv-reviewers/rv-filter-section.js
@@ -17,6 +17,7 @@
 
     properties: {
       pluginRestApi: Object,
+      repoName: String,
       reviewers: Array,
       filter: String,
       canModifyConfig: Boolean,
diff --git a/rv-reviewers/rv-reviewer.js b/rv-reviewers/rv-reviewer.js
index a8da113..0c8adde 100644
--- a/rv-reviewers/rv-reviewer.js
+++ b/rv-reviewers/rv-reviewer.js
@@ -18,12 +18,13 @@
     properties: {
       canModifyConfig: Boolean,
       pluginRestAPi: Object,
+      repoName: String,
       reviewer: String,
       _reviewerSearchId: String,
       _queryReviewers: {
         type: Function,
         value() {
-          return this._getAccountSuggestions.bind(this);
+          return this._getReviewerSuggestions.bind(this);
         },
       },
       _originalReviewer: String,
@@ -63,41 +64,61 @@
       return !canModifyConfig;
     },
 
-    _getAccountSuggestions(input) {
+    _getReviewerSuggestions(input) {
       if (input.length === 0) { return Promise.resolve([]); }
-      return this._getSuggestedAccounts(
-          input).then(accounts => {
-            const accountSuggestions = [];
-            let nameAndEmail;
-            let value;
-            if (!accounts) { return []; }
-            for (const key in accounts) {
-              if (!accounts.hasOwnProperty(key)) { continue; }
-              if (accounts[key].email) {
-                nameAndEmail = accounts[key].name +
-                  ' <' + accounts[key].email + '>';
-              } else {
-                nameAndEmail = accounts[key].name;
-              }
-              if (accounts[key].username) {
-                value = accounts[key].username;
-              } else if (accounts[key].email) {
-                value = accounts[key].email;
-              } else {
-                value = accounts[key]._account_id;
-              }
-              accountSuggestions.push({
-                name: nameAndEmail,
-                value,
-              });
-            }
-            return accountSuggestions;
+      const promises = [];
+      promises.push(this._getSuggestedGroups(input));
+      promises.push(this._getSuggestedAccounts(input));
+      return Promise.all(promises).then(result => {
+        return result.flat();
+      });
+    },
+
+    _getSuggestedGroups(input) {
+      const suggestUrl = `/groups/?suggest=${input}&p=${this.repoName}`;
+      return this.pluginRestApi.get(suggestUrl).then(groups => {
+        if (!groups) { return []; }
+        const groupSuggestions = [];
+        for (const key in groups) {
+          if (!groups.hasOwnProperty(key)) { continue; }
+          groupSuggestions.push({
+            name: key,
+            value: key,
           });
+        }
+        return groupSuggestions;
+      });
     },
 
     _getSuggestedAccounts(input) {
       const suggestUrl = `/accounts/?suggest&q=${input}`;
-      return this.pluginRestApi.get(suggestUrl);
+      return this.pluginRestApi.get(suggestUrl).then(accounts => {
+        const accountSuggestions = [];
+        let nameAndEmail;
+        let value;
+        if (!accounts) { return []; }
+        for (const key in accounts) {
+          if (!accounts.hasOwnProperty(key)) { continue; }
+          if (accounts[key].email) {
+            nameAndEmail = accounts[key].name +
+              ' <' + accounts[key].email + '>';
+          } else {
+            nameAndEmail = accounts[key].name;
+          }
+          if (accounts[key].username) {
+            value = accounts[key].username;
+          } else if (accounts[key].email) {
+            value = accounts[key].email;
+          } else {
+            value = accounts[key]._account_id;
+          }
+          accountSuggestions.push({
+            name: nameAndEmail,
+            value,
+          });
+        }
+        return accountSuggestions;
+      });
     },
 
     _handleDeleteCancel() {
diff --git a/rv-reviewers/rv-reviewers.html b/rv-reviewers/rv-reviewers.html
index dcf890d..f44aa6f 100644
--- a/rv-reviewers/rv-reviewers.html
+++ b/rv-reviewers/rv-reviewers.html
@@ -21,6 +21,7 @@
     <style include="shared-styles">
       #rvScreenOverlay {
         width: 50em;
+        overflow: auto;
       }
     </style>
     <gr-repo-command
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index 156e88b..904dc97 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -16,7 +16,7 @@
 The output is created in
 
 ```
-  bazel-genfiles/@PLUGIN@.jar
+  bazel-bin/@PLUGIN@.jar
 ```
 
 To execute the tests run:
@@ -40,7 +40,7 @@
 The output is created in
 
 ```
-  bazel-genfiles/plugins/@PLUGIN@/@PLUGIN@.jar
+  bazel-bin/plugins/@PLUGIN@/@PLUGIN@.jar
 ```
 
 To execute the tests run: