Change screen: Show abbreviated commit sha1 in patch set dropdown
Add the sha hash of each patchset in dropdown menu as it was in the old UI. Bug: Issue 8513 Change-Id: I9e2f63ff083717ddc096b95e9a0927f5d0446385
This commit is contained in:
committed by
David Ostrovsky
parent
2067997ce5
commit
bb40298008
@@ -61,6 +61,10 @@
|
||||
|
||||
behaviors: [Gerrit.PatchSetBehavior],
|
||||
|
||||
_getShaForPatch(patch) {
|
||||
return patch.sha.substring(0, 10);
|
||||
},
|
||||
|
||||
_computeBaseDropdownContent(availablePatches, patchNum, _sortedRevisions,
|
||||
changeComments, revisionInfo) {
|
||||
const parentCounts = revisionInfo.getParentCountMap();
|
||||
@@ -73,7 +77,7 @@
|
||||
for (const basePatch of availablePatches) {
|
||||
const basePatchNum = basePatch.num;
|
||||
const entry = this._createDropdownEntry(basePatchNum, 'Patchset ',
|
||||
_sortedRevisions, changeComments);
|
||||
_sortedRevisions, changeComments, this._getShaForPatch(basePatch));
|
||||
dropdownContent.push(Object.assign({}, entry, {
|
||||
disabled: this._computeLeftDisabled(
|
||||
basePatch.num, patchNum, _sortedRevisions),
|
||||
@@ -111,7 +115,7 @@
|
||||
const patchNum = patch.num;
|
||||
const entry = this._createDropdownEntry(
|
||||
patchNum, patchNum === 'edit' ? '' : 'Patchset ', _sortedRevisions,
|
||||
changeComments);
|
||||
changeComments, this._getShaForPatch(patch));
|
||||
dropdownContent.push(Object.assign({}, entry, {
|
||||
disabled: this._computeRightDisabled(basePatchNum, patchNum,
|
||||
_sortedRevisions),
|
||||
@@ -120,12 +124,17 @@
|
||||
return dropdownContent;
|
||||
},
|
||||
|
||||
_createDropdownEntry(patchNum, prefix, sortedRevisions, changeComments) {
|
||||
_computeText(patchNum, prefix, changeComments, sha) {
|
||||
return `${prefix}${patchNum}` +
|
||||
`${this._computePatchSetCommentsString(changeComments, patchNum)}`
|
||||
+ (` | ${sha}`);
|
||||
},
|
||||
|
||||
_createDropdownEntry(patchNum, prefix, sortedRevisions, changeComments,
|
||||
sha) {
|
||||
const entry = {
|
||||
triggerText: `${prefix}${patchNum}`,
|
||||
text: `${prefix}${patchNum}` +
|
||||
`${this._computePatchSetCommentsString(
|
||||
changeComments, patchNum)}`,
|
||||
text: this._computeText(patchNum, prefix, changeComments, sha),
|
||||
mobileText: this._computeMobileText(patchNum, changeComments,
|
||||
sortedRevisions),
|
||||
bottomText: `${this._computePatchSetDescription(
|
||||
|
||||
@@ -118,10 +118,10 @@ limitations under the License.
|
||||
|
||||
test('_computeBaseDropdownContent', () => {
|
||||
const availablePatches = [
|
||||
{num: 'edit'},
|
||||
{num: 3},
|
||||
{num: 2},
|
||||
{num: 1},
|
||||
{num: 'edit', sha: '1'},
|
||||
{num: 3, sha: '2'},
|
||||
{num: 2, sha: '3'},
|
||||
{num: 1, sha: '4'},
|
||||
];
|
||||
const revisions = [
|
||||
{
|
||||
@@ -145,7 +145,7 @@ limitations under the License.
|
||||
{
|
||||
disabled: true,
|
||||
triggerText: 'Patchset edit',
|
||||
text: 'Patchset edit',
|
||||
text: 'Patchset edit | 1',
|
||||
mobileText: 'edit',
|
||||
bottomText: '',
|
||||
value: 'edit',
|
||||
@@ -153,7 +153,7 @@ limitations under the License.
|
||||
{
|
||||
disabled: true,
|
||||
triggerText: 'Patchset 3',
|
||||
text: 'Patchset 3',
|
||||
text: 'Patchset 3 | 2',
|
||||
mobileText: '3',
|
||||
bottomText: '',
|
||||
value: 3,
|
||||
@@ -162,7 +162,7 @@ limitations under the License.
|
||||
{
|
||||
disabled: true,
|
||||
triggerText: 'Patchset 2',
|
||||
text: 'Patchset 2',
|
||||
text: 'Patchset 2 | 3',
|
||||
mobileText: '2 description',
|
||||
bottomText: 'description',
|
||||
value: 2,
|
||||
@@ -170,7 +170,7 @@ limitations under the License.
|
||||
{
|
||||
disabled: true,
|
||||
triggerText: 'Patchset 1',
|
||||
text: 'Patchset 1',
|
||||
text: 'Patchset 1 | 4',
|
||||
mobileText: '1',
|
||||
bottomText: '',
|
||||
value: 1,
|
||||
@@ -195,10 +195,10 @@ limitations under the License.
|
||||
];
|
||||
element.revisionInfo = getInfo(element.revisions);
|
||||
element.availablePatches = [
|
||||
{num: 1},
|
||||
{num: 2},
|
||||
{num: 3},
|
||||
{num: 'edit'},
|
||||
{num: 1, sha: '1'},
|
||||
{num: 2, sha: '2'},
|
||||
{num: 3, sha: '3'},
|
||||
{num: 'edit', sha: '4'},
|
||||
];
|
||||
element.patchNum = 2;
|
||||
element.basePatchNum = 'PARENT';
|
||||
@@ -221,10 +221,10 @@ limitations under the License.
|
||||
];
|
||||
element.revisionInfo = getInfo(element.revisions);
|
||||
element.availablePatches = [
|
||||
{num: 'edit'},
|
||||
{num: 3},
|
||||
{num: 2},
|
||||
{num: 1},
|
||||
{num: 'edit', sha: '1'},
|
||||
{num: 3, sha: '2'},
|
||||
{num: 2, sha: '3'},
|
||||
{num: 1, sha: '4'},
|
||||
];
|
||||
element.patchNum = 2;
|
||||
element.basePatchNum = 'PARENT';
|
||||
@@ -248,10 +248,10 @@ limitations under the License.
|
||||
];
|
||||
element.revisionInfo = getInfo(element.revisions);
|
||||
element.availablePatches = [
|
||||
{num: 1},
|
||||
{num: 2},
|
||||
{num: 3},
|
||||
{num: 'edit'},
|
||||
{num: 1, sha: '1'},
|
||||
{num: 2, sha: '2'},
|
||||
{num: 3, sha: '3'},
|
||||
{num: 'edit', sha: '4'},
|
||||
];
|
||||
element.patchNum = 2;
|
||||
element.basePatchNum = 'PARENT';
|
||||
@@ -272,10 +272,10 @@ limitations under the License.
|
||||
];
|
||||
element.revisionInfo = getInfo(element.revisions);
|
||||
element.availablePatches = [
|
||||
{num: 1},
|
||||
{num: 2},
|
||||
{num: 3},
|
||||
{num: 'edit'},
|
||||
{num: 1, sha: '1'},
|
||||
{num: 2, sha: '2'},
|
||||
{num: 3, sha: '3'},
|
||||
{num: 'edit', sha: '4'},
|
||||
];
|
||||
element.patchNum = 2;
|
||||
element.basePatchNum = 'PARENT';
|
||||
@@ -291,10 +291,10 @@ limitations under the License.
|
||||
|
||||
test('_computePatchDropdownContent', () => {
|
||||
const availablePatches = [
|
||||
{num: 'edit'},
|
||||
{num: 3},
|
||||
{num: 2},
|
||||
{num: 1},
|
||||
{num: 'edit', sha: '1'},
|
||||
{num: 3, sha: '2'},
|
||||
{num: 2, sha: '3'},
|
||||
{num: 1, sha: '4'},
|
||||
];
|
||||
const basePatchNum = 1;
|
||||
const sortedRevisions = [
|
||||
@@ -308,7 +308,7 @@ limitations under the License.
|
||||
{
|
||||
disabled: false,
|
||||
triggerText: 'edit',
|
||||
text: 'edit',
|
||||
text: 'edit | 1',
|
||||
mobileText: 'edit',
|
||||
bottomText: '',
|
||||
value: 'edit',
|
||||
@@ -316,7 +316,7 @@ limitations under the License.
|
||||
{
|
||||
disabled: false,
|
||||
triggerText: 'Patchset 3',
|
||||
text: 'Patchset 3',
|
||||
text: 'Patchset 3 | 2',
|
||||
mobileText: '3',
|
||||
bottomText: '',
|
||||
value: 3,
|
||||
@@ -325,7 +325,7 @@ limitations under the License.
|
||||
{
|
||||
disabled: false,
|
||||
triggerText: 'Patchset 2',
|
||||
text: 'Patchset 2',
|
||||
text: 'Patchset 2 | 3',
|
||||
mobileText: '2 description',
|
||||
bottomText: 'description',
|
||||
value: 2,
|
||||
@@ -333,7 +333,7 @@ limitations under the License.
|
||||
{
|
||||
disabled: true,
|
||||
triggerText: 'Patchset 1',
|
||||
text: 'Patchset 1',
|
||||
text: 'Patchset 1 | 4',
|
||||
mobileText: '1',
|
||||
bottomText: '',
|
||||
value: 1,
|
||||
|
||||
Reference in New Issue
Block a user