Merge "Replace ${project} in a foreach query (for project dashboards)" into stable-2.16

This commit is contained in:
David Pursehouse
2019-09-29 01:18:49 +00:00
committed by Gerrit Code Review
2 changed files with 4 additions and 6 deletions

View File

@@ -117,9 +117,8 @@
const suffix = response.foreach ? ' ' + response.foreach : '';
return {
name: section.name,
query:
section.query.replace(
PROJECT_PLACEHOLDER_PATTERN, project) + suffix,
query: (section.query + suffix).replace(
PROJECT_PLACEHOLDER_PATTERN, project),
};
}),
};

View File

@@ -223,7 +223,6 @@ limitations under the License.
test('dashboard with foreach', () => {
sandbox.stub(element.$.restAPI, 'getDashboard', () => Promise.resolve({
title: 'title',
// Note: ${project} should not be resolved in foreach!
foreach: 'foreach for ${project}',
sections: [
{name: 'section 1', query: 'query 1'},
@@ -236,10 +235,10 @@ limitations under the License.
{
title: 'title',
sections: [
{name: 'section 1', query: 'query 1 foreach for ${project}'},
{name: 'section 1', query: 'query 1 foreach for project'},
{
name: 'section 2',
query: 'project query 2 foreach for ${project}',
query: 'project query 2 foreach for project',
},
],
});