Merge "New change summary - introduce edit pencil"
This commit is contained in:
@@ -49,7 +49,15 @@ export const htmlTemplate = html`
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
.hashtagChip {
|
.hashtagChip {
|
||||||
margin-bottom: var(--spacing-m);
|
padding-bottom: var(--spacing-s);
|
||||||
|
}
|
||||||
|
/* consistent with section .title, .value */
|
||||||
|
.hashtagChip.new-change-summary-true:not(last-of-type) {
|
||||||
|
padding-bottom: var(--spacing-s);
|
||||||
|
}
|
||||||
|
.hashtagChip.new-change-summary-true:last-of-type {
|
||||||
|
display: inline;
|
||||||
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
#externalStyle {
|
#externalStyle {
|
||||||
display: block;
|
display: block;
|
||||||
@@ -340,6 +348,7 @@ export const htmlTemplate = html`
|
|||||||
placeholder="[[_computeTopicPlaceholder(_topicReadOnly)]]"
|
placeholder="[[_computeTopicPlaceholder(_topicReadOnly)]]"
|
||||||
read-only="[[_topicReadOnly]]"
|
read-only="[[_topicReadOnly]]"
|
||||||
on-changed="_handleTopicChanged"
|
on-changed="_handleTopicChanged"
|
||||||
|
show-as-edit-pencil="[[_isNewChangeSummaryUiEnabled]]"
|
||||||
></gr-editable-label>
|
></gr-editable-label>
|
||||||
</template>
|
</template>
|
||||||
</span>
|
</span>
|
||||||
@@ -377,7 +386,7 @@ export const htmlTemplate = html`
|
|||||||
<span class="value">
|
<span class="value">
|
||||||
<template is="dom-repeat" items="[[change.hashtags]]">
|
<template is="dom-repeat" items="[[change.hashtags]]">
|
||||||
<gr-linked-chip
|
<gr-linked-chip
|
||||||
class="hashtagChip"
|
class$="hashtagChip new-change-summary-[[_isNewChangeSummaryUiEnabled]]"
|
||||||
text="[[item]]"
|
text="[[item]]"
|
||||||
href="[[_computeHashtagUrl(item)]]"
|
href="[[_computeHashtagUrl(item)]]"
|
||||||
removable="[[!_hashtagReadOnly]]"
|
removable="[[!_hashtagReadOnly]]"
|
||||||
@@ -394,6 +403,7 @@ export const htmlTemplate = html`
|
|||||||
placeholder="[[_computeHashtagPlaceholder(_hashtagReadOnly)]]"
|
placeholder="[[_computeHashtagPlaceholder(_hashtagReadOnly)]]"
|
||||||
read-only="[[_hashtagReadOnly]]"
|
read-only="[[_hashtagReadOnly]]"
|
||||||
on-changed="_handleHashtagChanged"
|
on-changed="_handleHashtagChanged"
|
||||||
|
show-as-edit-pencil="[[_isNewChangeSummaryUiEnabled]]"
|
||||||
></gr-editable-label>
|
></gr-editable-label>
|
||||||
</template>
|
</template>
|
||||||
</span>
|
</span>
|
||||||
|
@@ -42,6 +42,7 @@ import {hasOwnProperty} from '../../../utils/common-util';
|
|||||||
import {isRemovableReviewer} from '../../../utils/change-util';
|
import {isRemovableReviewer} from '../../../utils/change-util';
|
||||||
import {ReviewerState} from '../../../constants/constants';
|
import {ReviewerState} from '../../../constants/constants';
|
||||||
import {appContext} from '../../../services/app-context';
|
import {appContext} from '../../../services/app-context';
|
||||||
|
import {KnownExperimentId} from '../../../services/flags/flags';
|
||||||
|
|
||||||
@customElement('gr-reviewer-list')
|
@customElement('gr-reviewer-list')
|
||||||
export class GrReviewerList extends GestureEventListeners(
|
export class GrReviewerList extends GestureEventListeners(
|
||||||
@@ -87,8 +88,21 @@ export class GrReviewerList extends GestureEventListeners(
|
|||||||
@property({type: Object})
|
@property({type: Object})
|
||||||
_xhrPromise?: Promise<Response | undefined>;
|
_xhrPromise?: Promise<Response | undefined>;
|
||||||
|
|
||||||
|
@property({type: Boolean})
|
||||||
|
_isNewChangeSummaryUiEnabled = false;
|
||||||
|
|
||||||
private readonly restApiService = appContext.restApiService;
|
private readonly restApiService = appContext.restApiService;
|
||||||
|
|
||||||
|
private readonly flagsService = appContext.flagsService;
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
ready() {
|
||||||
|
super.ready();
|
||||||
|
this._isNewChangeSummaryUiEnabled = this.flagsService.isEnabled(
|
||||||
|
KnownExperimentId.NEW_CHANGE_SUMMARY_UI
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@computed('ccsOnly')
|
@computed('ccsOnly')
|
||||||
get _addLabel() {
|
get _addLabel() {
|
||||||
return this.ccsOnly ? 'Add CC' : 'Add reviewer';
|
return this.ccsOnly ? 'Add CC' : 'Add reviewer';
|
||||||
|
@@ -28,6 +28,16 @@ export const htmlTemplate = html`
|
|||||||
.container {
|
.container {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
.addReviewer iron-icon {
|
||||||
|
color: inherit;
|
||||||
|
--iron-icon-height: 18px;
|
||||||
|
--iron-icon-width: 18px;
|
||||||
|
}
|
||||||
|
gr-button.addReviewer.new-change-summary-true {
|
||||||
|
--padding: 1px 4px;
|
||||||
|
vertical-align: top;
|
||||||
|
top: 1px;
|
||||||
|
}
|
||||||
gr-button {
|
gr-button {
|
||||||
--gr-button: {
|
--gr-button: {
|
||||||
padding: 0px 0px;
|
padding: 0px 0px;
|
||||||
@@ -51,6 +61,16 @@ export const htmlTemplate = html`
|
|||||||
>
|
>
|
||||||
</gr-account-chip>
|
</gr-account-chip>
|
||||||
</template>
|
</template>
|
||||||
|
<template is="dom-if" if="[[_isNewChangeSummaryUiEnabled]]">
|
||||||
|
<gr-button
|
||||||
|
link=""
|
||||||
|
id="addReviewer"
|
||||||
|
class="addReviewer new-change-summary-true"
|
||||||
|
on-click="_handleAddTap"
|
||||||
|
title="[[_addLabel]]"
|
||||||
|
><iron-icon icon="gr-icons:edit"></iron-icon
|
||||||
|
></gr-button>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<gr-button
|
<gr-button
|
||||||
class="hiddenReviewers"
|
class="hiddenReviewers"
|
||||||
@@ -59,6 +79,7 @@ export const htmlTemplate = html`
|
|||||||
on-click="_handleViewAll"
|
on-click="_handleViewAll"
|
||||||
>and [[_hiddenReviewerCount]] more</gr-button
|
>and [[_hiddenReviewerCount]] more</gr-button
|
||||||
>
|
>
|
||||||
|
<template is="dom-if" if="[[!_isNewChangeSummaryUiEnabled]]">
|
||||||
<div class="controlsContainer" hidden$="[[!mutable]]">
|
<div class="controlsContainer" hidden$="[[!mutable]]">
|
||||||
<gr-button
|
<gr-button
|
||||||
link=""
|
link=""
|
||||||
@@ -68,5 +89,6 @@ export const htmlTemplate = html`
|
|||||||
>[[_addLabel]]</gr-button
|
>[[_addLabel]]</gr-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
@@ -36,6 +36,7 @@ suite('gr-reviewer-list tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('controls hidden on immutable element', () => {
|
test('controls hidden on immutable element', () => {
|
||||||
|
flush();
|
||||||
element.mutable = false;
|
element.mutable = false;
|
||||||
assert.isTrue(element.shadowRoot
|
assert.isTrue(element.shadowRoot
|
||||||
.querySelector('.controlsContainer').hasAttribute('hidden'));
|
.querySelector('.controlsContainer').hasAttribute('hidden'));
|
||||||
@@ -48,6 +49,7 @@ suite('gr-reviewer-list tests', () => {
|
|||||||
element.addEventListener('show-reply-dialog', () => {
|
element.addEventListener('show-reply-dialog', () => {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
flush();
|
||||||
MockInteractions.tap(element.shadowRoot
|
MockInteractions.tap(element.shadowRoot
|
||||||
.querySelector('.addReviewer'));
|
.querySelector('.addReviewer'));
|
||||||
});
|
});
|
||||||
|
@@ -89,6 +89,9 @@ export class GrEditableLabel extends KeyboardShortcutMixin(
|
|||||||
@property({type: Number})
|
@property({type: Number})
|
||||||
readonly _verticalOffset = -30;
|
readonly _verticalOffset = -30;
|
||||||
|
|
||||||
|
@property({type: Boolean})
|
||||||
|
showAsEditPencil = false;
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
ready() {
|
ready() {
|
||||||
super.ready();
|
super.ready();
|
||||||
|
@@ -68,13 +68,32 @@ export const htmlTemplate = html`
|
|||||||
}
|
}
|
||||||
--paper-input-container-focus-color: var(--link-color);
|
--paper-input-container-focus-color: var(--link-color);
|
||||||
}
|
}
|
||||||
|
gr-button iron-icon {
|
||||||
|
color: inherit;
|
||||||
|
--iron-icon-height: 18px;
|
||||||
|
--iron-icon-width: 18px;
|
||||||
|
}
|
||||||
|
gr-button.new-change-summary-true {
|
||||||
|
--padding: 1px 4px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<template is="dom-if" if="[[!showAsEditPencil]]">
|
||||||
<label
|
<label
|
||||||
class$="[[_computeLabelClass(readOnly, value, placeholder)]]"
|
class$="[[_computeLabelClass(readOnly, value, placeholder)]]"
|
||||||
title$="[[_computeLabel(value, placeholder)]]"
|
title$="[[_computeLabel(value, placeholder)]]"
|
||||||
on-click="_showDropdown"
|
on-click="_showDropdown"
|
||||||
>[[_computeLabel(value, placeholder)]]</label
|
>[[_computeLabel(value, placeholder)]]</label
|
||||||
>
|
>
|
||||||
|
</template>
|
||||||
|
<template is="dom-if" if="[[showAsEditPencil]]">
|
||||||
|
<gr-button
|
||||||
|
link=""
|
||||||
|
class$="new-change-summary-true [[_computeLabelClass(readOnly, value, placeholder)]]"
|
||||||
|
on-click="_showDropdown"
|
||||||
|
title="[[_computeLabel(value, placeholder)]]"
|
||||||
|
><iron-icon icon="gr-icons:edit"></iron-icon
|
||||||
|
></gr-button>
|
||||||
|
</template>
|
||||||
<iron-dropdown
|
<iron-dropdown
|
||||||
id="dropdown"
|
id="dropdown"
|
||||||
vertical-align="auto"
|
vertical-align="auto"
|
||||||
|
@@ -45,6 +45,7 @@ suite('gr-editable-label tests', () => {
|
|||||||
setup(async () => {
|
setup(async () => {
|
||||||
element = basicFixture.instantiate();
|
element = basicFixture.instantiate();
|
||||||
elementNoPlaceholder = noPlaceholderFixture.instantiate();
|
elementNoPlaceholder = noPlaceholderFixture.instantiate();
|
||||||
|
flush();
|
||||||
label = element.shadowRoot.querySelector('label');
|
label = element.shadowRoot.querySelector('label');
|
||||||
|
|
||||||
await flush();
|
await flush();
|
||||||
@@ -178,6 +179,7 @@ suite('gr-editable-label tests', () => {
|
|||||||
|
|
||||||
setup(() => {
|
setup(() => {
|
||||||
element = readOnlyFixture.instantiate();
|
element = readOnlyFixture.instantiate();
|
||||||
|
flush();
|
||||||
label = element.shadowRoot
|
label = element.shadowRoot
|
||||||
.querySelector('label');
|
.querySelector('label');
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user