blob: 716e29c54ee72ff0f835cdebffe42640a5adac2d [file] [log] [blame]
David Ostrovskye8771402016-02-13 12:23:53 +01001// Copyright (C) 2016 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14(function() {
15 'use strict';
16
17 Polymer({
18 is: 'gr-confirm-cherrypick-dialog',
19
20 /**
21 * Fired when the confirm button is pressed.
22 *
23 * @event confirm
24 */
25
26 /**
27 * Fired when the cancel button is pressed.
28 *
29 * @event cancel
30 */
31
32 properties: {
33 branch: String,
Becky Siegelf5d2e882016-11-16 12:59:59 -080034 changeStatus: String,
35 commitMessage: String,
36 commitNum: String,
Becky Siegel013648f2017-03-10 14:19:08 -080037 message: String,
Becky Siegelf5d2e882016-11-16 12:59:59 -080038 },
39
Becky Siegel013648f2017-03-10 14:19:08 -080040 observers: [
41 '_computeMessage(changeStatus, commitNum, commitMessage)',
42 ],
43
Becky Siegelf5d2e882016-11-16 12:59:59 -080044 _computeMessage: function(changeStatus, commitNum, commitMessage) {
45 var newMessage = commitMessage;
46
47 if (changeStatus === 'MERGED') {
48 newMessage += '(cherry picked from commit ' + commitNum + ')';
49 }
Becky Siegel013648f2017-03-10 14:19:08 -080050 this.message = newMessage;
David Ostrovskye8771402016-02-13 12:23:53 +010051 },
52
53 _handleConfirmTap: function(e) {
54 e.preventDefault();
55 this.fire('confirm', null, {bubbles: false});
56 },
57
58 _handleCancelTap: function(e) {
59 e.preventDefault();
60 this.fire('cancel', null, {bubbles: false});
61 },
62 });
63})();