Files
gerrit/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.html
Marco Miller 5a89becdb0 Merge branch 'stable-3.0' into stable-3.1
* stable-3.0:
  Open relative commentlinks in same tab
  VersionedMetaData: Emit debug log after update has been committed
  VersionedMetaData: Trim message sent to log
  ChangeIdHandler: Make assumption on number of query results explicit
  ChangeIdHandler: Remove unnecessary 'final' modifiers
  Update git submodules
  AbstractQueryChangesTest: Add method to create change as private
  AbstractQueryChangesTest: Fix comment in byPrivate
  AbstractQueryChangesTest: Use overloaded newChange method where possible
  AbstractQueryChangesTest: Extend testing of visibleto predicate
  ChangeQueryBuilder: Rename status_open to statusOpen
  ChangeQueryBuilder: Rename is_visible to isVisible
  ChangeNotificationsIT: Fix eclipse warning(s) about static use
  Extract duplicated code of {Ssh|Http}LogJsonLayout
  Add option to log SSH events in JSON format
  Remove duplicated constants storing key names of Ssh logs
  Add option to log HTTP logging events in JSON format
  CacheMetrics: Make F_NAME a final constant in class scope
  Fix more cases where Collection.isEmpty() should be used
  Use Set instead of EnumSet in method signatures
  Replace negation of anyMatch() with noneMatch()
  AllExternalIds: Replace lambdas with method references
  PostReview: Replace filter and findFirst with anyMatch
  XContentBuilder: Use UTF_8 from Java's StandardCharsets rather than Guava
  Update git submodules
  Update git submodules
  Update git submodules
  QueryDocumentationExecutor: Make WEIGHTS final and use ImmutableMap
  BooleanProjectConfigTransformations: Make MAPPER final
  TestSubmitRuleInfo: Make INSTANCE final
  TrackingFootersProvider: Make constants final
  ChangeCleanupConfig: Make constants final
  SetParent: Simplify lambda expression
  ProjectsConsistencyChecker: Simplify lambda expression
  Remove redundant null checks used with "instanceof"
  Remove unnecessary array creation for varargs parameters
  Remove redundant parentheses in lambda statements
  PreferencesBox: Remove unnecessary boxing to Boolean
  GitwebServlet: Rename bufferSize to BUFFER_SIZE and make static
  GetPatch: Make FILE_NOT_FOUND static
  DeleteZombieCommentsRefs: Make constants static
  AbstractNotificationTest: Make constants static and rename
  TabFile: Make TRIM final
  Remove redundant calls to toString()
  OpenIdServiceImpl: Fix incorrect null comparison of Optional
  Consistently use isEmpty to check for empty collection
  PageLinks: Reuse ADMIN_PROJECTS constant
  PageLinks: Fix typo in method name
  FlushCaches: Use isEmpty to check for empty list
  JGitMetricModule: Replace anonymous Supplier instances with method references
  Adapt to deprecation of WindowCacheStats methods in JGit
  Documentation: Fix collapsed words and broken link
  Use Flogger instead of System.out.println in DeleteZombieCommentsRefs
  Fix a dependency injection runtime error in DeleteZombieDrafts pgm
  Update git submodules
  Bazel: Move runtime dependencies only from deps to runtime_deps
  Update rename project documentation in project owner guide
  Fix issues with caching edited commit message
  Add "edit" button to diff view
  Remove egit plugin from project owner guide Documentation
  Error Prone: Enable and fix OperatorPrecedence
  Bazel: Remove superfluous dependencies flagged by unused_deps
  GerritBaseTests: Activate test logging
  Revert "Enable optional DEBUG level logs for query tests"
  Allow to control the Gerrit log level for running tests from system var
  Revert "Acceptance: set log threshold level for tests"
  Reduce log level for tests to INFO
  Bazel: Update time attribute of file entries in plugin artifact
  Add Jetty connection metrics
  Add additional JGit WindowCache metrics
  Update JGit to 5.1.13.202002110435-r
  BucketedCallback: fix prune() to remove unset sub-metrics from registry
  Modify draft ref updates commits to point to an empty parent

Change-Id: I0039bf12f018706b400f905491a515e2e957b3ec
2020-02-21 15:22:07 -05:00

372 lines
13 KiB
HTML

<!--
@license
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel="import" href="/bower_components/polymer/polymer.html">
<link rel="import" href="../../../behaviors/fire-behavior/fire-behavior.html">
<link rel="import" href="../../../behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html">
<link rel="import" href="../../../behaviors/gr-path-list-behavior/gr-path-list-behavior.html">
<link rel="import" href="../../../behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html">
<link rel="import" href="../../../behaviors/rest-client-behavior/rest-client-behavior.html">
<link rel="import" href="/bower_components/iron-dropdown/iron-dropdown.html">
<link rel="import" href="/bower_components/iron-input/iron-input.html">
<link rel="import" href="../../../styles/shared-styles.html">
<link rel="import" href="../../core/gr-navigation/gr-navigation.html">
<link rel="import" href="../../core/gr-reporting/gr-reporting.html">
<link rel="import" href="../../shared/gr-button/gr-button.html">
<link rel="import" href="../../shared/gr-count-string-formatter/gr-count-string-formatter.html">
<link rel="import" href="../../shared/gr-dropdown/gr-dropdown.html">
<link rel="import" href="../../shared/gr-dropdown-list/gr-dropdown-list.html">
<link rel="import" href="../../shared/gr-fixed-panel/gr-fixed-panel.html">
<link rel="import" href="../../shared/gr-icons/gr-icons.html">
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
<link rel="import" href="../../shared/gr-select/gr-select.html">
<link rel="import" href="../../shared/revision-info/revision-info.html">
<link rel="import" href="../gr-comment-api/gr-comment-api.html">
<link rel="import" href="../gr-diff-cursor/gr-diff-cursor.html">
<link rel="import" href="../gr-diff-host/gr-diff-host.html">
<link rel="import" href="../gr-diff-mode-selector/gr-diff-mode-selector.html">
<link rel="import" href="../gr-diff-preferences-dialog/gr-diff-preferences-dialog.html">
<link rel="import" href="../gr-patch-range-select/gr-patch-range-select.html">
<dom-module id="gr-diff-view">
<template>
<style include="shared-styles">
:host {
background-color: var(--view-background-color);
}
.hidden {
display: none;
}
gr-patch-range-select {
display: block;
}
gr-diff {
border: none;
--diff-container-styles: {
border-bottom: 1px solid var(--border-color);
}
}
gr-fixed-panel {
background-color: var(--view-background-color);
border-bottom: 1px solid var(--border-color);
z-index: 1;
}
header,
.subHeader {
align-items: center;
display: flex;
justify-content: space-between;
}
header {
padding: var(--spacing-s) var(--spacing-l);
}
.patchRangeLeft {
align-items: center;
display: flex;
}
.navLink:not([href]) {
color: var(--deemphasized-text-color);
}
.navLinks {
align-items: center;
display: flex;
white-space: nowrap;
}
.navLink {
padding: 0 var(--spacing-xs);
}
.reviewed {
display: inline-block;
margin: 0 var(--spacing-xs);
vertical-align: .15em;
}
.jumpToFileContainer {
display: inline-block;
}
.mobile {
display: none;
}
gr-button {
padding: var(--spacing-s) 0;
text-decoration: none;
}
.loading {
color: var(--deemphasized-text-color);
font-size: var(--font-size-h1);
height: 100%;
padding: var(--spacing-l);
text-align: center;
}
.subHeader {
flex-wrap: wrap;
padding: 0 var(--spacing-l) var(--spacing-s);
}
.prefsButton {
text-align: right;
}
.noOverflow {
display: block;
overflow: auto;
}
.editMode .hideOnEdit {
display: none;
}
.blameLoader,
.fileNum {
display: none;
}
.blameLoader.show,
.fileNum.show ,
.download,
.preferences,
.rightControls {
align-items: center;
display: flex;
}
.diffModeSelector,
.editButton {
align-items: center;
display: flex;
}
.diffModeSelector span,
.editButton span {
margin-right: var(--spacing-xs);
}
.diffModeSelector.hide,
.separator.hide {
display: none;
}
gr-dropdown-list {
--trigger-style: {
text-transform: none;
}
}
.editButtona a {
text-decoration: none;
}
@media screen and (max-width: 50em) {
header {
padding: var(--spacing-s) var(--spacing-l);
}
.dash {
display: none;
}
.desktop {
display: none;
}
.fileNav {
align-items: flex-start;
display: flex;
margin: 0 var(--spacing-xs);
}
.fullFileName {
display: block;
font-style: italic;
min-width: 50%;
padding: 0 var(--spacing-xxs);
text-align: center;
width: 100%;
word-wrap: break-word;
}
.reviewed {
vertical-align: -1px;
}
.mobileNavLink {
color: var(--primary-text-color);
font-size: var(--font-size-h2);
font-weight: var(--font-weight-bold);
text-decoration: none;
}
.mobileNavLink:not([href]) {
color: var(--deemphasized-text-color);
}
.jumpToFileContainer {
display: block;
width: 100%;
}
gr-dropdown-list {
width: 100%;
--gr-select-style: {
display: block;
width: 100%;
}
--native-select-style: {
width: 100%;
}
}
}
</style>
<gr-fixed-panel
class$="[[_computeContainerClass(_editMode)]]"
floating-disabled="[[_panelFloatingDisabled]]"
keep-on-scroll
ready-for-measure="[[!_loading]]">
<header>
<h3>
<a href$="[[_computeChangePath(_change, _patchRange.*, _change.revisions)]]">
[[_changeNum]]</a><span>:</span>
<span>[[_change.subject]]</span>
<span class="dash"></span>
<input id="reviewed"
class="reviewed hideOnEdit"
type="checkbox"
on-change="_handleReviewedChange"
hidden$="[[!_loggedIn]]" hidden>
<div class="jumpToFileContainer">
<gr-dropdown-list
id="dropdown"
value="[[_path]]"
on-value-change="_handleFileChange"
items="[[_formattedFiles]]"
initial-count="75">
</gr-dropdown-list>
</div>
</h3>
<div class="navLinks desktop">
<span class$="fileNum [[_computeFileNumClass(_fileNum, _formattedFiles)]]">
File [[_fileNum]] of [[_formattedFiles.length]]
<span class="separator"></span>
</span>
<a class="navLink"
href$="[[_computeNavLinkURL(_change, _path, _fileList, -1, 1)]]">
Prev</a>
<span class="separator"></span>
<a class="navLink"
href$="[[_computeChangePath(_change, _patchRange.*, _change.revisions)]]">
Up</a>
<span class="separator"></span>
<a class="navLink"
href$="[[_computeNavLinkURL(_change, _path, _fileList, 1, 1)]]">
Next</a>
</div>
</header>
<div class="subHeader">
<div class="patchRangeLeft">
<gr-patch-range-select
id="rangeSelect"
change-num="[[_changeNum]]"
change-comments="[[_changeComments]]"
patch-num="[[_patchRange.patchNum]]"
base-patch-num="[[_patchRange.basePatchNum]]"
files-weblinks="[[_filesWeblinks]]"
available-patches="[[_allPatchSets]]"
revisions="[[_change.revisions]]"
revision-info="[[_revisionInfo]]"
on-patch-range-change="_handlePatchChange">
</gr-patch-range-select>
<span class="download desktop">
<span class="separator"></span>
<gr-dropdown
link
down-arrow
items="[[_computeDownloadDropdownLinks(_change.project, _changeNum, _patchRange, _path, _diff)]]"
horizontal-align="left">
<span class="downloadTitle">
Download
</span>
</gr-dropdown>
</span>
</div>
<div class="rightControls">
<span class$="blameLoader [[_computeBlameLoaderClass(_isImageDiff)]]">
<gr-button
link
disabled="[[_isBlameLoading]]"
on-click="_toggleBlame">[[_computeBlameToggleLabel(_isBlameLoaded, _isBlameLoading)]]</gr-button>
<span class="separator"></span>
</span>
<template is="dom-if" if="[[_computeIsLoggedIn(_loggedIn)]]">
<span class="editButton">
<a href$="[[_computeEditURL(_change, _patchRange, _path)]]">
<iron-icon icon="gr-icons:edit"></iron-icon>
</a>
<span class="separator"></span>
</span>
</template>
<div class$="diffModeSelector [[_computeModeSelectHideClass(_isImageDiff)]]">
<span>Diff view:</span>
<gr-diff-mode-selector
id="modeSelect"
save-on-change="[[!_diffPrefsDisabled]]"
mode="{{changeViewState.diffMode}}"></gr-diff-mode-selector>
</div>
<span id="diffPrefsContainer"
hidden$="[[_computePrefsButtonHidden(_prefs, _diffPrefsDisabled)]]" hidden>
<span class="preferences desktop">
<gr-button
link
class="prefsButton"
has-tooltip
title="Diff preferences"
on-click="_handlePrefsTap"><iron-icon icon="gr-icons:settings"></iron-icon></gr-button>
</span>
</span>
<gr-endpoint-decorator name="annotation-toggler">
<span hidden id="annotation-span">
<label for="annotation-checkbox" id="annotation-label"></label>
<iron-input type="checkbox" disabled>
<input is="iron-input" type="checkbox" id="annotation-checkbox" disabled>
</iron-input>
</span>
</gr-endpoint-decorator>
</div>
</div>
<div class="fileNav mobile">
<a class="mobileNavLink"
href$="[[_computeNavLinkURL(_change, _path, _fileList, -1, 1)]]">
&lt;</a>
<div class="fullFileName mobile">[[computeDisplayPath(_path)]]
</div>
<a class="mobileNavLink"
href$="[[_computeNavLinkURL(_change, _path, _fileList, 1, 1)]]">
&gt;</a>
</div>
</gr-fixed-panel>
<div class="loading" hidden$="[[!_loading]]">Loading...</div>
<gr-diff-host
id="diffHost"
hidden
hidden$="[[_loading]]"
class$="[[_computeDiffClass(_panelFloatingDisabled)]]"
is-image-diff="{{_isImageDiff}}"
files-weblinks="{{_filesWeblinks}}"
diff="{{_diff}}"
change-num="[[_changeNum]]"
commit-range="[[_commitRange]]"
patch-range="[[_patchRange]]"
path="[[_path]]"
prefs="[[_prefs]]"
project-name="[[_change.project]]"
view-mode="[[_diffMode]]"
is-blame-loaded="{{_isBlameLoaded}}"
on-comment-anchor-tap="_onLineSelected"
on-line-selected="_onLineSelected">
</gr-diff-host>
<gr-diff-preferences-dialog
id="diffPreferencesDialog"
diff-prefs="{{_prefs}}"
on-reload-diff-preference="_handleReloadingDiffPreference">
</gr-diff-preferences-dialog>
<gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
<gr-storage id="storage"></gr-storage>
<gr-diff-cursor id="cursor"></gr-diff-cursor>
<gr-comment-api id="commentAPI"></gr-comment-api>
<gr-reporting id="reporting"></gr-reporting>
</template>
<script src="gr-diff-view.js"></script>
</dom-module>