Display message when no changes are available
Message is kept unspecific since it can be shown because of search
query with no matches or dashboard group with no items.
Change-Id: I02020aa51651e6a2c1c8a72908ce2fc5bd77bd73
diff --git a/polygerrit-ui/app/elements/gr-change-list.html b/polygerrit-ui/app/elements/gr-change-list.html
index e1d2a4e..c11800e 100644
--- a/polygerrit-ui/app/elements/gr-change-list.html
+++ b/polygerrit-ui/app/elements/gr-change-list.html
@@ -49,6 +49,9 @@
<template is="dom-if" if="[[_groupTitle(groupIndex)]]">
<div class="groupHeader">[[_groupTitle(groupIndex)]]</div>
</template>
+ <template is="dom-if" if="[[!changeGroup.length]]">
+ <div class="noChanges">No changes</div>
+ </template>
<template is="dom-repeat" items="[[changeGroup]]" as="change">
<gr-change-list-item
selected$="[[_computeItemSelected(index, groupIndex, selectedIndex)]]"
diff --git a/polygerrit-ui/app/styles/gr-change-list-styles.html b/polygerrit-ui/app/styles/gr-change-list-styles.html
index 1edcfaa..5179ac2 100644
--- a/polygerrit-ui/app/styles/gr-change-list-styles.html
+++ b/polygerrit-ui/app/styles/gr-change-list-styles.html
@@ -29,6 +29,10 @@
background-color: #ddd;
flex-shrink: 0;
}
+ .noChanges {
+ border-bottom: 1px solid #eee;
+ padding: .3em .5em;
+ }
.keyboard,
.star {
align-items: center;
diff --git a/polygerrit-ui/app/test/gr-change-list-test.html b/polygerrit-ui/app/test/gr-change-list-test.html
index c5d8876..306840f 100644
--- a/polygerrit-ui/app/test/gr-change-list-test.html
+++ b/polygerrit-ui/app/test/gr-change-list-test.html
@@ -136,6 +136,26 @@
assert.isFalse(elementItems[2].hasAttribute('unreviewed'));
});
+ test('no changes', function() {
+ element.changes = [];
+ flushAsynchronousOperations();
+ var listItems = Polymer.dom(element.root).querySelectorAll(
+ 'gr-change-list-item');
+ assert.equal(listItems.length, 0);
+ var noChangesMsg = Polymer.dom(element.root).querySelector('.noChanges');
+ assert.ok(noChangesMsg);
+ });
+
+ test('empty groups', function() {
+ element.groups = [[], []];
+ flushAsynchronousOperations();
+ var listItems = Polymer.dom(element.root).querySelectorAll(
+ 'gr-change-list-item');
+ assert.equal(listItems.length, 0);
+ var noChangesMsg = Polymer.dom(element.root).querySelectorAll(
+ '.noChanges');
+ assert.equal(noChangesMsg.length, 2);
+ });
});
suite('gr-change-list groups', function() {