Only show assignee highlight on open changes
The yellow background on changes assigned to the current user is intended to aid in prioritizing what changes need attention, but changes that are closed (merged or abandoned) do not need further attention. Do not show the highlight on these changes. Also correct an issue where the account was not set in change-lists used by the change-list-view, resulting in the highlight never appearing in search results. Bug: Issue 8476 Change-Id: I93e61f4c98e9a199f94689b611545de484799051
This commit is contained in:
@@ -46,7 +46,7 @@ limitations under the License.
|
||||
:host([needs-review]) {
|
||||
font-family: var(--font-family-bold);
|
||||
}
|
||||
:host([assigned]) {
|
||||
:host([highlight]) {
|
||||
background-color: #fcfad6;
|
||||
}
|
||||
.container {
|
||||
|
||||
@@ -73,12 +73,13 @@ limitations under the License.
|
||||
<gr-user-header
|
||||
user-id="[[_userId]]"
|
||||
show-dashboard-link
|
||||
logged-in="[[loggedIn]]"
|
||||
logged-in="[[_loggedIn]]"
|
||||
class$="[[_computeUserHeaderClass(_userId)]]"></gr-user-header>
|
||||
<gr-change-list
|
||||
account="[[account]]"
|
||||
changes="{{_changes}}"
|
||||
selected-index="{{viewState.selectedChangeIndex}}"
|
||||
show-star="[[loggedIn]]"></gr-change-list>
|
||||
show-star="[[_loggedIn]]"></gr-change-list>
|
||||
<nav class$="[[_computeNavClass(_loading)]]">
|
||||
Page [[_computePage(_offset, _changesPerPage)]]
|
||||
<a id="prevArrow"
|
||||
|
||||
@@ -49,9 +49,14 @@
|
||||
/**
|
||||
* True when user is logged in.
|
||||
*/
|
||||
loggedIn: {
|
||||
_loggedIn: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
computed: '_computeLoggedIn(account)',
|
||||
},
|
||||
|
||||
account: {
|
||||
type: Object,
|
||||
value: null,
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -220,5 +225,9 @@
|
||||
_computePage(offset, changesPerPage) {
|
||||
return offset / changesPerPage + 1;
|
||||
},
|
||||
|
||||
_computeLoggedIn(account) {
|
||||
return !!(account && Object.keys(account).length > 0);
|
||||
},
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -80,7 +80,7 @@ limitations under the License.
|
||||
<template is="dom-repeat" items="[[changeSection.results]]" as="change">
|
||||
<gr-change-list-item
|
||||
selected$="[[_computeItemSelected(sectionIndex, index, selectedIndex)]]"
|
||||
assigned$="[[_computeItemAssigned(account, change)]]"
|
||||
highlight$="[[_computeItemHighlight(account, change)]]"
|
||||
needs-review$="[[_computeItemNeedsReview(account, change, showReviewedState)]]"
|
||||
change="[[change]]"
|
||||
visible-change-table-columns="[[visibleChangeTableColumns]]"
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
const NUMBER_FIXED_COLUMNS = 3;
|
||||
|
||||
const CLOSED_STATUS = ['MERGED', 'ABANDONED'];
|
||||
|
||||
Polymer({
|
||||
is: 'gr-change-list',
|
||||
|
||||
@@ -228,8 +230,12 @@
|
||||
account._account_id != change.owner._account_id;
|
||||
},
|
||||
|
||||
_computeItemAssigned(account, change) {
|
||||
if (!change.assignee) { return false; }
|
||||
_computeItemHighlight(account, change) {
|
||||
// Do not show the assignee highlight if the change is not open.
|
||||
if (!change.assignee ||
|
||||
CLOSED_STATUS.indexOf(change.status) !== -1) {
|
||||
return false;
|
||||
}
|
||||
return account._account_id === change.assignee._account_id;
|
||||
},
|
||||
|
||||
|
||||
@@ -450,7 +450,7 @@ limitations under the License.
|
||||
'Should navigate to /c/4/');
|
||||
});
|
||||
|
||||
test('assigned attribute set in each item', () => {
|
||||
test('highlight attribute is updated correctly', () => {
|
||||
element.changes = [
|
||||
{
|
||||
_number: 0,
|
||||
@@ -465,12 +465,20 @@ limitations under the License.
|
||||
];
|
||||
element.account = {_account_id: 42};
|
||||
flushAsynchronousOperations();
|
||||
const items = element._getListItems();
|
||||
let items = element._getListItems();
|
||||
assert.equal(items.length, 2);
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
assert.equal(items[i].hasAttribute('assigned'),
|
||||
items[i]._account_id === element.account._account_id);
|
||||
}
|
||||
assert.isFalse(items[0].hasAttribute('highlight'));
|
||||
assert.isFalse(items[1].hasAttribute('highlight'));
|
||||
|
||||
// Assign all issues to the user, but only the first one is highlighted
|
||||
// because the second one is abandoned.
|
||||
element.set(['changes', 0, 'assignee'], {_account_id: 12});
|
||||
element.set(['changes', 1, 'assignee'], {_account_id: 12});
|
||||
element.account = {_account_id: 12};
|
||||
flushAsynchronousOperations();
|
||||
items = element._getListItems();
|
||||
assert.isTrue(items[0].hasAttribute('highlight'));
|
||||
assert.isFalse(items[1].hasAttribute('highlight'));
|
||||
});
|
||||
|
||||
test('_computeItemAbsoluteIndex', () => {
|
||||
|
||||
@@ -141,8 +141,8 @@ limitations under the License.
|
||||
<template is="dom-if" if="[[_showChangeListView]]" restamp="true">
|
||||
<gr-change-list-view
|
||||
params="[[params]]"
|
||||
view-state="{{_viewState.changeListView}}"
|
||||
logged-in="[[_computeLoggedIn(_account)]]"></gr-change-list-view>
|
||||
account="[[_account]]"
|
||||
view-state="{{_viewState.changeListView}}"></gr-change-list-view>
|
||||
</template>
|
||||
<template is="dom-if" if="[[_showDashboardView]]" restamp="true">
|
||||
<gr-dashboard-view
|
||||
|
||||
@@ -185,11 +185,6 @@
|
||||
this.$.header.unfloat();
|
||||
},
|
||||
|
||||
// Argument used for binding update only.
|
||||
_computeLoggedIn(account) {
|
||||
return !!(account && Object.keys(account).length > 0);
|
||||
},
|
||||
|
||||
_computeShowGwtUiLink(config) {
|
||||
return config.gerrit.web_uis && config.gerrit.web_uis.includes('GWT');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user