Let users know if no code owners are defined yet

As explained in [1] we have a special bootstrapping behaviour for
code-owners if
- the code owners functionality is enabled (and hence code owner
  approvals are required) and
- no code owners are defined yet (branch doesn't contain any OWNERS
  file yet)

In this case to submit a change the change owner either needs a code
owner override or an approval from a project owner. Currently users are
not aware of this, and the frontend should inform the users about this,
e.g. show this info as a message to the user when they try to get code
owners suggested. Since there are no code owners defined yet, we cannot
suggest any code owners and hence the suggestion is always empty in this
situation.

The Get Code Owner Branch Config REST endpoint was updated to include a
flag for this [2].

[1] https://gerrit-review.googlesource.com/c/plugins/code-owners/+/286639/2/resources/Documentation/user-guide.md
[2] https://gerrit-review.googlesource.com/c/plugins/code-owners/+/286473/2/resources/Documentation/rest-api.md





Change-Id: Ia09cc5f43e1ed0684f4b443932356dd26107982d
diff --git a/ui/owner-requirement.js b/ui/owner-requirement.js
index 230577c..d08bacc 100644
--- a/ui/owner-requirement.js
+++ b/ui/owner-requirement.js
@@ -64,19 +64,28 @@
           Loading status ...
         </p>
         <template is="dom-if" if="[[!_isLoading]]">
-          <template is="dom-if" if="[[!_pluginFailed(model.pluginStatus)]]">  
-            <span>[[_computeStatusText(_statusCount, _isOverriden)]]</span>
-            <template is="dom-if" if="[[_overrideInfoUrl]]">
-              <a on-click="_reportDocClick" href="[[_overrideInfoUrl]]"
-                target="_blank">
-                <iron-icon icon="gr-icons:help-outline"
-                  title="Documentation for overriding code owners"></iron-icon>
-              </a>
+          <template is="dom-if" if="[[!_pluginFailed(model.pluginStatus)]]">
+            <template is="dom-if" if="[[!model.branchConfig.no_code_owners_defined]]">              
+              <span>[[_computeStatusText(_statusCount, _isOverriden)]]</span>
+              <template is="dom-if" if="[[_overrideInfoUrl]]">
+                <a on-click="_reportDocClick" href="[[_overrideInfoUrl]]"
+                  target="_blank">
+                  <iron-icon icon="gr-icons:help-outline"
+                    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>
+              </template>
             </template>
-            <template is="dom-if" if="[[!_allApproved]]">
-              <gr-button link on-click="_openReplyDialog">
-              Suggest owners
-            </gr-button>
+            <template is="dom-if" if="[[model.branchConfig.no_code_owners_defined]]">                
+              <span>No code-owners file</span>
+              <a href="https://gerrit.googlesource.com/plugins/code-owners/+/master/resources/Documentation/user-guide.md#how-to-submit-changes-with-files-that-have-no-code-owners" target="_blank">
+                <iron-icon icon="gr-icons:help-outline"
+                  title="Documentation about submitting changes with files that have no code owners?"></iron-icon>
+              </a>
             </template>
           </template>
           <template is="dom-if" if="[[_pluginFailed(model.pluginStatus)]]">
diff --git a/ui/suggest-owners-trigger.js b/ui/suggest-owners-trigger.js
index 544c956..97f616d 100644
--- a/ui/suggest-owners-trigger.js
+++ b/ui/suggest-owners-trigger.js
@@ -28,7 +28,7 @@
       hidden: {
         type: Boolean,
         computed: '_computeHidden(model.pluginStatus,' +
-            'model.areAllFilesApproved, model.userRole)',
+            'model.areAllFilesApproved, model.userRole, model.branchConfig)',
         reflectToAttribute: true,
       },
     };
@@ -71,14 +71,17 @@
     this.modelLoader.loadUserRole();
     this.modelLoader.loadPluginStatus();
     this.modelLoader.loadAreAllFilesApproved();
+    this.modelLoader.loadBranchConfig();
   }
 
-  _computeHidden(pluginStatus, allFilesApproved, userRole) {
+  _computeHidden(pluginStatus, allFilesApproved, userRole, branchConfig) {
     if (pluginStatus === undefined ||
         allFilesApproved === undefined ||
-        userRole === undefined) {
+        userRole === undefined ||
+        branchConfig === undefined) {
       return true;
     }
+    if (branchConfig.no_code_owners_defined) return true;
     if (pluginStatus.state === PluginState.Enabled) {
       return allFilesApproved;
     } else {