summaryrefslogtreecommitdiffstats
path: root/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.html
blob: 6b6e90bf1e545366a7db7999dd889e3f0a7ee654 (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
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
<!--
@license
Copyright (C) 2016 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="../../../behaviors/rest-client-behavior/rest-client-behavior.html">
<link rel="import" href="../../../bower_components/iron-input/iron-input.html">
<link rel="import" href="../../admin/gr-create-change-dialog/gr-create-change-dialog.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-dialog/gr-dialog.html">
<link rel="import" href="../../shared/gr-dropdown/gr-dropdown.html">
<link rel="import" href="../../shared/gr-icons/gr-icons.html">
<link rel="import" href="../../shared/gr-js-api-interface/gr-js-api-interface.html">
<link rel="import" href="../../shared/gr-overlay/gr-overlay.html">
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
<link rel="import" href="../gr-confirm-abandon-dialog/gr-confirm-abandon-dialog.html">
<link rel="import" href="../gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog.html">
<link rel="import" href="../gr-confirm-move-dialog/gr-confirm-move-dialog.html">
<link rel="import" href="../gr-confirm-rebase-dialog/gr-confirm-rebase-dialog.html">
<link rel="import" href="../gr-confirm-revert-dialog/gr-confirm-revert-dialog.html">
<link rel="import" href="../gr-confirm-submit-dialog/gr-confirm-submit-dialog.html">
<link rel="import" href="../../../styles/shared-styles.html">

<dom-module id="gr-change-actions">
  <template>
    <style include="shared-styles">
      :host {
        display: flex;
        font-family: var(--font-family);
      }
      #actionLoadingMessage,
      #mainContent,
      section {
        display: flex;
      }
      #actionLoadingMessage,
      gr-button,
      gr-dropdown {
        /* px because don't have the same font size */
        margin-left: 8px;
      }
      #actionLoadingMessage {
        align-items: center;
        color: var(--deemphasized-text-color);
      }
      #confirmSubmitDialog .changeSubject {
        margin: 1em;
        text-align: center;
      }
      iron-icon {
        color: inherit;
        height: 1.2rem;
        margin-right: .2rem;
        width: 1.2rem;
      }
      gr-button {
        min-height: 2.25em;
      }
      gr-dropdown {
        --gr-button: {
          min-height: 2.25em;
        }
      }
      #moreActions iron-icon {
        margin: 0;
      }
      #moreMessage,
      .hidden {
        display: none;
      }
      @media screen and (max-width: 50em) {
        #mainContent {
          flex-wrap: wrap;
        }
        gr-button {
          --gr-button: {
            padding: .5em;
            white-space: nowrap;
          }
        }
        gr-button,
        gr-dropdown {
          margin: 0;
        }
        #actionLoadingMessage {
          margin: .5em;
          text-align: center;
        }
        #moreMessage {
          display: inline;
        }
      }
    </style>
    <div id="mainContent">
      <span
          id="actionLoadingMessage"
          hidden$="[[!_actionLoadingMessage]]">
        [[_actionLoadingMessage]]</span>
        <section id="primaryActions"
            hidden$="[[_shouldHideActions(_topLevelActions.*, _loading)]]">
          <template
              is="dom-repeat"
              items="[[_topLevelPrimaryActions]]"
              as="action">
            <gr-button
                link
                title$="[[action.title]]"
                has-tooltip="[[_computeHasTooltip(action.title)]]"
                data-action-key$="[[action.__key]]"
                data-action-type$="[[action.__type]]"
                data-label$="[[action.label]]"
                disabled$="[[_calculateDisabled(action, _hasKnownChainState)]]"
                on-tap="_handleActionTap">
                <iron-icon class$="[[_computeHasIcon(action)]]" icon$="gr-icons:[[action.icon]]"></iron-icon>
              [[action.label]]
            </gr-button>
          </template>
        </section>
        <section id="secondaryActions"
            hidden$="[[_shouldHideActions(_topLevelActions.*, _loading)]]">
          <template
              is="dom-repeat"
              items="[[_topLevelSecondaryActions]]"
              as="action">
            <gr-button
                link
                title$="[[action.title]]"
                has-tooltip="[[_computeHasTooltip(action.title)]]"
                data-action-key$="[[action.__key]]"
                data-action-type$="[[action.__type]]"
                data-label$="[[action.label]]"
                disabled$="[[_calculateDisabled(action, _hasKnownChainState)]]"
                on-tap="_handleActionTap">
              <iron-icon class$="[[_computeHasIcon(action)]]" icon$="gr-icons:[[action.icon]]"></iron-icon>
              [[action.label]]
            </gr-button>
          </template>
        </section>
      <gr-button hidden$="[[!_loading]]" disabled>Loading actions...</gr-button>
      <gr-dropdown
          id="moreActions"
          link
          tabindex="0"
          vertical-offset="32"
          horizontal-align="right"
          on-tap-item="_handleOveflowItemTap"
          hidden$="[[_shouldHideActions(_menuActions.*, _loading)]]"
          disabled-ids="[[_disabledMenuActions]]"
          items="[[_menuActions]]">
          <iron-icon icon="gr-icons:more-vert"></iron-icon>
          <span id="moreMessage">More</span>
        </gr-dropdown>
    </div>
    <gr-overlay id="overlay" with-backdrop>
      <gr-confirm-rebase-dialog id="confirmRebase"
          class="confirmDialog"
          change-number="[[change._number]]"
          on-confirm="_handleRebaseConfirm"
          on-cancel="_handleConfirmDialogCancel"
          branch="[[change.branch]]"
          has-parent="[[hasParent]]"
          rebase-on-current="[[revisionActions.rebase.rebaseOnCurrent]]"
          hidden></gr-confirm-rebase-dialog>
      <gr-confirm-cherrypick-dialog id="confirmCherrypick"
          class="confirmDialog"
          change-status="[[changeStatus]]"
          commit-message="[[commitMessage]]"
          commit-num="[[commitNum]]"
          on-confirm="_handleCherrypickConfirm"
          on-cancel="_handleConfirmDialogCancel"
          project="[[change.project]]"
          hidden></gr-confirm-cherrypick-dialog>
      <gr-confirm-move-dialog id="confirmMove"
          class="confirmDialog"
          on-confirm="_handleMoveConfirm"
          on-cancel="_handleConfirmDialogCancel"
          project="[[change.project]]"
          hidden></gr-confirm-move-dialog>
      <gr-confirm-revert-dialog id="confirmRevertDialog"
          class="confirmDialog"
          on-confirm="_handleRevertDialogConfirm"
          on-cancel="_handleConfirmDialogCancel"
          hidden></gr-confirm-revert-dialog>
      <gr-confirm-abandon-dialog id="confirmAbandonDialog"
          class="confirmDialog"
          on-confirm="_handleAbandonDialogConfirm"
          on-cancel="_handleConfirmDialogCancel"
          hidden></gr-confirm-abandon-dialog>
      <gr-confirm-submit-dialog
          id="confirmSubmitDialog"
          class="confirmDialog"
          change="[[change]]"
          action="[[revisionActions.submit]]"
          on-cancel="_handleConfirmDialogCancel"
          on-confirm="_handleSubmitConfirm" hidden></gr-confirm-submit-dialog>
      <gr-dialog id="createFollowUpDialog"
          class="confirmDialog"
          confirm-label="Create"
          on-confirm="_handleCreateFollowUpChange"
          on-cancel="_handleCloseCreateFollowUpChange">
        <div class="header" slot="header">
          Create Follow-Up Change
        </div>
        <div class="main" slot="main">
          <gr-create-change-dialog
              id="createFollowUpChange"
              branch="[[change.branch]]"
              base-change="[[change.id]]"
              repo-name="[[change.project]]"
              private-by-default="[[privateByDefault]]"></gr-create-change-dialog>
        </div>
      </gr-dialog>
      <gr-dialog
          id="confirmDeleteDialog"
          class="confirmDialog"
          confirm-label="Delete"
          confirm-on-enter
          on-cancel="_handleConfirmDialogCancel"
          on-confirm="_handleDeleteConfirm">
        <div class="header" slot="header">
          Delete Change
        </div>
        <div class="main" slot="main">
          Do you really want to delete the change?
        </div>
      </gr-dialog>
      <gr-dialog
          id="confirmDeleteEditDialog"
          class="confirmDialog"
          confirm-label="Delete"
          confirm-on-enter
          on-cancel="_handleConfirmDialogCancel"
          on-confirm="_handleDeleteEditConfirm">
        <div class="header" slot="header">
          Delete Change Edit
        </div>
        <div class="main" slot="main">
          Do you really want to delete the edit?
        </div>
      </gr-dialog>
    </gr-overlay>
    <gr-js-api-interface id="jsAPI"></gr-js-api-interface>
    <gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
    <gr-reporting id="reporting" category="change-actions"></gr-reporting>
  </template>
  <script src="gr-change-actions.js"></script>
</dom-module>