Merge changes from topic "pg-includedin" into stable-2.15
* changes: Included-In dialog polish PolyGerrit: Add support for "Included In"
This commit is contained in:
@@ -36,6 +36,7 @@ limitations under the License.
|
|||||||
<link rel="import" href="../gr-download-dialog/gr-download-dialog.html">
|
<link rel="import" href="../gr-download-dialog/gr-download-dialog.html">
|
||||||
<link rel="import" href="../gr-file-list/gr-file-list.html">
|
<link rel="import" href="../gr-file-list/gr-file-list.html">
|
||||||
<link rel="import" href="../gr-file-list-header/gr-file-list-header.html">
|
<link rel="import" href="../gr-file-list-header/gr-file-list-header.html">
|
||||||
|
<link rel="import" href="../gr-included-in-dialog/gr-included-in-dialog.html">
|
||||||
<link rel="import" href="../gr-messages-list/gr-messages-list.html">
|
<link rel="import" href="../gr-messages-list/gr-messages-list.html">
|
||||||
<link rel="import" href="../gr-related-changes-list/gr-related-changes-list.html">
|
<link rel="import" href="../gr-related-changes-list/gr-related-changes-list.html">
|
||||||
<link rel="import" href="../gr-reply-dialog/gr-reply-dialog.html">
|
<link rel="import" href="../gr-reply-dialog/gr-reply-dialog.html">
|
||||||
@@ -203,6 +204,9 @@ limitations under the License.
|
|||||||
.scrollable {
|
.scrollable {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
#includedInOverlay {
|
||||||
|
width: 65em;
|
||||||
|
}
|
||||||
@media screen and (min-width: 80em) {
|
@media screen and (min-width: 80em) {
|
||||||
.commitMessage {
|
.commitMessage {
|
||||||
max-width: var(--commit-message-max-width, 100ch);
|
max-width: var(--commit-message-max-width, 100ch);
|
||||||
@@ -439,6 +443,7 @@ limitations under the License.
|
|||||||
revisions="[[_sortedRevisions]]"
|
revisions="[[_sortedRevisions]]"
|
||||||
on-open-diff-prefs="_handleOpenDiffPrefs"
|
on-open-diff-prefs="_handleOpenDiffPrefs"
|
||||||
on-open-download-dialog="_handleOpenDownloadDialog"
|
on-open-download-dialog="_handleOpenDownloadDialog"
|
||||||
|
on-open-included-in-dialog="_handleOpenIncludedInDialog"
|
||||||
on-expand-diffs="_expandAllDiffs"
|
on-expand-diffs="_expandAllDiffs"
|
||||||
on-collapse-diffs="_collapseAllDiffs">
|
on-collapse-diffs="_collapseAllDiffs">
|
||||||
</gr-file-list-header>
|
</gr-file-list-header>
|
||||||
@@ -476,6 +481,12 @@ limitations under the License.
|
|||||||
config="[[_serverConfig.download]]"
|
config="[[_serverConfig.download]]"
|
||||||
on-close="_handleDownloadDialogClose"></gr-download-dialog>
|
on-close="_handleDownloadDialogClose"></gr-download-dialog>
|
||||||
</gr-overlay>
|
</gr-overlay>
|
||||||
|
<gr-overlay id="includedInOverlay" with-backdrop>
|
||||||
|
<gr-included-in-dialog
|
||||||
|
id="includedInDialog"
|
||||||
|
change-num="[[_changeNum]]"
|
||||||
|
on-close="_handleIncludedInDialogClose"></gr-included-in-dialog>
|
||||||
|
</gr-overlay>
|
||||||
<gr-overlay id="replyOverlay"
|
<gr-overlay id="replyOverlay"
|
||||||
class="scrollable"
|
class="scrollable"
|
||||||
no-cancel-on-outside-click
|
no-cancel-on-outside-click
|
||||||
|
|||||||
@@ -410,6 +410,19 @@
|
|||||||
this.$.fileList.openDiffPrefs();
|
this.$.fileList.openDiffPrefs();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
_handleOpenIncludedInDialog() {
|
||||||
|
this.$.includedInDialog.loadData().then(() => {
|
||||||
|
Polymer.dom.flush();
|
||||||
|
this.$.includedInOverlay.refit();
|
||||||
|
});
|
||||||
|
this.$.includedInOverlay.open();
|
||||||
|
},
|
||||||
|
|
||||||
|
_handleIncludedInDialogClose(e) {
|
||||||
|
this.$.includedInOverlay.close();
|
||||||
|
},
|
||||||
|
|
||||||
_handleOpenDownloadDialog() {
|
_handleOpenDownloadDialog() {
|
||||||
this.$.downloadOverlay.open().then(() => {
|
this.$.downloadOverlay.open().then(() => {
|
||||||
this.$.downloadOverlay
|
this.$.downloadOverlay
|
||||||
|
|||||||
@@ -131,6 +131,9 @@ limitations under the License.
|
|||||||
font-family: var(--font-family-bold);
|
font-family: var(--font-family-bold);
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
}
|
}
|
||||||
|
.container.includedInContainer.hide {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
@media screen and (max-width: 50em) {
|
@media screen and (max-width: 50em) {
|
||||||
.patchInfo-header .desktop {
|
.patchInfo-header .desktop {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -166,6 +169,12 @@ limitations under the License.
|
|||||||
class="download"
|
class="download"
|
||||||
on-tap="_handleDownloadTap">Download</gr-button>
|
on-tap="_handleDownloadTap">Download</gr-button>
|
||||||
</span>
|
</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="container descriptionContainer hideOnEdit">
|
||||||
<span class="separator"></span>
|
<span class="separator"></span>
|
||||||
<gr-editable-label
|
<gr-editable-label
|
||||||
|
|||||||
@@ -148,6 +148,11 @@
|
|||||||
this.fire('open-diff-prefs');
|
this.fire('open-diff-prefs');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_handleIncludedInTap(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
this.fire('open-included-in-dialog');
|
||||||
|
},
|
||||||
|
|
||||||
_handleDownloadTap(e) {
|
_handleDownloadTap(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.fire('open-download-dialog');
|
this.fire('open-download-dialog');
|
||||||
@@ -168,5 +173,9 @@
|
|||||||
}
|
}
|
||||||
return 'patchInfoOldPatchSet';
|
return 'patchInfoOldPatchSet';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_hideIncludedIn(change) {
|
||||||
|
return change && change.status === 'MERGED' ? '' : 'hide';
|
||||||
|
},
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
<!--
|
||||||
|
Copyright (C) 2018 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="../../../styles/shared-styles.html">
|
||||||
|
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
|
||||||
|
|
||||||
|
<dom-module id="gr-included-in-dialog">
|
||||||
|
<template>
|
||||||
|
<style include="shared-styles">
|
||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
max-height: 80vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 4.5em 1em 1em 1em;
|
||||||
|
}
|
||||||
|
header {
|
||||||
|
background: #fff;
|
||||||
|
border-bottom: 1px solid #cdcdcd;
|
||||||
|
left: 0;
|
||||||
|
padding: 1em;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
#title {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
margin-top: .2em;
|
||||||
|
}
|
||||||
|
h2 {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
#filterInput {
|
||||||
|
display: inline-block;
|
||||||
|
float: right;
|
||||||
|
margin: 0 1em;
|
||||||
|
padding: .2em;
|
||||||
|
}
|
||||||
|
.closeButtonContainer {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
ul li {
|
||||||
|
border-radius: .2em;
|
||||||
|
background: #eee;
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 .2em .4em .2em;
|
||||||
|
padding: .2em .4em;
|
||||||
|
}
|
||||||
|
.loading.loaded {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<header>
|
||||||
|
<h1 id="title">Included In:</h1>
|
||||||
|
<span class="closeButtonContainer">
|
||||||
|
<gr-button id="closeButton"
|
||||||
|
link
|
||||||
|
on-tap="_handleCloseTap">Close</gr-button>
|
||||||
|
</span>
|
||||||
|
<input
|
||||||
|
id="filterInput"
|
||||||
|
is="iron-input"
|
||||||
|
placeholder="Filter"
|
||||||
|
on-bind-value-changed="_onFilterChanged">
|
||||||
|
</header>
|
||||||
|
<div class$="[[_computeLoadingClass(_loaded)]]">Loading...</div>
|
||||||
|
<template
|
||||||
|
is="dom-repeat"
|
||||||
|
items="[[_computeGroups(_includedIn, _filterText)]]"
|
||||||
|
as="group">
|
||||||
|
<div>
|
||||||
|
<h2>[[group.title]]:</h2>
|
||||||
|
<ul>
|
||||||
|
<template is="dom-repeat" items="[[group.items]]">
|
||||||
|
<li>[[item]]</li>
|
||||||
|
</template>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
|
||||||
|
</template>
|
||||||
|
<script src="gr-included-in-dialog.js"></script>
|
||||||
|
</dom-module>
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
// Copyright (C) 2018 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.
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Polymer({
|
||||||
|
is: 'gr-included-in-dialog',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fired when the user presses the close button.
|
||||||
|
*
|
||||||
|
* @event close
|
||||||
|
*/
|
||||||
|
|
||||||
|
properties: {
|
||||||
|
/** @type {?} */
|
||||||
|
changeNum: {
|
||||||
|
type: Object,
|
||||||
|
observer: '_resetData',
|
||||||
|
},
|
||||||
|
/** @type {?} */
|
||||||
|
_includedIn: Object,
|
||||||
|
_loaded: {
|
||||||
|
type: Boolean,
|
||||||
|
value: false,
|
||||||
|
},
|
||||||
|
_filterText: {
|
||||||
|
type: String,
|
||||||
|
value: '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
loadData() {
|
||||||
|
if (!this.changeNum) { return; }
|
||||||
|
this._filterText = '';
|
||||||
|
return this.$.restAPI.getChangeIncludedIn(this.changeNum).then(
|
||||||
|
configs => {
|
||||||
|
if (!configs) { return; }
|
||||||
|
this._includedIn = configs;
|
||||||
|
this._loaded = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
_resetData() {
|
||||||
|
this._includedIn = null;
|
||||||
|
this._loaded = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
_computeGroups(includedIn, filterText) {
|
||||||
|
if (!includedIn) { return []; }
|
||||||
|
|
||||||
|
const filter = item => !filterText.length ||
|
||||||
|
item.toLowerCase().indexOf(filterText.toLowerCase()) !== -1;
|
||||||
|
|
||||||
|
const groups = [
|
||||||
|
{title: 'Branches', items: includedIn.branches.filter(filter)},
|
||||||
|
{title: 'Tags', items: includedIn.tags.filter(filter)},
|
||||||
|
];
|
||||||
|
if (includedIn.external) {
|
||||||
|
for (const externalKey of Object.keys(includedIn.external)) {
|
||||||
|
groups.push({
|
||||||
|
title: externalKey,
|
||||||
|
items: includedIn.external[externalKey].filter(filter),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return groups.filter(g => g.items.length);
|
||||||
|
},
|
||||||
|
|
||||||
|
_handleCloseTap(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
this.fire('close', null, {bubbles: false});
|
||||||
|
},
|
||||||
|
|
||||||
|
_computeLoadingClass(loaded) {
|
||||||
|
return loaded ? 'loading loaded' : 'loading';
|
||||||
|
},
|
||||||
|
|
||||||
|
_onFilterChanged() {
|
||||||
|
this.debounce('filter-change', () => {
|
||||||
|
this._filterText = this.$.filterInput.bindValue;
|
||||||
|
}, 100);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
})();
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2018 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||||
|
<title>gr-included-in-dialog</title>
|
||||||
|
|
||||||
|
<script src="../../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
|
||||||
|
<script src="../../../bower_components/web-component-tester/browser.js"></script>
|
||||||
|
<link rel="import" href="../../../test/common-test-setup.html"/>
|
||||||
|
<link rel="import" href="gr-included-in-dialog.html">
|
||||||
|
|
||||||
|
<script>void(0);</script>
|
||||||
|
|
||||||
|
<test-fixture id="basic">
|
||||||
|
<template>
|
||||||
|
<gr-included-in-dialog></gr-included-in-dialog>
|
||||||
|
</template>
|
||||||
|
</test-fixture>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
suite('gr-included-in-dialog', () => {
|
||||||
|
let element;
|
||||||
|
let sandbox;
|
||||||
|
|
||||||
|
setup(() => {
|
||||||
|
sandbox = sinon.sandbox.create();
|
||||||
|
element = fixture('basic');
|
||||||
|
});
|
||||||
|
|
||||||
|
teardown(() => { sandbox.restore(); });
|
||||||
|
|
||||||
|
test('_computeGroups', () => {
|
||||||
|
const includedIn = {branches: [], tags: []};
|
||||||
|
let filterText = '';
|
||||||
|
assert.deepEqual(element._computeGroups(includedIn, filterText), []);
|
||||||
|
|
||||||
|
includedIn.branches.push('master', 'development', 'stable-2.0');
|
||||||
|
includedIn.tags.push('v1.9', 'v2.0', 'v2.1');
|
||||||
|
assert.deepEqual(element._computeGroups(includedIn, filterText), [
|
||||||
|
{title: 'Branches', items: ['master', 'development', 'stable-2.0']},
|
||||||
|
{title: 'Tags', items: ['v1.9', 'v2.0', 'v2.1']},
|
||||||
|
]);
|
||||||
|
|
||||||
|
includedIn.external = {};
|
||||||
|
assert.deepEqual(element._computeGroups(includedIn, filterText), [
|
||||||
|
{title: 'Branches', items: ['master', 'development', 'stable-2.0']},
|
||||||
|
{title: 'Tags', items: ['v1.9', 'v2.0', 'v2.1']},
|
||||||
|
]);
|
||||||
|
|
||||||
|
includedIn.external.foo = ['abc', 'def', 'ghi'];
|
||||||
|
assert.deepEqual(element._computeGroups(includedIn, filterText), [
|
||||||
|
{title: 'Branches', items: ['master', 'development', 'stable-2.0']},
|
||||||
|
{title: 'Tags', items: ['v1.9', 'v2.0', 'v2.1']},
|
||||||
|
{title: 'foo', items: ['abc', 'def', 'ghi']},
|
||||||
|
]);
|
||||||
|
|
||||||
|
filterText = 'v2';
|
||||||
|
assert.deepEqual(element._computeGroups(includedIn, filterText), [
|
||||||
|
{title: 'Tags', items: ['v2.0', 'v2.1']},
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Filtering is case-insensitive.
|
||||||
|
filterText = 'V2';
|
||||||
|
assert.deepEqual(element._computeGroups(includedIn, filterText), [
|
||||||
|
{title: 'Tags', items: ['v2.0', 'v2.1']},
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -986,6 +986,13 @@
|
|||||||
opt_errFn, null, params);
|
opt_errFn, null, params);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number|string} changeNum
|
||||||
|
*/
|
||||||
|
getChangeIncludedIn(changeNum) {
|
||||||
|
return this._getChangeURLAndFetch(changeNum, '/in', null);
|
||||||
|
},
|
||||||
|
|
||||||
_computeFilter(filter) {
|
_computeFilter(filter) {
|
||||||
if (filter && filter.startsWith('^')) {
|
if (filter && filter.startsWith('^')) {
|
||||||
filter = '&r=' + encodeURIComponent(filter);
|
filter = '&r=' + encodeURIComponent(filter);
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ limitations under the License.
|
|||||||
'change/gr-download-dialog/gr-download-dialog_test.html',
|
'change/gr-download-dialog/gr-download-dialog_test.html',
|
||||||
'change/gr-file-list-header/gr-file-list-header_test.html',
|
'change/gr-file-list-header/gr-file-list-header_test.html',
|
||||||
'change/gr-file-list/gr-file-list_test.html',
|
'change/gr-file-list/gr-file-list_test.html',
|
||||||
|
'change/gr-included-in-dialog/gr-included-in-dialog_test.html',
|
||||||
'change/gr-label-score-row/gr-label-score-row_test.html',
|
'change/gr-label-score-row/gr-label-score-row_test.html',
|
||||||
'change/gr-label-scores/gr-label-scores_test.html',
|
'change/gr-label-scores/gr-label-scores_test.html',
|
||||||
'change/gr-message/gr-message_test.html',
|
'change/gr-message/gr-message_test.html',
|
||||||
|
|||||||
Reference in New Issue
Block a user