Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/65842
Change subject: Story 755: Add event logging to editing
......................................................................
Story 755: Add event logging to editing
Change-Id: Id63c15675d33c0c7cf1072ea48060856ac1ebeeb
---
M javascripts/modules/editor/EditorOverlay.js
1 file changed, 43 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/42/65842/1
diff --git a/javascripts/modules/editor/EditorOverlay.js
b/javascripts/modules/editor/EditorOverlay.js
index 7130f67..f36595b 100644
--- a/javascripts/modules/editor/EditorOverlay.js
+++ b/javascripts/modules/editor/EditorOverlay.js
@@ -19,6 +19,32 @@
template: M.template.get( 'overlays/editor' ),
className: 'mw-mf-overlay editor-overlay',
+ log: function( actionId, errorText ) {
+ var
+ actions = {
+ 0: 'attempt',
+ 1: 'cancel',
+ 2: 'submit',
+ 3: 'success',
+ 4: 'error',
+ 5: 'sectionPrevious',
+ 6: 'sectionNext',
+ 7: 'save'
+ },
+ data = {
+ token: M.getSessionId(),
+ action: actions[actionId],
+ section: this.sectionId,
+ pageId: mw.config.get( 'wgArticleId' ),
+ username: mw.config.get( 'wgUserName' ),
+ mobileMode: mw.config.get( 'wgMFMode' ),
+ userAgent: window.navigator.userAgent
+ };
+ if ( errorText ) {
+ data.errorText = errorText;
+ }
+ M.log( 'MobileWebEditing', data );
+ },
initialize: function( options ) {
var self = this;
this._super( options );
@@ -38,17 +64,25 @@
this.$prev = this.$( '.prev-section' ).
on( 'click', function() {
self._loadSection( self.sectionId - 1 );
+ self.log( 5 );
} );
this.$next = this.$( '.next-section' ).
on( 'click', function() {
self._loadSection( self.sectionId + 1 );
+ self.log( 6 );
} );
this.$( '.save' ).on( 'click', function() {
+ // log save button click
+ self.log( 7 );
self.$( '.count' ).text( mw.msg(
'mobile-frontend-editor-section-count', self.api.getStagedCount() ) );
self.$( '.initial-bar' ).hide();
self.$( '.confirm-bar' ).show();
} );
this.$( '.confirm-save' ).on( 'click', $.proxy( this,
'_save' ) );
+ this.$( '.cancel' ).on( 'click', function() {
+ // log cancel attempt
+ self.log( 1 );
+ } );
// This is used to avoid position: fixed weirdness in
mobile Safari when
// the keyboard is visible
@@ -63,6 +97,8 @@
}
this._loadSection( options.section );
+ // log section edit attempt
+ self.log( 0 );
},
hide: function() {
@@ -110,17 +146,22 @@
} else {
popup.show( mw.msg(
'mobile-frontend-editor-error-loading' ), 'toast error' );
}
+ // log error that occurred in
retrieving section
+ self.log( 4, error );
} );
},
_save: function() {
var self = this;
+ self.log( 2 );
this.$( '.confirm-bar' ).hide();
this.$( '.saving-bar' ).show();
this.api.save().
done( function() {
+ // log success!
+ self.log( 3 );
self.hide();
popup.show(
mw.msg(
'mobile-frontend-editor-success' ) + ' ' + mw.msg(
'mobile-frontend-editor-refresh' ),
@@ -139,6 +180,8 @@
popup.show( msg, 'toast error' );
self.$( '.saving-bar' ).hide();
self.$( '.initial-bar' ).show();
+ // log error that occurred in
retrieving section
+ self.log( 4, err );
} );
}
} );
--
To view, visit https://gerrit.wikimedia.org/r/65842
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id63c15675d33c0c7cf1072ea48060856ac1ebeeb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits