Merge changes Iac62434c,Ia779e7d5
* changes: Don't display diff size or file status for commit message Don't bold outgoing reviews in the dashboard
This commit is contained in:
commit
6233c1a239
@ -126,6 +126,7 @@ limitations under the License.
|
||||
</template>
|
||||
<template is="dom-if" if="{{_showDashboardView}}" restamp="true">
|
||||
<gr-dashboard-view
|
||||
account="[[account]]"
|
||||
params="[[params]]"
|
||||
view-state="{{_viewState.dashboardView}}"></gr-dashboard-view>
|
||||
</template>
|
||||
|
@ -31,7 +31,7 @@ limitations under the License.
|
||||
:host([selected]) {
|
||||
background-color: #ebf5fb;
|
||||
}
|
||||
:host([unreviewed]) {
|
||||
:host([needs-review]) {
|
||||
font-weight: bold;
|
||||
}
|
||||
.cell {
|
||||
@ -98,7 +98,7 @@ limitations under the License.
|
||||
value: false,
|
||||
reflectToAttribute: true,
|
||||
},
|
||||
unreviewed: {
|
||||
needsReview: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
reflectToAttribute: true,
|
||||
|
@ -55,7 +55,7 @@ limitations under the License.
|
||||
<template is="dom-repeat" items="[[changeGroup]]" as="change">
|
||||
<gr-change-list-item
|
||||
selected$="[[_computeItemSelected(index, groupIndex, selectedIndex)]]"
|
||||
unreviewed="[[_computeItemUnreviewed(change, showReviewedState)]]"
|
||||
needs-review="[[_computeItemNeedsReview(account, change, showReviewedState)]]"
|
||||
change="[[change]]"
|
||||
show-star="[[showStar]]"
|
||||
label-names="[[labelNames]]"></gr-change-list-item>
|
||||
@ -75,6 +75,14 @@ limitations under the License.
|
||||
},
|
||||
|
||||
properties: {
|
||||
/**
|
||||
* The logged-in user's account, or an empty object if no user is logged
|
||||
* in.
|
||||
*/
|
||||
account: {
|
||||
type: Object,
|
||||
value: function() { return {}; },
|
||||
},
|
||||
/**
|
||||
* An array of ChangeInfo objects to render.
|
||||
* https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-info
|
||||
@ -162,9 +170,10 @@ limitations under the License.
|
||||
return idx == selectedIndex;
|
||||
},
|
||||
|
||||
_computeItemUnreviewed: function(change, showReviewedState) {
|
||||
_computeItemNeedsReview: function(account, change, showReviewedState) {
|
||||
return showReviewedState && !change.reviewed &&
|
||||
change.status != this.ChangeStatus.MERGED;
|
||||
change.status != this.ChangeStatus.MERGED &&
|
||||
account._account_id != change.owner._account_id;
|
||||
},
|
||||
|
||||
_handleKey: function(e) {
|
||||
|
@ -54,6 +54,7 @@ limitations under the License.
|
||||
<gr-change-list
|
||||
show-star
|
||||
show-reviewed-state
|
||||
account="[[account]]"
|
||||
selected-index="{{viewState.selectedChangeIndex}}"
|
||||
groups="{{_results}}"
|
||||
group-titles="[[_groupTitles]]"></gr-change-list>
|
||||
@ -73,6 +74,10 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
properties: {
|
||||
account: {
|
||||
type: Object,
|
||||
value: function() { return {}; },
|
||||
},
|
||||
viewState: Object,
|
||||
|
||||
_results: Array,
|
||||
|
@ -132,7 +132,7 @@ limitations under the License.
|
||||
hidden$="[[!_loggedIn]]" hidden>
|
||||
<div class="jumpToFileContainer">
|
||||
<gr-button link class="dropdown-trigger" id="trigger" on-tap="_showDropdownTapHandler">
|
||||
<span>[[_path]]</span>
|
||||
<span>[[_computeFileDisplayName(_path)]]</span>
|
||||
<span class="downArrow">▼</span>
|
||||
</gr-button>
|
||||
<iron-dropdown id="dropdown" vertical-align="top" vertical-offset="25">
|
||||
@ -141,7 +141,9 @@ limitations under the License.
|
||||
<a href$="[[_computeDiffURL(_changeNum, _patchRange, path)]]"
|
||||
selected$="[[_computeFileSelected(path, _path)]]"
|
||||
data-key-nav$="[[_computeKeyNav(path, _path, _fileList)]]"
|
||||
on-tap="_handleFileTap">[[path]]</a>
|
||||
on-tap="_handleFileTap">
|
||||
[[_computeFileDisplayName(path)]]
|
||||
</a>
|
||||
</template>
|
||||
</div>
|
||||
</iron-dropdown>
|
||||
@ -152,7 +154,7 @@ limitations under the License.
|
||||
<option
|
||||
value$="[[path]]"
|
||||
selected$="[[_computeFileSelected(path, _path)]]">
|
||||
[[path]]
|
||||
[[_computeFileDisplayName(path)]]
|
||||
</option>
|
||||
</template>
|
||||
</select>
|
||||
@ -172,6 +174,8 @@ limitations under the License.
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var COMMIT_MESSAGE_PATH = '/COMMIT_MSG';
|
||||
|
||||
Polymer({
|
||||
is: 'gr-diff-view',
|
||||
|
||||
@ -238,7 +242,8 @@ limitations under the License.
|
||||
|
||||
attached: function() {
|
||||
if (this._path) {
|
||||
this.fire('title-change', {title: this._path});
|
||||
this.fire('title-change',
|
||||
{title: this._computeFileDisplayName(this._path)});
|
||||
}
|
||||
window.addEventListener('resize', this._boundWindowResizeHandler);
|
||||
},
|
||||
@ -343,7 +348,8 @@ limitations under the License.
|
||||
};
|
||||
this._path = value.path;
|
||||
|
||||
this.fire('title-change', {title: this._path});
|
||||
this.fire('title-change',
|
||||
{title: this._computeFileDisplayName(this._path)});
|
||||
|
||||
// When navigating away from the page, there is a possibility that the
|
||||
// patch number is no longer a part of the URL (say when navigating to
|
||||
@ -402,6 +408,10 @@ limitations under the License.
|
||||
return base;
|
||||
},
|
||||
|
||||
_computeFileDisplayName: function(path) {
|
||||
return path == COMMIT_MESSAGE_PATH ? 'Commit message' : path;
|
||||
},
|
||||
|
||||
_computeChangeDetailPath: function(changeNum) {
|
||||
return '/changes/' + changeNum + '/detail';
|
||||
},
|
||||
|
@ -76,6 +76,9 @@ limitations under the License.
|
||||
.stats {
|
||||
min-width: 7em;
|
||||
}
|
||||
.invisible {
|
||||
visibility: hidden;
|
||||
}
|
||||
.row:not(.header) .stats {
|
||||
font-family: var(--monospace-font-family);
|
||||
}
|
||||
@ -135,15 +138,17 @@ limitations under the License.
|
||||
<input type="checkbox" checked$="[[_computeReviewed(file, _reviewed)]]"
|
||||
data-path$="[[file.__path]]" on-change="_handleReviewedChange">
|
||||
</div>
|
||||
<div class="status">[[file.status]]</div>
|
||||
<div class$="[[_computeClass('status', file.__path)]]">
|
||||
[[_computeFileStatus(file.status)]]
|
||||
</div>
|
||||
<a class="path" href$="[[_computeDiffURL(changeNum, patchNum, file.__path)]]">
|
||||
[[file.__path]]
|
||||
[[_computeFileDisplayName(file.__path)]]
|
||||
</a>
|
||||
<div class="comments">
|
||||
<span class="drafts">[[_computeDraftsString(_drafts, file.__path)]]</span>
|
||||
[[_computeCommentsString(comments, patchNum, file.__path)]]
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class$="[[_computeClass('stats', file.__path)]]">
|
||||
<span class="added">+[[file.lines_inserted]]</span>
|
||||
<span class="removed">-[[file.lines_deleted]]</span>
|
||||
</div>
|
||||
@ -154,6 +159,8 @@ limitations under the License.
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var COMMIT_MESSAGE_PATH = '/COMMIT_MSG';
|
||||
|
||||
Polymer({
|
||||
is: 'gr-file-list',
|
||||
|
||||
@ -311,10 +318,26 @@ limitations under the License.
|
||||
return index == selectedIndex;
|
||||
},
|
||||
|
||||
_computeFileStatus: function(status) {
|
||||
return status || 'M';
|
||||
},
|
||||
|
||||
_computeDiffURL: function(changeNum, patchNum, path) {
|
||||
return '/c/' + changeNum + '/' + patchNum + '/' + path;
|
||||
},
|
||||
|
||||
_computeFileDisplayName: function(path) {
|
||||
return path == COMMIT_MESSAGE_PATH ? 'Commit message' : path;
|
||||
},
|
||||
|
||||
_computeClass: function(baseClass, path) {
|
||||
var classes = [baseClass];
|
||||
if (path == COMMIT_MESSAGE_PATH) {
|
||||
classes.push('invisible');
|
||||
}
|
||||
return classes.join(' ');
|
||||
},
|
||||
|
||||
_send: function(method, url) {
|
||||
var xhr = document.createElement('gr-request');
|
||||
this._xhrPromise = xhr.send({
|
||||
|
@ -105,35 +105,52 @@ limitations under the License.
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('unreviewed changes', function() {
|
||||
test('changes needing review', function() {
|
||||
element.changes = [
|
||||
{
|
||||
_number: 0,
|
||||
reviewed: true,
|
||||
owner: { _account_id: 0 },
|
||||
},
|
||||
{
|
||||
_number: 1,
|
||||
owner: { _account_id: 0 },
|
||||
},
|
||||
{
|
||||
_number: 2,
|
||||
status: 'MERGED',
|
||||
owner: { _account_id: 0 },
|
||||
},
|
||||
{
|
||||
_number: 3,
|
||||
owner: { _account_id: 42 },
|
||||
}
|
||||
];
|
||||
flushAsynchronousOperations();
|
||||
var elementItems = Polymer.dom(element.root).querySelectorAll(
|
||||
'gr-change-list-item');
|
||||
assert.equal(elementItems.length, 3);
|
||||
assert.equal(elementItems.length, 4);
|
||||
for (var i = 0; i < elementItems.length; i++) {
|
||||
assert.isFalse(elementItems[i].hasAttribute('unreviewed'));
|
||||
assert.isFalse(elementItems[i].hasAttribute('needs-review'));
|
||||
}
|
||||
|
||||
element.showReviewedState = true;
|
||||
var elementItems = Polymer.dom(element.root).querySelectorAll(
|
||||
'gr-change-list-item');
|
||||
assert.equal(elementItems.length, 3);
|
||||
assert.isFalse(elementItems[0].hasAttribute('unreviewed'));
|
||||
assert.isTrue(elementItems[1].hasAttribute('unreviewed'));
|
||||
assert.isFalse(elementItems[2].hasAttribute('unreviewed'));
|
||||
assert.equal(elementItems.length, 4);
|
||||
assert.isFalse(elementItems[0].hasAttribute('needs-review'));
|
||||
assert.isTrue(elementItems[1].hasAttribute('needs-review'));
|
||||
assert.isFalse(elementItems[2].hasAttribute('needs-review'));
|
||||
assert.isTrue(elementItems[3].hasAttribute('needs-review'));
|
||||
|
||||
element.account = { _account_id: 42 };
|
||||
var elementItems = Polymer.dom(element.root).querySelectorAll(
|
||||
'gr-change-list-item');
|
||||
assert.equal(elementItems.length, 4);
|
||||
assert.isFalse(elementItems[0].hasAttribute('needs-review'));
|
||||
assert.isTrue(elementItems[1].hasAttribute('needs-review'));
|
||||
assert.isFalse(elementItems[2].hasAttribute('needs-review'));
|
||||
assert.isFalse(elementItems[3].hasAttribute('needs-review'));
|
||||
});
|
||||
|
||||
test('no changes', function() {
|
||||
|
@ -321,6 +321,11 @@ limitations under the License.
|
||||
assert.equal(linkEls[0].getAttribute('href'), '/c/42/10/chell.go');
|
||||
assert.equal(linkEls[1].getAttribute('href'), '/c/42/10/glados.txt');
|
||||
assert.equal(linkEls[2].getAttribute('href'), '/c/42/10/wheatley.md');
|
||||
|
||||
assert.equal(element._computeFileDisplayName('/foo/bar/baz'),
|
||||
'/foo/bar/baz');
|
||||
assert.equal(element._computeFileDisplayName('/COMMIT_MSG'),
|
||||
'Commit message');
|
||||
});
|
||||
|
||||
test('jump to file dropdown with patch range', function() {
|
||||
|
@ -260,6 +260,21 @@ limitations under the License.
|
||||
'');
|
||||
});
|
||||
|
||||
test('computed properties', function() {
|
||||
assert.equal(element._computeFileStatus('A'), 'A');
|
||||
assert.equal(element._computeFileStatus(undefined), 'M');
|
||||
assert.equal(element._computeFileStatus(null), 'M');
|
||||
|
||||
assert.equal(element._computeFileDisplayName('/foo/bar/baz'),
|
||||
'/foo/bar/baz');
|
||||
assert.equal(element._computeFileDisplayName('/COMMIT_MSG'),
|
||||
'Commit message');
|
||||
|
||||
assert.equal(element._computeClass('clazz', '/foo/bar/baz'), 'clazz');
|
||||
assert.equal(element._computeClass('clazz', '/COMMIT_MSG'),
|
||||
'clazz invisible');
|
||||
});
|
||||
|
||||
test('file review status', function(done) {
|
||||
element.changeNum = '42';
|
||||
element.patchNum = '2';
|
||||
|
Loading…
x
Reference in New Issue
Block a user