summaryrefslogtreecommitdiffstats
path: root/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header.html
blob: fb862603e3dc11c801bcc25cdf10a82343de0d10 (plain)
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
<!--
Copyright (C) 2017 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/gr-patch-set-behavior/gr-patch-set-behavior.html">
<link rel="import" href="../../../styles/shared-styles.html">
<link rel="import" href="../../core/gr-navigation/gr-navigation.html">
<link rel="import" href="../../diff/gr-patch-range-select/gr-patch-range-select.html">
<link rel="import" href="../../shared/gr-editable-label/gr-editable-label.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/gr-button/gr-button.html">


<dom-module id="gr-file-list-header">
  <template>
    <style include="shared-styles">
      .prefsButton {
        float: right;
      }
      .collapseToggleButton {
        text-decoration: none;
      }
      .patchInfoEdit.patchInfo-header {
        background-color: #fcfad6;
      }
      .patchInfoOldPatchSet.patchInfo-header {
        background-color: #fff9c4;
      }
      .patchInfo-header {
        background-color: #fafafa;
        border-bottom: 1px solid #ddd;
        border-top: 1px solid #ddd;
        display: flex;
        min-height: 3.2em;
        padding: .5em var(--default-horizontal-margin);
      }
      .patchInfo-header-wrapper {
        align-items: center;
        display: flex;
        width: 100%;
      }
      .patchInfo-left {
        align-items: center;
        display: flex;
        flex-wrap: wrap;
      }
      .patchInfo-header-wrapper .container.latestPatchContainer {
        display: none;
      }
      .patchInfoOldPatchSet .container.latestPatchContainer {
        display: initial;
      }
      .latestPatchContainer a {
        text-decoration: none;
      }
      gr-editable-label.descriptionLabel {
        max-width: 100%;
      }
      .mobile {
        display: none;
      }
      #diffPrefsContainer,
      .rightControls {
        align-self: flex-end;
        margin: auto 0 auto auto;
      }
      .showOnEdit {
        display: none;
      }
      .editLoaded .hideOnEdit {
        display: none;
      }
      .editLoaded .showOnEdit {
        display: initial;
      }
      .patchInfo-header-wrapper .container {
        align-items: center;
        display: flex;
      }
      #modeSelect {
        margin-left: .1em;
      }
      .fileList-header {
        align-items: center;
        display: flex;
        font-weight: bold;
        height: 2.25em;
        margin: 0 calc(var(--default-horizontal-margin) / 2);
        padding: 0 .25em;
      }
      .rightControls {
        align-items: center;
        display: flex;
        flex-wrap: wrap;
        font-weight: normal;
        justify-content: flex-end;
      }
      .separator {
        background-color: rgba(0, 0, 0, .3);
        height: 1.5em;
        margin: 0 .6em;
        width: 1px;
      }
      .separator.transparent {
        background-color: transparent;
      }
      .expandInline {
        padding-right: .25em;
      }
      .editLoaded .hideOnEdit {
        display: none;
      }
      .editLoaded .showOnEdit {
        display: initial;
      }
      .label {
        font-family: var(--font-family-bold);
        margin-right: 1em;
      }
      .container.includedInContainer.hide {
        display: none;
      }
      @media screen and (max-width: 50em) {
        .patchInfo-header .desktop {
          display: none;
        }
      }
    </style>
    <div class$="patchInfo-header [[_computeEditLoadedClass(editLoaded)]] [[_computePatchInfoClass(patchNum, allPatchSets)]]">
      <div class="patchInfo-header-wrapper">
        <div class="patchInfo-left">
          <h3 class="label">Files</h3>
          <gr-patch-range-select
              id="rangeSelect"
              comments="[[comments]]"
              change-num="[[changeNum]]"
              patch-num="[[patchNum]]"
              base-patch-num="[[basePatchNum]]"
              available-patches="[[allPatchSets]]"
              revisions="[[change.revisions]]"
              on-patch-range-change="_handlePatchChange">
          </gr-patch-range-select>
          <span class="separator"></span>
          <gr-commit-info
              change="[[change]]"
              server-config="[[serverConfig]]"
              commit-info="[[commitInfo]]"></gr-commit-info>
          <span class="container latestPatchContainer">
            <span class="separator"></span>
            <a href$="[[changeUrl]]">Go to latest patch set</a>
          </span>
          <span class="container downloadContainer desktop">
            <span class="separator"></span>
            <gr-button link
                class="download"
                on-tap="_handleDownloadTap">Download</gr-button>
          </span>
        <span class$="container includedInContainer [[_hideIncludedIn(change)]] desktop">
          <span class="separator"></span>
          <gr-button link
              class="includedIn"
              on-tap="_handleIncludedInTap">Included In</gr-button>
        </span>
          <span class="container descriptionContainer hideOnEdit">
            <span class="separator"></span>
            <gr-editable-label
                id="descriptionLabel"
                class="descriptionLabel"
                label-text="Add patchset description"
                value="[[_computePatchSetDescription(change, patchNum)]]"
                placeholder="[[_computeDescriptionPlaceholder(_descriptionReadOnly)]]"
                read-only="[[_descriptionReadOnly]]"
                on-changed="_handleDescriptionChanged"></gr-editable-label>
          </span>
        </div>
        <span id="diffPrefsContainer"
            class="hideOnEdit"
            hidden$="[[_computePrefsButtonHidden(diffPrefs, loggedIn)]]"
            hidden>
          <gr-button link
              class="prefsButton desktop"
              on-tap="_handlePrefsTap">Diff Preferences</gr-button>
        </span>
      </div>
    </div>
    <div class="fileList-header">
      <div class="rightControls">
        <template is="dom-if"
            if="[[_fileListActionsVisible(shownFileCount, _maxFilesForBulkActions)]]">
          <gr-button
              id="expandBtn"
              link
              on-tap="_expandAllDiffs">Show diffs</gr-button>
          <span class="separator"></span>
          <gr-button
              id="collapseBtn"
              link
              on-tap="_collapseAllDiffs">Hide diffs</gr-button>
        </template>
        <template is="dom-if"
            if="[[!_fileListActionsVisible(shownFileCount, _maxFilesForBulkActions)]]">
          <div class="warning">
            Bulk actions disabled because there are too many files.
          </div>
        </template>
        <span class="separator"></span>
        <gr-select
            id="modeSelect"
            bind-value="{{diffViewMode}}">
          <select>
            <option value="SIDE_BY_SIDE">Side By Side</option>
            <option value="UNIFIED_DIFF">Unified</option>
          </select>
        </gr-select>
      </div>
    </div>
    <gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
  </template>
  <script src="gr-file-list-header.js"></script>
</dom-module>