Merge "Add event reporting for hidden messages"

This commit is contained in:
Wyatt Allen 2017-03-02 06:48:07 +00:00 committed by Gerrit Code Review
commit 386258c4c9
3 changed files with 19 additions and 1 deletions

View File

@ -15,6 +15,7 @@ limitations under the License.
-->
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../core/gr-reporting/gr-reporting.html">
<link rel="import" href="../../shared/gr-button/gr-button.html">
<link rel="import" href="../gr-message/gr-message.html">
@ -96,6 +97,7 @@ limitations under the License.
on-scroll-to="_handleScrollTo"
data-message-id$="[[message.id]]"></gr-message>
</template>
<gr-reporting id="reporting" category="message-list"></gr-reporting>
</template>
<script src="gr-messages-list.js"></script>
</dom-module>

View File

@ -17,6 +17,11 @@
var MAX_INITIAL_SHOWN_MESSAGES = 20;
var MESSAGES_INCREMENT = 5;
var ReportingEvent = {
SHOW_ALL: 'show-all-messages',
SHOW_MORE: 'show-more-messages',
};
Polymer({
is: 'gr-messages-list',
@ -272,6 +277,7 @@
_handleShowAllTap: function() {
this._visibleMessages = this._processedMessages;
this.$.reporting.reportInteraction(ReportingEvent.SHOW_ALL);
},
_handleIncrementShownMessages: function() {
@ -281,6 +287,7 @@
var newMessages = this._processedMessages.slice(-(len + delta), -len);
// Add newMessages to the beginning of _visibleMessages
this.splice.apply(this, ['_visibleMessages', 0, 0].concat(newMessages));
this.$.reporting.reportInteraction(ReportingEvent.SHOW_MORE);
},
_processedMessagesChanged: function(messages) {

View File

@ -35,6 +35,8 @@
CATEGORY: 'exception',
};
var INTERACTION_TYPE = 'interaction';
var CHANGE_VIEW_REGEX = /^\/c\/\d+\/?\d*$/;
var DIFF_VIEW_REGEX = /^\/c\/\d+\/\d+\/.+$/;
@ -69,6 +71,8 @@
is: 'gr-reporting',
properties: {
category: String,
_baselines: {
type: Array,
value: function() { return {}; },
@ -100,7 +104,8 @@
if (type === ERROR.TYPE) {
console.error(eventValue.error || eventName);
} else {
console.log(eventName + ': ' + eventValue);
console.log(eventName + (eventValue !== undefined ?
(': ' + eventValue) : ''));
}
},
@ -186,6 +191,10 @@
this.reporter(TIMING.TYPE, TIMING.CATEGORY, name, time);
delete this._baselines[name];
},
reportInteraction: function(eventName) {
this.reporter(INTERACTION_TYPE, this.category, eventName);
},
});
window.GrReporting = GrReporting;