Files
gerrit/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.html
Becky Siegel 61ecc0cf10 Update gr-confirm-rebase-dialog with tailored options
The three rebase options are
1. Rebase on parent change
2. Rebase on top of the <branch name> branch
3. Rebase on a specific change or ref

Scenarios:

Has parent, can rebase on parent
- Show all 3 options. Second two options show "breaks relation chain"
  message.

Has parent, can't rebase on parent
- Instead of option 1, show message that is up to date with parent.
- Show second two options with "breaks relation chain" message.

Has no parent, can rebase on parent (tip of branch)
- Do not show option 1, nor dipslay message in its place.
- Show second two options without "breaks relation chain" message.

Has no parent, can't rebase on parent (tip of branch)
- Do not show option 1, nor dipslay message in its place.
- Instead of option, show message that change is up to date with tip of
  branch already
- Show option 3  without "breaks relation chain" message.

Because 'hasParent' isn't immediately known when change actions are
displayed, the rebase button will also remain disabled until this
becomes known.

Bug: Issue 5447
Change-Id: I45ef8241a75c1f5d197ed64e51b19c5ce74d0227
2017-02-22 22:32:39 +00:00

151 lines
5.4 KiB
HTML

<!--
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="../../../bower_components/iron-input/iron-input.html">
<link rel="import" href="../../../behaviors/rest-client-behavior.html">
<link rel="import" href="../../shared/gr-button/gr-button.html">
<link rel="import" href="../../shared/gr-dropdown/gr-dropdown.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-rebase-dialog/gr-confirm-rebase-dialog.html">
<link rel="import" href="../gr-confirm-revert-dialog/gr-confirm-revert-dialog.html">
<dom-module id="gr-change-actions">
<template>
<style>
:host {
display: inline-block;
font-family: var(--font-family);
}
section {
display: inline-block;
}
gr-button,
gr-dropdown {
margin-left: .5em;
}
gr-button:before {
content: attr(data-label);
}
#actionLoadingMessage {
color: #777;
}
@media screen and (max-width: 50em) {
:host,
section,
gr-button,
gr-dropdown {
display: block;
}
gr-button,
gr-dropdown {
margin-bottom: .5em;
margin-left: 0;
}
.confirmDialog {
width: 90vw;
}
#actionLoadingMessage {
display: block;
margin: .5em;
text-align: center;
}
}
</style>
<div>
<span
id="actionLoadingMessage"
hidden$="[[!_actionLoadingMessage]]">
[[_actionLoadingMessage]]</span>
<gr-dropdown
id="moreActions"
down-arrow
vertical-offset="32"
horizontal-align="right"
on-tap-item-cherrypick="_handleCherrypickTap"
on-tap-item-delete="_handleDeleteTap"
hidden$="[[_shouldHideActions(_menuActions.*, _loading)]]"
disabled-ids="[[_disabledMenuActions]]"
items="[[_menuActions]]">More</gr-dropdown>
<section hidden$="[[_shouldHideActions(_topLevelActions.*, _loading)]]">
<template
is="dom-repeat"
items="[[_topLevelActions]]"
as="action">
<gr-button title$="[[action.title]]"
primary$="[[action.__primary]]"
data-action-key$="[[action.__key]]"
data-action-type$="[[action.__type]]"
data-label$="[[action.label]]"
disabled$="[[_calculateDisabled(action, _hasKnownChainState)]]"
on-tap="_handleActionTap"></gr-button>
</template>
</section>
<gr-button hidden$="[[!_loading]]" disabled>Loading actions...</gr-button>
</div>
<gr-overlay id="overlay" with-backdrop>
<gr-confirm-rebase-dialog id="confirmRebase"
class="confirmDialog"
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"
hidden></gr-confirm-cherrypick-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-dialog
id="confirmDeleteDialog"
class="confirmDialog"
confirm-label="Delete"
on-cancel="_handleConfirmDialogCancel"
on-confirm="_handleDeleteConfirm">
<div class="header">
Delete Change
</div>
<div class="main">
Do you really want to delete the change?
</div>
</gr-confirm-dialog>
</gr-overlay>
<gr-js-api-interface id="jsAPI"></gr-js-api-interface>
<gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
</template>
<script src="gr-change-actions.js"></script>
</dom-module>