Do not place all owners on a new line if number of all owners is small
Change-Id: I6eef087eec8021413289786685c9ad830dbdd3e0
diff --git a/ui/suggest-owners.js b/ui/suggest-owners.js
index a442421..781f64b 100644
--- a/ui/suggest-owners.js
+++ b/ui/suggest-owners.js
@@ -15,7 +15,11 @@
* limitations under the License.
*/
import {CodeOwnersModelMixin} from './code-owners-model-mixin.js';
-import {SuggestionsState, SuggestionsType} from './code-owners-model.js';
+import {
+ BestSuggestionsLimit,
+ SuggestionsState,
+ SuggestionsType,
+} from './code-owners-model.js';
import {getDisplayOwnersGroups} from './suggest-owners-util.js';
const SUGGESTION_POLLING_INTERVAL = 1000;
@@ -304,7 +308,7 @@
</div>
</template>
<template is="dom-if" if="[[!suggestion.owners.owned_by_all_users]]">
- <template is="dom-if" if="[[_showAllOwners]]">
+ <template is="dom-if" if="[[_breakBeforeOwners(suggestion.owners.code_owners, _showAllOwners)]]">
<div class="flex-break"></div>
</template>
<ul class="suggested-owners">
@@ -668,6 +672,11 @@
this.model.setSelectedSuggestionType(showAll ?
SuggestionsType.ALL_SUGGESTIONS : SuggestionsType.BEST_SUGGESTIONS);
}
+
+ _breakBeforeOwners(codeOwners, showAllOwners) {
+ if (!codeOwners || !showAllOwners) return false;
+ return codeOwners.length > BestSuggestionsLimit;
+ }
}
customElements.define(SuggestOwners.is, SuggestOwners);