Merge "Limit shown changes in user dashboard and show their count"
This commit is contained in:
@@ -210,7 +210,7 @@
|
|||||||
this._showNewUserHelp = lastResultSet.length == 0;
|
this._showNewUserHelp = lastResultSet.length == 0;
|
||||||
}
|
}
|
||||||
this._results = changes.map((results, i) => ({
|
this._results = changes.map((results, i) => ({
|
||||||
name: res.sections[i].name,
|
name: this._computeSectionName(res.sections[i].name, results),
|
||||||
query: res.sections[i].query,
|
query: res.sections[i].query,
|
||||||
results,
|
results,
|
||||||
isOutgoing: res.sections[i].isOutgoing,
|
isOutgoing: res.sections[i].isOutgoing,
|
||||||
@@ -220,6 +220,17 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_computeSectionName(name, changes) {
|
||||||
|
if (!changes || !changes.length || changes.length == 0) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
const more = changes[changes.length - 1]._more_changes;
|
||||||
|
const numChanges = changes.length;
|
||||||
|
const andMore = more ? ' and more' : '';
|
||||||
|
const changeLabel = `change${numChanges > 1 ? 's' : ''}`;
|
||||||
|
return `${name} (${numChanges} ${changeLabel}${andMore})`;
|
||||||
|
},
|
||||||
|
|
||||||
_computeUserHeaderClass(params) {
|
_computeUserHeaderClass(params) {
|
||||||
if (!params || !!params.project || !params.user
|
if (!params || !!params.project || !params.user
|
||||||
|| params.user === 'self') {
|
|| params.user === 'self') {
|
||||||
|
@@ -149,6 +149,31 @@ limitations under the License.
|
|||||||
assert.equal(element._computeTitle('not self'), 'Dashboard for not self');
|
assert.equal(element._computeTitle('not self'), 'Dashboard for not self');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
suite('_computeSectionName', () => {
|
||||||
|
test('empty changes dont change name', () => {
|
||||||
|
const name = 'Work in progress';
|
||||||
|
assert.equal(name, element._computeSectionName(name, []));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('1 change', () => {
|
||||||
|
const name = 'Work in progress';
|
||||||
|
assert.equal(name + ' (1 change)',
|
||||||
|
element._computeSectionName(name, ['1']));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('2 changes', () => {
|
||||||
|
const name = 'Work in progress';
|
||||||
|
assert.equal(name + ' (2 changes)',
|
||||||
|
element._computeSectionName(name, ['1', '2']));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('1 change and more', () => {
|
||||||
|
const name = 'Work in progress';
|
||||||
|
assert.equal(name + ' (1 change and more)',
|
||||||
|
element._computeSectionName(name, [{_more_changes: true}]));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
suite('_isViewActive', () => {
|
suite('_isViewActive', () => {
|
||||||
test('nothing happens when user param is falsy', () => {
|
test('nothing happens when user param is falsy', () => {
|
||||||
element.params = {};
|
element.params = {};
|
||||||
@@ -280,7 +305,7 @@ limitations under the License.
|
|||||||
|
|
||||||
return element._fetchDashboardChanges({sections}, false).then(() => {
|
return element._fetchDashboardChanges({sections}, false).then(() => {
|
||||||
assert.equal(element._results.length, 1);
|
assert.equal(element._results.length, 1);
|
||||||
assert.equal(element._results[0].name, 'test2');
|
assert.equal(element._results[0].name, 'test2 (1 change)');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -115,6 +115,7 @@ limitations under the License.
|
|||||||
query: 'assignee:${user} (-is:wip OR owner:self OR assignee:self) ' +
|
query: 'assignee:${user} (-is:wip OR owner:self OR assignee:self) ' +
|
||||||
'is:open -is:ignored',
|
'is:open -is:ignored',
|
||||||
hideIfEmpty: true,
|
hideIfEmpty: true,
|
||||||
|
suffixForDashboard: 'limit:25',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// WIP open changes owned by viewing user. This section is omitted when
|
// WIP open changes owned by viewing user. This section is omitted when
|
||||||
@@ -123,6 +124,7 @@ limitations under the License.
|
|||||||
query: 'is:open owner:${user} is:wip',
|
query: 'is:open owner:${user} is:wip',
|
||||||
selfOnly: true,
|
selfOnly: true,
|
||||||
hideIfEmpty: true,
|
hideIfEmpty: true,
|
||||||
|
suffixForDashboard: 'limit:25',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Non-WIP open changes owned by viewed user. Filter out changes ignored
|
// Non-WIP open changes owned by viewed user. Filter out changes ignored
|
||||||
@@ -130,6 +132,7 @@ limitations under the License.
|
|||||||
name: 'Outgoing reviews',
|
name: 'Outgoing reviews',
|
||||||
query: 'is:open owner:${user} -is:wip -is:ignored',
|
query: 'is:open owner:${user} -is:wip -is:ignored',
|
||||||
isOutgoing: true,
|
isOutgoing: true,
|
||||||
|
suffixForDashboard: 'limit:25',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Non-WIP open changes not owned by the viewed user, that the viewed user
|
// Non-WIP open changes not owned by the viewed user, that the viewed user
|
||||||
@@ -138,12 +141,14 @@ limitations under the License.
|
|||||||
name: 'Incoming reviews',
|
name: 'Incoming reviews',
|
||||||
query: 'is:open -owner:${user} -is:wip -is:ignored ' +
|
query: 'is:open -owner:${user} -is:wip -is:ignored ' +
|
||||||
'(reviewer:${user} OR assignee:${user})',
|
'(reviewer:${user} OR assignee:${user})',
|
||||||
|
suffixForDashboard: 'limit:25',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Open changes the viewed user is CCed on. Changes ignored by the viewing
|
// Open changes the viewed user is CCed on. Changes ignored by the viewing
|
||||||
// user are filtered out.
|
// user are filtered out.
|
||||||
name: 'CCed on',
|
name: 'CCed on',
|
||||||
query: 'is:open -is:ignored cc:${user}',
|
query: 'is:open -is:ignored cc:${user}',
|
||||||
|
suffixForDashboard: 'limit:10',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Recently closed',
|
name: 'Recently closed',
|
||||||
|
Reference in New Issue
Block a user