Warn user in submit dialog about unresolved comments
Change-Id: I5cbc470686f7a80155ecbda2640eb63bef9ac259
This commit is contained in:
@@ -16,12 +16,15 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<link rel="import" href="/bower_components/polymer/polymer.html">
|
<link rel="import" href="/bower_components/polymer/polymer.html">
|
||||||
|
<link rel="import" href="/bower_components/iron-icon/iron-icon.html">
|
||||||
|
|
||||||
|
<link rel="import" href="../../shared/gr-icons/gr-icons.html">
|
||||||
<link rel="import" href="../../core/gr-navigation/gr-navigation.html">
|
<link rel="import" href="../../core/gr-navigation/gr-navigation.html">
|
||||||
<link rel="import" href="../../shared/gr-dialog/gr-dialog.html">
|
<link rel="import" href="../../shared/gr-dialog/gr-dialog.html">
|
||||||
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
|
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
|
||||||
<link rel="import" href="../../plugins/gr-endpoint-decorator/gr-endpoint-decorator.html">
|
<link rel="import" href="../../plugins/gr-endpoint-decorator/gr-endpoint-decorator.html">
|
||||||
<link rel="import" href="../../plugins/gr-endpoint-param/gr-endpoint-param.html">
|
<link rel="import" href="../../plugins/gr-endpoint-param/gr-endpoint-param.html">
|
||||||
|
|
||||||
<link rel="import" href="../../../styles/shared-styles.html">
|
<link rel="import" href="../../../styles/shared-styles.html">
|
||||||
|
|
||||||
<dom-module id="gr-confirm-submit-dialog">
|
<dom-module id="gr-confirm-submit-dialog">
|
||||||
@@ -33,6 +36,11 @@ limitations under the License.
|
|||||||
p {
|
p {
|
||||||
margin-bottom: var(--spacing-l);
|
margin-bottom: var(--spacing-l);
|
||||||
}
|
}
|
||||||
|
.warningBeforeSubmit {
|
||||||
|
color: var(--error-text-color);
|
||||||
|
vertical-align: top;
|
||||||
|
margin-right: var(--spacing-s);
|
||||||
|
}
|
||||||
@media screen and (max-width: 50em) {
|
@media screen and (max-width: 50em) {
|
||||||
#dialog {
|
#dialog {
|
||||||
min-width: inherit;
|
min-width: inherit;
|
||||||
@@ -53,7 +61,17 @@ limitations under the License.
|
|||||||
<gr-endpoint-decorator name="confirm-submit-change">
|
<gr-endpoint-decorator name="confirm-submit-change">
|
||||||
<p>Ready to submit “<strong>[[change.subject]]</strong>”?</p>
|
<p>Ready to submit “<strong>[[change.subject]]</strong>”?</p>
|
||||||
<template is="dom-if" if="[[change.is_private]]">
|
<template is="dom-if" if="[[change.is_private]]">
|
||||||
<p><strong>Heads Up!</strong> Submitting this private change will also make it public.</p>
|
<p>
|
||||||
|
<iron-icon icon="gr-icons:error" class="warningBeforeSubmit"></iron-icon>
|
||||||
|
<strong>Heads Up!</strong>
|
||||||
|
Submitting this private change will also make it public.
|
||||||
|
</p>
|
||||||
|
</template>
|
||||||
|
<template is="dom-if" if="[[change.unresolved_comment_count]]">
|
||||||
|
<p>
|
||||||
|
<iron-icon icon="gr-icons:error" class="warningBeforeSubmit"></iron-icon>
|
||||||
|
[[_computeUnresolvedCommentsWarning(change)]]
|
||||||
|
</p>
|
||||||
</template>
|
</template>
|
||||||
<gr-endpoint-param name="change" value="[[change]]"></gr-endpoint-param>
|
<gr-endpoint-param name="change" value="[[change]]"></gr-endpoint-param>
|
||||||
<gr-endpoint-param name="action" value="[[action]]"></gr-endpoint-param>
|
<gr-endpoint-param name="action" value="[[action]]"></gr-endpoint-param>
|
||||||
|
|||||||
@@ -57,6 +57,12 @@
|
|||||||
this.$.dialog.resetFocus();
|
this.$.dialog.resetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_computeUnresolvedCommentsWarning(change) {
|
||||||
|
const unresolvedCount = change.unresolved_comment_count;
|
||||||
|
const plural = unresolvedCount > 1 ? 's' : '';
|
||||||
|
return `Heads Up! ${unresolvedCount} unresolved comment${plural}.`;
|
||||||
|
}
|
||||||
|
|
||||||
_handleConfirmTap(e) {
|
_handleConfirmTap(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|||||||
@@ -61,5 +61,15 @@ limitations under the License.
|
|||||||
assert.notEqual(message.textContent.length, 0);
|
assert.notEqual(message.textContent.length, 0);
|
||||||
assert.notEqual(message.textContent.indexOf('my-subject'), -1);
|
assert.notEqual(message.textContent.indexOf('my-subject'), -1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('_computeUnresolvedCommentsWarning', () => {
|
||||||
|
const change = {unresolved_comment_count: 1};
|
||||||
|
assert.equal(element._computeUnresolvedCommentsWarning(change),
|
||||||
|
'Heads Up! 1 unresolved comment.');
|
||||||
|
|
||||||
|
const change2 = {unresolved_comment_count: 2};
|
||||||
|
assert.equal(element._computeUnresolvedCommentsWarning(change2),
|
||||||
|
'Heads Up! 2 unresolved comments.');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user