Gerrit学习之gerrit源码学习之提交页面
gerrit-3.4.3 的编译
对于 一个 提交 页面, 整个 页面是 在 mainContent 下面的
1 | <div id="mainContent" class="container"> 对于 一个 提交 页面, 整个 页面是 在 mainContent 下面的 |
div id=”mainContent” > polygerrit-ui\app\elements\change\gr-change-view\gr-change-view_html.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349<div
id="mainContent"
class="container"
on-show-checks-table="_setActivePrimaryTab"
hidden$="{{_loading}}"
aria-hidden="[[_changeViewAriaHidden]]"
>
1. <section class="changeInfoSection"> 最上部分的 changeInfo 块。
<div class$="[[_computeHeaderClass(_editMode)]]">
<h1 class="assistive-tech-only">
Change [[_change._number]]: [[_change.subject]]
</h1>
<div class="headerTitle">
<div class="changeStatuses">
<template is="dom-repeat" items="[[_changeStatuses]]" as="status">
<gr-change-status
max-width="100"
status="[[status]]"
></gr-change-status>
</template>
</div>
<gr-change-star
id="changeStar"
change="{{_change}}"
on-toggle-star="_handleToggleStar"
hidden$="[[!_loggedIn]]"
></gr-change-star>
<a
class="changeNumber"
aria-label$="[[_computeChangePermalinkAriaLabel(_change._number)]]"
href$="[[_computeChangeUrl(_change)]]"
>[[_change._number]]</a
>
<span class="changeNumberColon">: </span>
<span class="headerSubject">[[_change.subject]]</span>
<gr-copy-clipboard
class="changeCopyClipboard"
hide-input=""
text="[[_computeCopyTextForTitle(_change)]]"
>
</gr-copy-clipboard>
</div>
<!-- end headerTitle -->
<div class="commitActions" hidden$="[[!_loggedIn]]">
<gr-change-actions
id="actions"
change="[[_change]]"
disable-edit="[[disableEdit]]"
has-parent="[[hasParent]]"
actions="[[_change.actions]]"
revision-actions="{{_currentRevisionActions}}"
account="[[_account]]"
change-num="[[_changeNum]]"
change-status="[[_change.status]]"
commit-num="[[_commitInfo.commit]]"
latest-patch-num="[[_computeLatestPatchNum(_allPatchSets)]]"
commit-message="[[_latestCommitMessage]]"
edit-patchset-loaded="[[_hasEditPatchsetLoaded(_patchRange.*)]]"
edit-mode="[[_editMode]]"
edit-based-on-current-patch-set="[[_hasEditBasedOnCurrentPatchSet(_allPatchSets)]]"
private-by-default="[[_projectConfig.private_by_default]]"
on-edit-tap="_handleEditTap"
on-stop-edit-tap="_handleStopEditTap"
on-download-tap="_handleOpenDownloadDialog"
comment-threads="[[_commentThreads]]"
></gr-change-actions>
</div>
<!-- end commit actions -->
</div>
<!-- end header -->
<h2 class="assistive-tech-only">Change metadata</h2>
<div class="changeInfo">
<div class="changeInfo-column changeMetadata hideOnMobileOverlay">
<gr-change-metadata
id="metadata"
change="{{_change}}"
account="[[_account]]"
revision="[[_selectedRevision]]"
commit-info="[[_commitInfo]]"
server-config="[[_serverConfig]]"
parent-is-current="[[_parentIsCurrent]]"
on-show-reply-dialog="_handleShowReplyDialog"
>
</gr-change-metadata>
</div>
<div id="mainChangeInfo" class="changeInfo-column mainChangeInfo">
<div id="commitAndRelated" class="hideOnMobileOverlay">
<div class="commitContainer">
<h3 class="assistive-tech-only">Commit Message</h3>
<div>
<gr-button
id="replyBtn"
class="reply"
title="[[createTitle(Shortcut.OPEN_REPLY_DIALOG,
ShortcutSection.ACTIONS)]]"
hidden$="[[!_loggedIn]]"
primary=""
disabled="[[_replyDisabled]]"
on-click="_handleReplyTap"
>[[_replyButtonLabel]]</gr-button
>
</div>
<div id="commitMessage" class="commitMessage">
<gr-editable-content
id="commitMessageEditor"
editing="{{_editingCommitMessage}}"
content="{{_latestCommitMessage}}"
storage-key="[[_computeCommitMessageKey(_change._number, _change.current_revision)]]"
hide-edit-commit-message="[[_hideEditCommitMessage]]"
commit-collapsible="[[_commitCollapsible]]"
remove-zero-width-space=""
>
<gr-linked-text
pre=""
content="[[_latestCommitMessage]]"
config="[[_projectConfig.commentlinks]]"
remove-zero-width-space=""
></gr-linked-text>
</gr-editable-content>
</div>
<gr-change-summary
change-comments="[[_changeComments]]"
comment-threads="[[_commentThreads]]"
self-account="[[_account]]"
>
</gr-change-summary>
<gr-endpoint-decorator name="commit-container">
<gr-endpoint-param name="change" value="[[_change]]">
</gr-endpoint-param>
<gr-endpoint-param
name="revision"
value="[[_selectedRevision]]"
>
</gr-endpoint-param>
</gr-endpoint-decorator>
</div>
<div class="relatedChanges">
<gr-related-changes-list
change="[[_change]]"
id="relatedChanges"
mergeable="[[_mergeable]]"
patch-num="[[_computeLatestPatchNum(_allPatchSets)]]"
></gr-related-changes-list>
</div>
<div class="emptySpace"></div>
</div>
</div>
</div>
</section>
<h2 class="assistive-tech-only">Files and Comments tabs</h2> files/comments/findings 这个 上面的一个标签,但是不显示的,把class 去掉就会显示
2. <paper-tabs id="primaryTabs" on-selected-changed="_setActivePrimaryTab"> files/comments/findings 这个 tab 行
<paper-tab data-name$="[[_constants.PrimaryTab.FILES]]">Files</paper-tab>
<paper-tab
data-name$="[[_constants.PrimaryTab.COMMENT_THREADS]]"
class="commentThreads"
>
<gr-tooltip-content
has-tooltip=""
title$="[[_computeTotalCommentCounts(_change.unresolved_comment_count, _changeComments)]]"
>
<span>Comments</span></gr-tooltip-content
>
</paper-tab>
<template is="dom-if" if="[[_showChecksTab]]">
<paper-tab data-name$="[[_constants.PrimaryTab.CHECKS]]"
>Checks</paper-tab
>
</template>
<template
is="dom-repeat"
items="[[_dynamicTabHeaderEndpoints]]"
as="tabHeader"
>
<paper-tab data-name$="[[tabHeader]]">
<gr-endpoint-decorator name$="[[tabHeader]]">
<gr-endpoint-param name="change" value="[[_change]]">
</gr-endpoint-param>
<gr-endpoint-param name="revision" value="[[_selectedRevision]]">
</gr-endpoint-param>
</gr-endpoint-decorator>
</paper-tab>
</template>
<paper-tab data-name$="[[_constants.PrimaryTab.FINDINGS]]">
Findings
</paper-tab>
</paper-tabs>
3. <section class="patchInfo">
<div
hidden$="[[!_isTabActive(_constants.PrimaryTab.FILES, _activeTabs)]]"
>
<gr-file-list-header
id="fileListHeader"
account="[[_account]]"
all-patch-sets="[[_allPatchSets]]"
change="[[_change]]"
change-num="[[_changeNum]]"
revision-info="[[_revisionInfo]]"
change-comments="[[_changeComments]]"
commit-info="[[_commitInfo]]"
change-url="[[_computeChangeUrl(_change)]]"
edit-mode="[[_editMode]]"
logged-in="[[_loggedIn]]"
server-config="[[_serverConfig]]"
shown-file-count="[[_shownFileCount]]"
diff-prefs="[[_diffPrefs]]"
diff-view-mode="{{viewState.diffMode}}"
patch-num="{{_patchRange.patchNum}}"
base-patch-num="{{_patchRange.basePatchNum}}"
files-expanded="[[_filesExpanded]]"
diff-prefs-disabled="[[_diffPrefsDisabled]]"
on-open-diff-prefs="_handleOpenDiffPrefs"
on-open-download-dialog="_handleOpenDownloadDialog"
on-open-included-in-dialog="_handleOpenIncludedInDialog"
on-expand-diffs="_expandAllDiffs"
on-collapse-diffs="_collapseAllDiffs"
>
</gr-file-list-header>
<gr-file-list
id="fileList"
class="hideOnMobileOverlay"
diff-prefs="{{_diffPrefs}}"
change="[[_change]]"
change-num="[[_changeNum]]"
patch-range="{{_patchRange}}"
change-comments="[[_changeComments]]"
revisions="[[_change.revisions]]"
selected-index="{{viewState.selectedFileIndex}}"
diff-view-mode="[[viewState.diffMode]]"
edit-mode="[[_editMode]]"
num-files-shown="{{_numFilesShown}}"
files-expanded="{{_filesExpanded}}"
file-list-increment="{{_numFilesShown}}"
on-files-shown-changed="_setShownFiles"
on-file-action-tap="_handleFileActionTap"
on-reload-drafts="_reloadDraftsWithCallback"
>
</gr-file-list>
</div>
<template
is="dom-if"
if="[[_isTabActive(_constants.PrimaryTab.COMMENT_THREADS, _activeTabs)]]"
>
<gr-thread-list
threads="[[_commentThreads]]"
change="[[_change]]"
change-num="[[_changeNum]]"
logged-in="[[_loggedIn]]"
comment-tab-state="[[_tabState.commentTab]]"
only-show-robot-comments-with-human-reply=""
unresolved-only
show-comment-context
></gr-thread-list>
</template>
<template
is="dom-if"
if="[[_isTabActive(_constants.PrimaryTab.CHECKS, _activeTabs)]]"
>
<gr-checks-tab
id="checksTab"
tab-state="[[_tabState.checksTab]]"
></gr-checks-tab>
</template>
<template
is="dom-if"
if="[[_isTabActive(_constants.PrimaryTab.FINDINGS, _activeTabs)]]"
>
<gr-dropdown-list
class="patch-set-dropdown"
items="[[_robotCommentsPatchSetDropdownItems]]"
on-value-change="_handleRobotCommentPatchSetChanged"
value="[[_currentRobotCommentsPatchSet]]"
>
</gr-dropdown-list>
<gr-thread-list
threads="[[_robotCommentThreads]]"
change="[[_change]]"
change-num="[[_changeNum]]"
logged-in="[[_loggedIn]]"
hide-toggle-buttons
empty-thread-msg="[[_messages.NO_ROBOT_COMMENTS_THREADS_MSG]]"
>
</gr-thread-list>
<template is="dom-if" if="[[_showRobotCommentsButton]]">
<gr-button
class="show-robot-comments"
on-click="_toggleShowRobotComments"
>
[[_computeShowText(_showAllRobotComments)]]
</gr-button>
</template>
</template>
<template
is="dom-if"
if="[[_isTabActive(_selectedTabPluginHeader, _activeTabs)]]"
>
<gr-endpoint-decorator name$="[[_selectedTabPluginEndpoint]]">
<gr-endpoint-param name="change" value="[[_change]]">
</gr-endpoint-param>
<gr-endpoint-param name="revision" value="[[_selectedRevision]]">
</gr-endpoint-param>
</gr-endpoint-decorator>
</template>
</section>
<gr-endpoint-decorator name="change-view-integration">
<gr-endpoint-param name="change" value="[[_change]]"> </gr-endpoint-param>
<gr-endpoint-param name="revision" value="[[_selectedRevision]]">
</gr-endpoint-param>
</gr-endpoint-decorator>
4. <paper-tabs id="secondaryTabs" on-selected-changed="_setActiveSecondaryTab"> Changelog 这个 tab 行
<paper-tab
data-name$="[[_constants.SecondaryTab.CHANGE_LOG]]"
class="changeLog"
>
Change Log
</paper-tab>
</paper-tabs>
5. <section class="changeLog">
<h2 class="assistive-tech-only">Change Log</h2>
<template
is="dom-if"
if="[[_isTabActive(_constants.SecondaryTab.CHANGE_LOG, _activeTabs)]]"
>
<gr-messages-list
class="hideOnMobileOverlay"
change="[[_change]]"
change-num="[[_changeNum]]"
labels="[[_change.labels]]"
messages="[[_change.messages]]"
reviewer-updates="[[_change.reviewer_updates]]"
change-comments="[[_changeComments]]"
project-name="[[_change.project]]"
show-reply-buttons="[[_loggedIn]]"
on-message-anchor-tap="_handleMessageAnchorTap"
on-reply="_handleMessageReply"
></gr-messages-list>
</template>
</section>
</div>
最上部分的 changeInfo 块。在 mainContent 里面 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105<section class="changeInfoSection">
<div class="header"> 最上一行的, 右边显示 rebase按钮, abandon 按钮的那一行
<h1 class="assistive-tech-only">
Change 263820: [KTUS-9106][BT][Bugfix]Fix reboot cause by BLUETOOTH_CONNECT permission
</h1>
<div class="headerTitle">
<div class="changeStatuses">
<gr-change-status max-width="100" class="active"></gr-change-status>
<dom-repeat as="status" style="display: none;"><template is="dom-repeat"></template></dom-repeat>
</div>
<gr-change-star id="changeStar"></gr-change-star>
<a class="changeNumber" href="/c/git/android/platform/vendor/qcom-opensource/packages/apps/Bluetooth/+/263820" aria-label="Change 263820">263820</a>
<span class="changeNumberColon">: </span>
<span class="headerSubject">[KTUS-9106][BT][Bugfix]Fix reboot cause by BLUETOOTH_CONNECT permission</span>
<gr-copy-clipboard class="changeCopyClipboard" hide-input="">
</gr-copy-clipboard>
</div>
<!-- end headerTitle -->
<div class="commitActions"> 右边显示 rebase按钮, abandon 按钮的
<gr-change-actions id="actions"></gr-change-actions>
1. <section id="primaryActions"> 里面又分了2个 section,其中 第一个是没内容的
</section id="primaryActions">
2. <section id="secondaryActions"> 我们需要参考的 code review +2 按钮就在这里
<gr-button link="" position-below="" data-label="Code-Review+2" data-action-type="change" data-action-key="review" tabindex="0" role="button">
<iron-icon icon="gr-icons:review" class=""></iron-icon>
Code-Review+2
</gr-button> Code-Review+2按钮
<gr-button link="" position-below="" data-label="Rebase" data-action-type="revision" data-action-key="rebase" title="Rebase onto tip of branch or parent change" tabindex="0" role="button">
<iron-icon icon="gr-icons:rebase" class=""></iron-icon>
Rebase
</gr-button> Rebase按钮
<gr-button link="" position-below="" data-label="Abandon" data-action-type="change" data-action-key="abandon" title="Abandon the change" tabindex="0" role="button">
<iron-icon icon="gr-icons:abandon" class=""></iron-icon>
Abandon
</gr-button> Abandon按钮
<gr-button link="" position-below="" data-label="Edit" data-action-type="change" data-action-key="edit" title="Edit this change" tabindex="0" role="button">
<iron-icon icon="gr-icons:edit" class=""></iron-icon>
Edit
</gr-button> Edit按钮
<dom-repeat as="action" style="display: none;">
<template is="dom-repeat">
</template>
</dom-repeat>
</section> 我们需要参考的 code review +2 按钮就在这里 id="secondaryActions"
<gr-dropdown id="moreActions" link="" vertical-offset="32" horizontal-align="right">
<iron-icon icon="gr-icons:more-vert" aria-labelledby="moreMessage">
</iron-icon>
<span id="moreMessage">More</span>
</gr-dropdown>
</div>
<!-- end commit actions -->
</div>
<!-- end header -->
<h2 class="assistive-tech-only">Change metadata</h2>
<div class="changeInfo">
<div class="changeInfo-column changeMetadata hideOnMobileOverlay">
<gr-change-metadata id="metadata">
</gr-change-metadata>
</div>
<div id="mainChangeInfo" class="changeInfo-column mainChangeInfo">
<div id="commitAndRelated" class="hideOnMobileOverlay">
<div class="commitContainer">
<h3 class="assistive-tech-only">Commit Message</h3>
<div>
<gr-button id="replyBtn" class="reply" primary="" title="Open reply dialog to publish comments and add reviewers (shortcut: a)" tabindex="0" role="button">Reply</gr-button>
</div>
<div id="commitMessage" class="commitMessage">
<gr-editable-content id="commitMessageEditor" remove-zero-width-space="">
<gr-linked-text pre="" remove-zero-width-space=""></gr-linked-text>
</gr-editable-content>
</div>
<gr-change-summary>
</gr-change-summary>
<gr-endpoint-decorator name="commit-container">
<gr-endpoint-param name="change">
</gr-endpoint-param>
<gr-endpoint-param name="revision">
</gr-endpoint-param>
</gr-endpoint-decorator>
</div>
<div class="relatedChanges">
<gr-related-changes-list id="relatedChanges"></gr-related-changes-list>
</div>
<div class="emptySpace"></div>
</div>
</div>
</div>
</section> , end of <section class="changeInfoSection">在这个文件中 polygerrit-ui\app\elements\change\gr-change-view\gr-change-view_html.ts 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<section class="changeInfoSection">
<div class$="[[_computeHeaderClass(_editMode)]]"> 最上一行的, <div class="header"> 右边显示 rebase按钮, abandon 按钮的那一行
<h1 class="assistive-tech-only">
Change [[_change._number]]: [[_change.subject]] 左边 标题 Change 263820: [KTUS-9106][BT][Bugfix]Fix reboot cause by BLUETOOTH_CONNECT permission
</h1>
<div class="headerTitle">
<div class="changeStatuses">
<template is="dom-repeat" items="[[_changeStatuses]]" as="status">
<gr-change-status
max-width="100"
status="[[status]]"
></gr-change-status>
</template>
</div>
<gr-change-star
id="changeStar"
change="{{_change}}"
on-toggle-star="_handleToggleStar"
hidden$="[[!_loggedIn]]"
></gr-change-star>
<a
class="changeNumber"
aria-label$="[[_computeChangePermalinkAriaLabel(_change._number)]]"
href$="[[_computeChangeUrl(_change)]]"
>[[_change._number]]</a
>
<span class="changeNumberColon">: </span>
<span class="headerSubject">[[_change.subject]]</span>
<gr-copy-clipboard
class="changeCopyClipboard"
hide-input=""
text="[[_computeCopyTextForTitle(_change)]]"
>
</gr-copy-clipboard>
</div>
<!-- end headerTitle -->
<div class="commitActions" hidden$="[[!_loggedIn]]"> 右边显示 rebase按钮, abandon 按钮的
<gr-change-actions
id="actions"
change="[[_change]]"
disable-edit="[[disableEdit]]"
has-parent="[[hasParent]]"
actions="[[_change.actions]]"
revision-actions="{{_currentRevisionActions}}"
account="[[_account]]"
change-num="[[_changeNum]]"
change-status="[[_change.status]]"
commit-num="[[_commitInfo.commit]]"
latest-patch-num="[[_computeLatestPatchNum(_allPatchSets)]]"
commit-message="[[_latestCommitMessage]]"
edit-patchset-loaded="[[_hasEditPatchsetLoaded(_patchRange.*)]]"
edit-mode="[[_editMode]]"
edit-based-on-current-patch-set="[[_hasEditBasedOnCurrentPatchSet(_allPatchSets)]]"
private-by-default="[[_projectConfig.private_by_default]]"
on-edit-tap="_handleEditTap"
on-stop-edit-tap="_handleStopEditTap"
on-download-tap="_handleOpenDownloadDialog"
comment-threads="[[_commentThreads]]"
></gr-change-actions>
</div>
<!-- end commit actions -->
</div>
<!-- end header 最上一行的, <div class="header"> 右边显示 rebase按钮, abandon 按钮的那一行 -->
<h2 class="assistive-tech-only">Change metadata</h2>
<div class="changeInfo">
<div class="changeInfo-column changeMetadata hideOnMobileOverlay">
<gr-change-metadata
id="metadata"
change="{{_change}}"
account="[[_account]]"
revision="[[_selectedRevision]]"
commit-info="[[_commitInfo]]"
server-config="[[_serverConfig]]"
parent-is-current="[[_parentIsCurrent]]"
on-show-reply-dialog="_handleShowReplyDialog"
>
</gr-change-metadata>
</div>
<div id="mainChangeInfo" class="changeInfo-column mainChangeInfo">
<div id="commitAndRelated" class="hideOnMobileOverlay">
<div class="commitContainer">
<h3 class="assistive-tech-only">Commit Message</h3>
<div>
<gr-button
id="replyBtn"
class="reply"
title="[[createTitle(Shortcut.OPEN_REPLY_DIALOG,
ShortcutSection.ACTIONS)]]"
hidden$="[[!_loggedIn]]"
primary=""
disabled="[[_replyDisabled]]"
on-click="_handleReplyTap"
>[[_replyButtonLabel]]</gr-button
>
</div>
<div id="commitMessage" class="commitMessage">
<gr-editable-content
id="commitMessageEditor"
editing="{{_editingCommitMessage}}"
content="{{_latestCommitMessage}}"
storage-key="[[_computeCommitMessageKey(_change._number, _change.current_revision)]]"
hide-edit-commit-message="[[_hideEditCommitMessage]]"
commit-collapsible="[[_commitCollapsible]]"
remove-zero-width-space=""
>
<gr-linked-text
pre=""
content="[[_latestCommitMessage]]"
config="[[_projectConfig.commentlinks]]"
remove-zero-width-space=""
></gr-linked-text>
</gr-editable-content>
</div>
<gr-change-summary
change-comments="[[_changeComments]]"
comment-threads="[[_commentThreads]]"
self-account="[[_account]]"
>
</gr-change-summary>
<gr-endpoint-decorator name="commit-container">
<gr-endpoint-param name="change" value="[[_change]]">
</gr-endpoint-param>
<gr-endpoint-param
name="revision"
value="[[_selectedRevision]]"
>
</gr-endpoint-param>
</gr-endpoint-decorator>
</div>
<div class="relatedChanges">
<gr-related-changes-list
change="[[_change]]"
id="relatedChanges"
mergeable="[[_mergeable]]"
patch-num="[[_computeLatestPatchNum(_allPatchSets)]]"
></gr-related-changes-list>
</div>
<div class="emptySpace"></div>
</div>
</div>
</div>
</section>moreActions 最右边 3个 点的那个 按钮.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62<div class="dropdown-content" slot="dropdown-content" style="box-sizing: border-box; max-width: 124.85px; max-height: 219.667px;">
<ul>
<dom-if style="display: none;"><template is="dom-if"></template></dom-if>
<li tabindex="-1" class="selected">
<gr-tooltip-content title="Cherry pick change to a different branch" has-tooltip="">
<span tabindex="-1" class="itemAction " data-id="cherrypick-revision">Cherry pick</span>
<a class="itemAction" tabindex="-1" href="" hidden="true">Cherry pick</a>
</gr-tooltip-content>
</li>
<li tabindex="-1">
<gr-tooltip-content title="Open download dialog" has-tooltip=""> ./polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts:181: title: 'Open download dialog',
<span tabindex="-1" class="itemAction " data-id="download-revision">Download patch</span>
<a class="itemAction" tabindex="-1" href="" hidden="true">Download patch</a>
</gr-tooltip-content>
</li>
<li tabindex="-1">
<gr-tooltip-content title="Delete change 1" has-tooltip="">
<span tabindex="-1" class="itemAction " data-id="delete-change">Delete change</span>
<a class="itemAction" tabindex="-1" href="" hidden="true">Delete change</a>
</gr-tooltip-content>
</li>
<li tabindex="-1">
<gr-tooltip-content title="Create follow-up change" has-tooltip=""> ./java/com/google/gerrit/server/change/ActionJson.java:187: descr.setTitle("Create follow-up change");
<span tabindex="-1" class="itemAction " data-id="followup-change">Follow-up</span>
<a class="itemAction" tabindex="-1" href="" hidden="true">Follow-up</a>
</gr-tooltip-content>
</li>
<li tabindex="-1">
<gr-tooltip-content title="Mark change as private" has-tooltip="">
<span tabindex="-1" class="itemAction " data-id="private-change">Mark private</span>
<a class="itemAction" tabindex="-1" href="" hidden="true">Mark private</a>
</gr-tooltip-content>
</li>
<li tabindex="-1">
<gr-tooltip-content title="Move change to a different branch" has-tooltip=""> ./java/com/google/gerrit/server/restapi/change/Move.java:287: .setTitle("Move change to a different branch")
<span tabindex="-1" class="itemAction " data-id="move-change">Move change</span>
<a class="itemAction" tabindex="-1" href="" hidden="true">Move change</a>
</gr-tooltip-content>
</li>
<li tabindex="-1">
<gr-tooltip-content title="Delete change 1" has-tooltip=""> ./java/com/google/gerrit/server/restapi/change/DeleteChange.java:71: .setTitle("Delete change " + rsrc.getId())
<span tabindex="-1" class="itemAction " data-id="delete-change">Delete change</span>
<a class="itemAction" tabindex="-1" href="" hidden="true">Delete change</a>
</gr-tooltip-content>
</li>
<li tabindex="-1">
<gr-tooltip-content title="Set Work In Progress" has-tooltip=""> ./java/com/google/gerrit/server/restapi/change/SetWorkInProgress.java:79: .setTitle("Set Work In Progress")
<span tabindex="-1" class="itemAction " data-id="wip-change">Mark as work in progress</span>
<a class="itemAction" tabindex="-1" href="" hidden="true">Mark as work in progress</a>
</gr-tooltip-content>
</li>
<dom-repeat as="link" initial-count="75" style="display: none;"><template is="dom-repeat"></template></dom-repeat>
</ul>
</div>
需求: 修改 页面上 commit id 显示成完整的,默认是只显示前几位的。
操作方法: 先浏览器上 右键 选择 检查 查看 这个html元素, 是在哪里,看在哪个div里面? 有什么 关键词? id 什么的?
这里实际 搜到了 一个 gr-commit-info 关键词。然后还看出来这个 commit id是在 一个 标签中。
右边还有个 复制到剪切板的 按钮。这个按钮有个提示 Copy full SHA to clipboard 这个也是个关键词。
我们就拿 gr-commit-info关键词 去代码里面搜,如果没搜到 再拿 Copy full SHA to clipboard 去搜。
总之 这一步就是要找到 我们要修改的 地方 在源码的 哪里的。。。。
最终我们搜到 这个文件 polygerrit-ui\app\elements\change\gr-commit-info\gr-commit-info.ts, 在render() 方法中我们看到了想要的 标签,和旁边的 复制到剪切板
1 | override render() { |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 马哥私房菜!