Show timestamp in the patchset picker
BUG: Issue 6933 Change-Id: I84627763c9979c08246d0ff592a2c2800af4a742
This commit is contained in:
@@ -69,18 +69,12 @@
|
||||
const dropdownContent = [];
|
||||
for (const basePatch of availablePatches) {
|
||||
const basePatchNum = basePatch.num;
|
||||
dropdownContent.push({
|
||||
const entry = this._createDropdownEntry(basePatchNum, 'Patchset ',
|
||||
_sortedRevisions, changeComments);
|
||||
dropdownContent.push(Object.assign({}, entry, {
|
||||
disabled: this._computeLeftDisabled(
|
||||
basePatch.num, patchNum, _sortedRevisions),
|
||||
triggerText: `Patchset ${basePatchNum}`,
|
||||
text: `Patchset ${basePatchNum}` +
|
||||
this._computePatchSetCommentsString(changeComments, basePatchNum),
|
||||
mobileText: this._computeMobileText(basePatchNum,
|
||||
changeComments, _sortedRevisions),
|
||||
bottomText: `${this._computePatchSetDescription(
|
||||
_sortedRevisions, basePatchNum)}`,
|
||||
value: basePatch.num,
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
dropdownContent.push({
|
||||
@@ -112,24 +106,36 @@
|
||||
const dropdownContent = [];
|
||||
for (const patch of availablePatches) {
|
||||
const patchNum = patch.num;
|
||||
dropdownContent.push({
|
||||
const entry = this._createDropdownEntry(
|
||||
patchNum, patchNum === 'edit' ? '' : 'Patchset ', _sortedRevisions,
|
||||
changeComments);
|
||||
dropdownContent.push(Object.assign({}, entry, {
|
||||
disabled: this._computeRightDisabled(basePatchNum, patchNum,
|
||||
_sortedRevisions),
|
||||
triggerText: `${patchNum === 'edit' ? '': 'Patchset '}` +
|
||||
patchNum,
|
||||
text: `${patchNum === 'edit' ? '': 'Patchset '}${patchNum}` +
|
||||
`${this._computePatchSetCommentsString(
|
||||
changeComments, patchNum)}`,
|
||||
mobileText: this._computeMobileText(patchNum, changeComments,
|
||||
_sortedRevisions),
|
||||
bottomText: `${this._computePatchSetDescription(
|
||||
_sortedRevisions, patchNum)}`,
|
||||
value: patchNum,
|
||||
});
|
||||
}));
|
||||
}
|
||||
return dropdownContent;
|
||||
},
|
||||
|
||||
_createDropdownEntry(patchNum, prefix, sortedRevisions, changeComments) {
|
||||
const entry = {
|
||||
triggerText: `${prefix}${patchNum}`,
|
||||
text: `${prefix}${patchNum}` +
|
||||
`${this._computePatchSetCommentsString(
|
||||
changeComments, patchNum)}`,
|
||||
mobileText: this._computeMobileText(patchNum, changeComments,
|
||||
sortedRevisions),
|
||||
bottomText: `${this._computePatchSetDescription(
|
||||
sortedRevisions, patchNum)}`,
|
||||
value: patchNum,
|
||||
};
|
||||
const date = this._computePatchSetDate(sortedRevisions, patchNum);
|
||||
if (date) {
|
||||
entry['date'] = date;
|
||||
}
|
||||
return entry;
|
||||
},
|
||||
|
||||
_updateSortedRevisions(revisionsRecord) {
|
||||
const revisions = revisionsRecord.base;
|
||||
this._sortedRevisions = this.sortRevisions(Object.values(revisions));
|
||||
@@ -211,6 +217,15 @@
|
||||
rev.description.substring(0, PATCH_DESC_MAX_LENGTH) : '';
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {!Array} revisions
|
||||
* @param {number|string} patchNum
|
||||
*/
|
||||
_computePatchSetDate(revisions, patchNum) {
|
||||
const rev = this.getRevisionByPatchNum(revisions, patchNum);
|
||||
return rev ? rev.created : undefined;
|
||||
},
|
||||
|
||||
/**
|
||||
* Catches value-change events from the patchset dropdowns and determines
|
||||
* whether or not a patch change event should be fired.
|
||||
|
@@ -135,7 +135,7 @@ limitations under the License.
|
||||
element.revisionInfo = getInfo(revisions);
|
||||
const patchNum = 1;
|
||||
const sortedRevisions = [
|
||||
{_number: 3},
|
||||
{_number: 3, created: 'Mon, 01 Jan 2001 00:00:00 GMT'},
|
||||
{_number: element.EDIT_NAME, basePatchNum: 2},
|
||||
{_number: 2, description: 'description'},
|
||||
{_number: 1},
|
||||
@@ -156,6 +156,7 @@ limitations under the License.
|
||||
mobileText: '3',
|
||||
bottomText: '',
|
||||
value: 3,
|
||||
date: 'Mon, 01 Jan 2001 00:00:00 GMT',
|
||||
},
|
||||
{
|
||||
disabled: true,
|
||||
@@ -296,7 +297,7 @@ limitations under the License.
|
||||
];
|
||||
const basePatchNum = 1;
|
||||
const sortedRevisions = [
|
||||
{_number: 3},
|
||||
{_number: 3, created: 'Mon, 01 Jan 2001 00:00:00 GMT'},
|
||||
{_number: element.EDIT_NAME, basePatchNum: 2},
|
||||
{_number: 2, description: 'description'},
|
||||
{_number: 1},
|
||||
@@ -318,6 +319,7 @@ limitations under the License.
|
||||
mobileText: '3',
|
||||
bottomText: '',
|
||||
value: 3,
|
||||
date: 'Mon, 01 Jan 2001 00:00:00 GMT',
|
||||
},
|
||||
{
|
||||
disabled: false,
|
||||
|
Reference in New Issue
Block a user