Merge "Show timestamp in the patchset picker"
This commit is contained in:
@@ -69,18 +69,12 @@
|
|||||||
const dropdownContent = [];
|
const dropdownContent = [];
|
||||||
for (const basePatch of availablePatches) {
|
for (const basePatch of availablePatches) {
|
||||||
const basePatchNum = basePatch.num;
|
const basePatchNum = basePatch.num;
|
||||||
dropdownContent.push({
|
const entry = this._createDropdownEntry(basePatchNum, 'Patchset ',
|
||||||
|
_sortedRevisions, changeComments);
|
||||||
|
dropdownContent.push(Object.assign({}, entry, {
|
||||||
disabled: this._computeLeftDisabled(
|
disabled: this._computeLeftDisabled(
|
||||||
basePatch.num, patchNum, _sortedRevisions),
|
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({
|
dropdownContent.push({
|
||||||
@@ -112,24 +106,36 @@
|
|||||||
const dropdownContent = [];
|
const dropdownContent = [];
|
||||||
for (const patch of availablePatches) {
|
for (const patch of availablePatches) {
|
||||||
const patchNum = patch.num;
|
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,
|
disabled: this._computeRightDisabled(basePatchNum, patchNum,
|
||||||
_sortedRevisions),
|
_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;
|
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) {
|
_updateSortedRevisions(revisionsRecord) {
|
||||||
const revisions = revisionsRecord.base;
|
const revisions = revisionsRecord.base;
|
||||||
this._sortedRevisions = this.sortRevisions(Object.values(revisions));
|
this._sortedRevisions = this.sortRevisions(Object.values(revisions));
|
||||||
@@ -211,6 +217,15 @@
|
|||||||
rev.description.substring(0, PATCH_DESC_MAX_LENGTH) : '';
|
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
|
* Catches value-change events from the patchset dropdowns and determines
|
||||||
* whether or not a patch change event should be fired.
|
* whether or not a patch change event should be fired.
|
||||||
|
@@ -135,7 +135,7 @@ limitations under the License.
|
|||||||
element.revisionInfo = getInfo(revisions);
|
element.revisionInfo = getInfo(revisions);
|
||||||
const patchNum = 1;
|
const patchNum = 1;
|
||||||
const sortedRevisions = [
|
const sortedRevisions = [
|
||||||
{_number: 3},
|
{_number: 3, created: 'Mon, 01 Jan 2001 00:00:00 GMT'},
|
||||||
{_number: element.EDIT_NAME, basePatchNum: 2},
|
{_number: element.EDIT_NAME, basePatchNum: 2},
|
||||||
{_number: 2, description: 'description'},
|
{_number: 2, description: 'description'},
|
||||||
{_number: 1},
|
{_number: 1},
|
||||||
@@ -156,6 +156,7 @@ limitations under the License.
|
|||||||
mobileText: '3',
|
mobileText: '3',
|
||||||
bottomText: '',
|
bottomText: '',
|
||||||
value: 3,
|
value: 3,
|
||||||
|
date: 'Mon, 01 Jan 2001 00:00:00 GMT',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
disabled: true,
|
disabled: true,
|
||||||
@@ -296,7 +297,7 @@ limitations under the License.
|
|||||||
];
|
];
|
||||||
const basePatchNum = 1;
|
const basePatchNum = 1;
|
||||||
const sortedRevisions = [
|
const sortedRevisions = [
|
||||||
{_number: 3},
|
{_number: 3, created: 'Mon, 01 Jan 2001 00:00:00 GMT'},
|
||||||
{_number: element.EDIT_NAME, basePatchNum: 2},
|
{_number: element.EDIT_NAME, basePatchNum: 2},
|
||||||
{_number: 2, description: 'description'},
|
{_number: 2, description: 'description'},
|
||||||
{_number: 1},
|
{_number: 1},
|
||||||
@@ -318,6 +319,7 @@ limitations under the License.
|
|||||||
mobileText: '3',
|
mobileText: '3',
|
||||||
bottomText: '',
|
bottomText: '',
|
||||||
value: 3,
|
value: 3,
|
||||||
|
date: 'Mon, 01 Jan 2001 00:00:00 GMT',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
Reference in New Issue
Block a user