Revert "[client-app] Measure and report inline composer open times + consolidate timers"

This reverts commit f467664bde.

# Conflicts:
#	packages/client-app/src/flux/stores/draft-store.es6
This commit is contained in:
Ben Gotow 2017-06-23 16:21:28 -07:00
parent 2d423eeac3
commit 799ccce640
4 changed files with 51 additions and 100 deletions

View file

@ -52,7 +52,6 @@ export default class ComposerView extends React.Component {
}
componentDidMount() {
this._recordComposerOpenTime()
if (this.props.session) {
this._setupForProps(this.props);
}
@ -84,31 +83,6 @@ export default class ComposerView extends React.Component {
}
}
_recordComposerOpenTime() {
const {draft: {threadId, replyToMessageId}} = this.props
if (NylasEnv.isComposerWindow()) { return }
// This method only records inline composer opening times. Composer window
// opening times are recorded in ComposerWithWindowPros
const replyTimerKey = `compose-reply-${replyToMessageId}`
const forwardTimerKey = `compose-forward-${threadId}`
let actionTimeMs;
if (NylasEnv.timer.isPending(replyTimerKey)) {
actionTimeMs = NylasEnv.timer.stop(replyTimerKey)
}
if (NylasEnv.timer.isPending(forwardTimerKey)) {
actionTimeMs = NylasEnv.timer.stop(forwardTimerKey)
}
if (actionTimeMs != null) {
Actions.recordPerfMetric({
action: 'open-inline-composer',
actionTimeMs,
maxValue: 4000,
sample: 0.9,
})
}
}
_keymapHandlers() {
return {
'composer:send-message': () => this._onPrimarySend(),

View file

@ -48,8 +48,20 @@ class ComposerWithWindowProps extends React.Component {
_onDraftReady = () => {
this.refs.composer.focus().then(() => {
if (NylasEnv.timer.isPending('open-composer-window')) {
const actionTimeMs = NylasEnv.timer.stop('open-composer-window');
if (actionTimeMs && actionTimeMs <= 4000) {
Actions.recordUserEvent("Composer Popout Timed", {timeInMs: actionTimeMs})
}
// TODO time when plugins actually get loaded in
Actions.recordPerfMetric({
action: 'open-composer-window',
actionTimeMs,
maxValue: 4000,
sample: 0.9,
})
}
NylasEnv.displayWindow();
this._recordComposerOpenTime()
if (this.state.errorMessage) {
this._showInitialErrorDialog(this.state.errorMessage, this.state.errorDetail);
@ -70,24 +82,6 @@ class ComposerWithWindowProps extends React.Component {
});
}
_recordComposerOpenTime() {
const {timerId} = NylasEnv.getWindowProps()
const timerKey = `open-composer-window-${timerId}`
if (NylasEnv.timer.isPending(timerKey)) {
const actionTimeMs = NylasEnv.timer.stop(timerKey);
if (actionTimeMs && actionTimeMs <= 4000) {
// TODO do we still need to record this legacy event?
Actions.recordUserEvent("Composer Popout Timed", {timeInMs: actionTimeMs})
}
Actions.recordPerfMetric({
action: 'open-composer-window',
actionTimeMs,
maxValue: 4000,
sample: 0.9,
})
}
}
render() {
return (
<ComposerViewForDraftClientId

View file

@ -74,8 +74,7 @@ class MessageControls extends React.Component
Actions.composeReply({thread, message, type: 'reply-all', behavior: 'prefer-existing-if-pristine'})
_onForward: =>
{thread, message} = @props
Actions.composeForward({thread, message})
Actions.composeForward(thread: @props.thread, message: @props.message)
_onShowActionsMenu: =>
SystemMenu = remote.Menu

View file

@ -13,7 +13,6 @@ import SyncbackDraftTask from '../tasks/syncback-draft-task';
import DestroyDraftTask from '../tasks/destroy-draft-task';
import Thread from '../models/thread';
import Message from '../models/message';
import Utils from '../models/utils';
import Actions from '../actions';
import TaskQueue from './task-queue';
import SoundRegistry from '../../registries/sound-registry';
@ -188,9 +187,6 @@ class DraftStore extends NylasStore {
this._modelifyContext({thread, threadId, message, messageId})
)
.then(({message: m, thread: t}) => {
if (['reply', 'reply-all'].includes(type)) {
NylasEnv.timer.start(`compose-reply-${m.id}`)
}
return DraftFactory.createOrUpdateDraftForReply({message: m, thread: t, type, behavior});
})
.then(draft => {
@ -204,7 +200,6 @@ class DraftStore extends NylasStore {
this._modelifyContext({thread, threadId, message, messageId})
)
.then(({thread: t, message: m}) => {
NylasEnv.timer.start(`compose-forward-${t.id}`)
return DraftFactory.createDraftForForward({thread: t, message: m})
})
.then((draft) => {
@ -273,19 +268,14 @@ class DraftStore extends NylasStore {
}
_onPopoutNewDraftToRecipient = (contact) => {
Actions.recordUserEvent("Draft Created", {type: "new"});
const timerId = Utils.generateTempId()
NylasEnv.timer.start(`open-composer-window-${timerId}`);
return DraftFactory.createDraft({to: [contact]}).then((draft) => {
return this._finalizeAndPersistNewMessage(draft).then(({draftClientId}) => {
return this._onPopoutDraftClientId(draftClientId, {timerId, newDraft: true});
});
return this._finalizeAndPersistNewMessage(draft, {popout: true});
});
}
_onPopoutBlankDraft = () => {
Actions.recordUserEvent("Draft Created", {type: "new"});
NylasEnv.timer.start("Popout Draft");
NylasEnv.timer.start('open-composer-window');
return DraftFactory.createDraft().then((draft) => {
return this._finalizeAndPersistNewMessage(draft).then(({draftClientId}) => {
return this._onPopoutDraftClientId(draftClientId, {newDraft: true});
@ -293,50 +283,11 @@ class DraftStore extends NylasStore {
});
}
_onHandleMailtoLink = (event, urlString) => {
Actions.recordUserEvent("Draft Created", {type: "mailto"});
const timerId = Utils.generateTempId()
NylasEnv.timer.start(`open-composer-window-${timerId}`);
return DraftFactory.createDraftForMailto(urlString).then((draft) => {
return this._finalizeAndPersistNewMessage(draft).then(({draftClientId}) => {
return this._onPopoutDraftClientId(draftClientId, {timerId, newDraft: true});
});
}).catch((err) => {
NylasEnv.showErrorDialog(err.toString())
});
}
_onHandleMailFiles = (event, paths) => {
Actions.recordUserEvent("Draft Created", {type: "dropped-file-in-dock"});
const timerId = Utils.generateTempId()
NylasEnv.timer.start(`open-composer-window-${timerId}`);
return DraftFactory.createDraft().then((draft) => {
return this._finalizeAndPersistNewMessage(draft);
})
.then(({draftClientId}) => {
let remaining = paths.length;
const callback = () => {
remaining -= 1;
if (remaining === 0) {
this._onPopoutDraftClientId(draftClientId, {timerId});
}
};
paths.forEach((path) => {
Actions.addAttachment({
filePath: path,
messageClientId: draftClientId,
onUploadCreated: callback,
});
})
});
}
_onPopoutDraftClientId = (draftClientId, options = {}) => {
if (draftClientId == null) {
throw new Error("DraftStore::onPopoutDraftId - You must provide a draftClientId");
}
NylasEnv.timer.start("Popout Draft");
NylasEnv.timer.start('open-composer-window');
const title = options.newDraft ? "New Message" : "Message";
return this.sessionForClientId(draftClientId).then((session) => {
@ -349,13 +300,46 @@ class DraftStore extends NylasStore {
title,
hidden: true, // We manually show in ComposerWithWindowProps::onDraftReady
windowKey: `composer-${draftClientId}`,
windowType: "composer-preload",
windowType: 'composer-preload',
windowProps: _.extend(options, {draftClientId, draftJSON}),
});
});
});
}
_onHandleMailtoLink = (event, urlString) => {
// return is just used for specs
return DraftFactory.createDraftForMailto(urlString).then((draft) => {
return this._finalizeAndPersistNewMessage(draft, {popout: true});
}).catch((err) => {
NylasEnv.showErrorDialog(err.toString())
});
}
_onHandleMailFiles = (event, paths) => {
// return is just used for specs
return DraftFactory.createDraft().then((draft) => {
return this._finalizeAndPersistNewMessage(draft);
})
.then(({draftClientId}) => {
let remaining = paths.length;
const callback = () => {
remaining -= 1;
if (remaining === 0) {
this._onPopoutDraftClientId(draftClientId);
}
};
paths.forEach((path) => {
Actions.addAttachment({
filePath: path,
messageClientId: draftClientId,
onUploadCreated: callback,
});
})
});
}
_onDestroyDraft = (draftClientId) => {
const session = this._draftSessions[draftClientId];