2015-05-20 06:59:37 +08:00
|
|
|
React = require 'react'
|
2016-03-29 16:41:24 +08:00
|
|
|
ReactDOM = require 'react-dom'
|
|
|
|
ReactCSSTransitionGroup = require 'react-addons-css-transition-group'
|
2015-05-20 07:06:59 +08:00
|
|
|
_ = require 'underscore'
|
2015-05-20 06:59:37 +08:00
|
|
|
classNames = require 'classnames'
|
2016-03-29 16:41:24 +08:00
|
|
|
|
2016-04-05 08:11:09 +08:00
|
|
|
NotificationStore = require '../notifications-store'
|
|
|
|
StreamingSyncActivity = require './streaming-sync-activity'
|
2015-09-25 02:03:11 +08:00
|
|
|
InitialSyncActivity = require './initial-sync-activity'
|
2016-04-05 08:11:09 +08:00
|
|
|
|
2015-05-20 06:59:37 +08:00
|
|
|
{Actions,
|
|
|
|
TaskQueue,
|
feat(accounts): Kill namespaces, long live accounts
Summary:
This diff replaces the Namespace object with the Account object, and changes all references to namespace_id => account_id, etc. The endpoints are now `/threads` instead of `/n/<id>/threads`.
This diff also adds preliminary support for multiple accounts. When you log in, we now log you in to all the attached accounts on edgehill server. From the preferences panel, you can auth with / unlink additional accounts. Shockingly, this all seems to pretty much work.
When replying to a thread, you cannot switch from addresses. However, when creating a new message in a popout composer, you can change the from address and the SaveDraftTask will delete/re-root the draft on the new account.
Search bar doesn't need to do full refresh on clear if it never committed
Allow drafts to be switched to a different account when not in reply to an existing thread
Fix edge case where ChangeMailTask throws exception if no models are modified during performLocal
Show many dots for many accounts in long polling status bar
add/remove accounts from prefs
Spec fixes!
Test Plan: Run tests, none broken!
Reviewers: evan, dillon
Reviewed By: evan, dillon
Differential Revision: https://phab.nylas.com/D1928
2015-08-22 06:29:58 +08:00
|
|
|
AccountStore,
|
feat(work): Create the "Work" window, move TaskQueue, Nylas sync workers
Summary:
Move sync workers and Edgehill token checks to work window
Move the task queue and database setup to the work window
Move ContactStore background refresh to work window
Store the task queue in the database
WIP
The TaskQueue now puts tasks in the database instead of in a file, which also means it can be observed
Move all delta sync and initial sync to a package, make NylasSyncStore which exposes read-only sync state
DraftStore no longer reads task status. Once you set the "sending" bit on a draft, it never gets unset. But that's fine actually.
If your package lists windowTypes, you *only* get loaded in those windowTypes. If you specify no windowTypes, you get loaded in the root window.
This means that onboarding, worker-ui, worker-sync, etc. no longer get loaded into the main window
ActivitySidebar has a special little store that observes the task queue since it's no longer in the window
Move "toggle component regions" / "toggle react remote" to the Developer menu
Move sync worker specs, update draft store specs to not rely on TaskQueue at all
Test Plan: Run existing tests, all pass
Reviewers: dillon, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D1936
2015-08-28 07:39:40 +08:00
|
|
|
NylasSyncStatusStore,
|
2015-09-25 02:03:11 +08:00
|
|
|
TaskQueueStatusStore} = require 'nylas-exports'
|
2015-05-20 06:59:37 +08:00
|
|
|
|
|
|
|
class ActivitySidebar extends React.Component
|
|
|
|
@displayName: 'ActivitySidebar'
|
|
|
|
|
|
|
|
@containerRequired: false
|
2015-06-03 10:04:21 +08:00
|
|
|
@containerStyles:
|
|
|
|
minWidth: 165
|
feat(accounts): Kill namespaces, long live accounts
Summary:
This diff replaces the Namespace object with the Account object, and changes all references to namespace_id => account_id, etc. The endpoints are now `/threads` instead of `/n/<id>/threads`.
This diff also adds preliminary support for multiple accounts. When you log in, we now log you in to all the attached accounts on edgehill server. From the preferences panel, you can auth with / unlink additional accounts. Shockingly, this all seems to pretty much work.
When replying to a thread, you cannot switch from addresses. However, when creating a new message in a popout composer, you can change the from address and the SaveDraftTask will delete/re-root the draft on the new account.
Search bar doesn't need to do full refresh on clear if it never committed
Allow drafts to be switched to a different account when not in reply to an existing thread
Fix edge case where ChangeMailTask throws exception if no models are modified during performLocal
Show many dots for many accounts in long polling status bar
add/remove accounts from prefs
Spec fixes!
Test Plan: Run tests, none broken!
Reviewers: evan, dillon
Reviewed By: evan, dillon
Differential Revision: https://phab.nylas.com/D1928
2015-08-22 06:29:58 +08:00
|
|
|
maxWidth: 400
|
2015-05-20 06:59:37 +08:00
|
|
|
|
|
|
|
constructor: (@props) ->
|
|
|
|
@state = @_getStateFromStores()
|
|
|
|
|
|
|
|
componentDidMount: =>
|
|
|
|
@_unlisteners = []
|
feat(work): Create the "Work" window, move TaskQueue, Nylas sync workers
Summary:
Move sync workers and Edgehill token checks to work window
Move the task queue and database setup to the work window
Move ContactStore background refresh to work window
Store the task queue in the database
WIP
The TaskQueue now puts tasks in the database instead of in a file, which also means it can be observed
Move all delta sync and initial sync to a package, make NylasSyncStore which exposes read-only sync state
DraftStore no longer reads task status. Once you set the "sending" bit on a draft, it never gets unset. But that's fine actually.
If your package lists windowTypes, you *only* get loaded in those windowTypes. If you specify no windowTypes, you get loaded in the root window.
This means that onboarding, worker-ui, worker-sync, etc. no longer get loaded into the main window
ActivitySidebar has a special little store that observes the task queue since it's no longer in the window
Move "toggle component regions" / "toggle react remote" to the Developer menu
Move sync worker specs, update draft store specs to not rely on TaskQueue at all
Test Plan: Run existing tests, all pass
Reviewers: dillon, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D1936
2015-08-28 07:39:40 +08:00
|
|
|
@_unlisteners.push TaskQueueStatusStore.listen @_onDataChanged
|
2015-05-20 06:59:37 +08:00
|
|
|
@_unlisteners.push NotificationStore.listen @_onDataChanged
|
2015-09-25 02:03:11 +08:00
|
|
|
@_unlisteners.push NylasSyncStatusStore.listen @_onDataChanged
|
2015-05-20 06:59:37 +08:00
|
|
|
|
|
|
|
componentWillUnmount: =>
|
|
|
|
unlisten() for unlisten in @_unlisteners
|
|
|
|
|
|
|
|
render: =>
|
2015-09-25 02:03:11 +08:00
|
|
|
items = [@_renderNotificationActivityItems(), @_renderTaskActivityItems()]
|
|
|
|
|
|
|
|
if @state.isInitialSyncComplete
|
2016-04-05 08:11:09 +08:00
|
|
|
items.push <StreamingSyncActivity key="streaming-sync" />
|
2015-09-25 02:03:11 +08:00
|
|
|
else
|
2015-09-30 15:35:45 +08:00
|
|
|
items.push <InitialSyncActivity key="initial-sync" />
|
2015-05-20 06:59:37 +08:00
|
|
|
|
|
|
|
names = classNames
|
|
|
|
"sidebar-activity": true
|
|
|
|
"sidebar-activity-error": error?
|
|
|
|
|
2015-09-15 02:04:24 +08:00
|
|
|
wrapperClass = "sidebar-activity-transition-wrapper "
|
|
|
|
|
|
|
|
if items.length is 0
|
|
|
|
wrapperClass += "sidebar-activity-empty"
|
|
|
|
else
|
2016-03-29 16:41:24 +08:00
|
|
|
inside = <ReactCSSTransitionGroup
|
2015-09-15 02:04:24 +08:00
|
|
|
className={names}
|
2016-03-29 16:41:24 +08:00
|
|
|
transitionLeaveTimeout={625}
|
|
|
|
transitionEnterTimeout={125}
|
2015-09-15 02:04:24 +08:00
|
|
|
transitionName="activity-opacity">
|
|
|
|
{items}
|
2016-03-29 16:41:24 +08:00
|
|
|
</ReactCSSTransitionGroup>
|
2015-09-15 02:04:24 +08:00
|
|
|
|
2016-03-29 16:41:24 +08:00
|
|
|
<ReactCSSTransitionGroup
|
2015-09-15 02:04:24 +08:00
|
|
|
className={wrapperClass}
|
2016-03-29 16:41:24 +08:00
|
|
|
transitionLeaveTimeout={625}
|
|
|
|
transitionEnterTimeout={125}
|
2015-09-15 02:04:24 +08:00
|
|
|
transitionName="activity-opacity">
|
|
|
|
{inside}
|
2016-03-29 16:41:24 +08:00
|
|
|
</ReactCSSTransitionGroup>
|
2015-05-20 06:59:37 +08:00
|
|
|
|
|
|
|
_renderTaskActivityItems: =>
|
|
|
|
summary = {}
|
|
|
|
|
|
|
|
@state.tasks.map (task) ->
|
|
|
|
label = task.label?()
|
|
|
|
return unless label
|
|
|
|
summary[label] ?= 0
|
2015-10-01 00:54:14 +08:00
|
|
|
summary[label] += task.numberOfImpactedItems()
|
2015-05-20 06:59:37 +08:00
|
|
|
|
|
|
|
_.pairs(summary).map ([label, count]) ->
|
|
|
|
<div className="item" key={label}>
|
|
|
|
<div className="inner">
|
feat(mail-rules): Per-account mail rules filter incoming, existing mail
Summary:
Originally, this was going to be a totally independent package, but
I wasn't able to isolate the functionality and get it tied in to
the delta-stream consumption. Here's how it currently works:
- The preferences package has a new tab which allows you to edit
mail filters. Filters are saved in a new core store, and a new
stock component (ScenarioEditor) renders the editor. The editor
takes a set of templates that define a value space, and outputs
a valid set of values.
- A new MailFilterProcessor takes messages and creates tasks to
apply the actions from the MailFiltersStore.
- The worker-sync package now uses the MailFilterProcessor to
apply filters /before/ it calls didPassivelyReceiveNewModels,
so filtrs are applied before any notifications are created.
- A new task, ReprocessMailFiltersTask allows you to run filters
on all of your existing mail. It leverages the existing TaskQueue
architecture to: a) resume where it left off if you quit midway,
b) be queryable (for status) from all windows and c) cancelable.
The TaskQueue is a bit strange because it runs performLocal and
performRemote very differently, and I had to use `performRemote`.
(todo refactor soon.)
This diff also changes the EditableList a bit to behave like a
controlled component and render focused / unfocused states.
Test Plan: Run tests, only for actual filter processing atm.
Reviewers: juan, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D2379
2015-12-23 15:19:32 +08:00
|
|
|
<span className="count">({new Number(count).toLocaleString()})</span>
|
|
|
|
{label}
|
2015-05-20 06:59:37 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
_renderNotificationActivityItems: =>
|
|
|
|
@state.notifications.map (notification) ->
|
|
|
|
<div className="item" key={notification.id}>
|
|
|
|
<div className="inner">
|
|
|
|
{notification.message}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
_onDataChanged: =>
|
|
|
|
@setState(@_getStateFromStores())
|
|
|
|
|
|
|
|
_getStateFromStores: =>
|
|
|
|
notifications: NotificationStore.notifications()
|
feat(work): Create the "Work" window, move TaskQueue, Nylas sync workers
Summary:
Move sync workers and Edgehill token checks to work window
Move the task queue and database setup to the work window
Move ContactStore background refresh to work window
Store the task queue in the database
WIP
The TaskQueue now puts tasks in the database instead of in a file, which also means it can be observed
Move all delta sync and initial sync to a package, make NylasSyncStore which exposes read-only sync state
DraftStore no longer reads task status. Once you set the "sending" bit on a draft, it never gets unset. But that's fine actually.
If your package lists windowTypes, you *only* get loaded in those windowTypes. If you specify no windowTypes, you get loaded in the root window.
This means that onboarding, worker-ui, worker-sync, etc. no longer get loaded into the main window
ActivitySidebar has a special little store that observes the task queue since it's no longer in the window
Move "toggle component regions" / "toggle react remote" to the Developer menu
Move sync worker specs, update draft store specs to not rely on TaskQueue at all
Test Plan: Run existing tests, all pass
Reviewers: dillon, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D1936
2015-08-28 07:39:40 +08:00
|
|
|
tasks: TaskQueueStatusStore.queue()
|
2016-03-15 06:34:16 +08:00
|
|
|
isInitialSyncComplete: NylasSyncStatusStore.isSyncComplete()
|
2015-05-20 06:59:37 +08:00
|
|
|
|
|
|
|
module.exports = ActivitySidebar
|