Merge "Link "Recently closed" header to full query"

This commit is contained in:
Wyatt Allen
2017-07-18 18:05:20 +00:00
committed by Gerrit Code Review
2 changed files with 20 additions and 3 deletions

View File

@@ -26,8 +26,8 @@
},
{
name: 'Recently closed',
query: 'is:closed (owner:self OR reviewer:self OR assignee:self) ' +
'-age:4w limit:10',
query: 'is:closed (owner:self OR reviewer:self OR assignee:self)',
suffixForDashboard: '-age:4w limit:10',
},
];
@@ -99,9 +99,17 @@
_getChanges() {
return this.$.restAPI.getChanges(
null,
this.sectionMetadata.map(section => section.query),
this.sectionMetadata.map(
section => this._dashboardQueryForSection(section)),
null,
this.options);
},
_dashboardQueryForSection(section) {
if (section.suffixForDashboard) {
return section.query + ' ' + section.suffixForDashboard;
}
return section.query;
},
});
})();

View File

@@ -55,5 +55,14 @@ limitations under the License.
element.params = {view: 'gr-dashboard-view'};
assert.equal(getChangesStub.callCount, 2);
});
test('_dashboardQueryForSection', () => {
const query = 'query';
const suffixForDashboard = 'suffix';
assert.equal(element._dashboardQueryForSection({query}), 'query');
assert.equal(
element._dashboardQueryForSection({query, suffixForDashboard}),
'query suffix');
});
});
</script>