Continue offering "Suggest" tool when OWNERS are already met

Change-Id: Ic3f7983cbec64ff96b37066acfed50c2f15b501a
diff --git a/ui/code-owners-fetcher.js b/ui/code-owners-fetcher.js
index 61e362b..6fd5b35 100644
--- a/ui/code-owners-fetcher.js
+++ b/ui/code-owners-fetcher.js
@@ -170,20 +170,21 @@
 
   _getFilesToFetch(codeOwnerStatusMap) {
     // only fetch those not approved yet
-    const filesGroupByStatus = [...codeOwnerStatusMap.keys()].reduce(
-        (list, file) => {
-          const status = codeOwnerStatusMap
-              .get(file).status;
-          if (status === OwnerStatus.INSUFFICIENT_REVIEWERS) {
-            list.missing.push(file);
-          } else if (status === OwnerStatus.PENDING) {
-            list.pending.push(file);
-          }
+    const filesGroupByStatus = [...codeOwnerStatusMap.entries()].reduce(
+        (list, [file, fileInfo]) => {
+          if (list[fileInfo.status]) list[fileInfo.status].push(file);
           return list;
         }
-        , {pending: [], missing: []});
-    // always fetch INSUFFICIENT_REVIEWERS first and then pending
-    return filesGroupByStatus.missing.concat(filesGroupByStatus.pending);
+        , {
+          [OwnerStatus.PENDING]: [],
+          [OwnerStatus.INSUFFICIENT_REVIEWERS]: [],
+          [OwnerStatus.APPROVED]: [],
+        }
+    );
+    // always fetch INSUFFICIENT_REVIEWERS first, then pending and then approved
+    return filesGroupByStatus[OwnerStatus.INSUFFICIENT_REVIEWERS]
+        .concat(filesGroupByStatus[OwnerStatus.PENDING])
+        .concat(filesGroupByStatus[OwnerStatus.APPROVED]);
   }
 
   pause() {
diff --git a/ui/owner-requirement.js b/ui/owner-requirement.js
index b506a8b..a173c75 100644
--- a/ui/owner-requirement.js
+++ b/ui/owner-requirement.js
@@ -74,11 +74,9 @@
                     title="Documentation for overriding code owners"></iron-icon>
                 </a>
               </template>
-              <template is="dom-if" if="[[!_allApproved]]">
-                <gr-button link on-click="_openReplyDialog">
-                Suggest owners
+              <gr-button link on-click="_openReplyDialog">
+                [[_getSuggestOwnersText(_statusCount)]]
               </gr-button>
-              </template>
             </template>
             <template is="dom-if" if="[[model.branchConfig.no_code_owners_defined]]">                
               <span>No code-owners file</span>
@@ -106,10 +104,6 @@
         computed: '_computeIsLoading(model.branchConfig, model.status, '
             + 'model.userRole, model.pluginStatus)',
       },
-      _allApproved: {
-        type: Boolean,
-        computed: '_computeAllApproved(_statusCount)',
-      },
       _isOverriden: {
         type: Boolean,
         computed: '_computeIsOverriden(change, model.branchConfig)',
@@ -171,8 +165,7 @@
       return false;
     }
 
-
-    for(const requiredApprovalInfo of branchConfig['override_approval']) {
+    for (const requiredApprovalInfo of branchConfig['override_approval']) {
       const overridenLabel = requiredApprovalInfo.label;
       const overridenValue = Number(requiredApprovalInfo.value);
       if (isNaN(overridenValue)) continue;
@@ -189,9 +182,9 @@
     return false;
   }
 
-  _computeAllApproved(statusCount) {
-    return statusCount && statusCount.missing === 0
-            && statusCount.pending === 0;
+  _getSuggestOwnersText(statusCount) {
+    return statusCount && statusCount.missing === 0 ?
+      'Add owners' : 'Suggest owners';
   }
 
   _getStatusCount(rawStatuses) {
diff --git a/ui/suggest-owners-trigger.js b/ui/suggest-owners-trigger.js
index 97f616d..05b01a5 100644
--- a/ui/suggest-owners-trigger.js
+++ b/ui/suggest-owners-trigger.js
@@ -27,8 +27,7 @@
     return {
       hidden: {
         type: Boolean,
-        computed: '_computeHidden(model.pluginStatus,' +
-            'model.areAllFilesApproved, model.userRole, model.branchConfig)',
+        computed: '_computeHidden(model.pluginStatus, model.branchConfig)',
         reflectToAttribute: true,
       },
     };
@@ -74,19 +73,12 @@
     this.modelLoader.loadBranchConfig();
   }
 
-  _computeHidden(pluginStatus, allFilesApproved, userRole, branchConfig) {
-    if (pluginStatus === undefined ||
-        allFilesApproved === undefined ||
-        userRole === undefined ||
-        branchConfig === undefined) {
+  _computeHidden(pluginStatus, branchConfig) {
+    if (pluginStatus === undefined || branchConfig === undefined) {
       return true;
     }
-    if (branchConfig.no_code_owners_defined) return true;
-    if (pluginStatus.state === PluginState.Enabled) {
-      return allFilesApproved;
-    } else {
-      return true;
-    }
+    return !!branchConfig.no_code_owners_defined ||
+        pluginStatus.state !== PluginState.Enabled;
   }
 
   toggleControlContent() {
diff --git a/ui/suggest-owners.js b/ui/suggest-owners.js
index 781f64b..1233bd5 100644
--- a/ui/suggest-owners.js
+++ b/ui/suggest-owners.js
@@ -352,8 +352,7 @@
         type: Boolean,
         value: true,
         reflectToAttribute: true,
-        computed: '_isHidden(model.areAllFilesApproved, ' +
-            'model.showSuggestions)',
+        computed: '_isHidden(model.showSuggestions)',
       },
       suggestedOwners: Array,
       isLoading: {
@@ -470,10 +469,8 @@
     this.isLoading = state === SuggestionsState.Loading;
   }
 
-  _isHidden(allFilesApproved, showSuggestions) {
-    if (!showSuggestions) return true;
-    // if all approved, no need to show the container
-    return allFilesApproved === undefined || !!allFilesApproved;
+  _isHidden(showSuggestions) {
+    return !showSuggestions;
   }
 
   loadPropertiesAfterModelChanged() {