mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 05:41:05 +08:00
8b3f7f0578
Summary: This diff adds an "OutboxStore" which reflects the TaskQueue and adds a progress bar / cancel button to drafts which are currently sending. - Sending state is different from things like Send later because drafts which are sending shouldn't be editable. You should have to stop them from sending before editing. I think we can implement "Send Later" indicators, etc. with a simple InjectedComponentSet on the draft list rows, but the OutboxStore is woven into the DraftList query subscription so every draft has a `uploadTaskId`. - The TaskQueue now saves periodically (every one second) when there are "Processing" tasks. This is not really necessary, but makes it super easy for tasks to expose "progress", because they're essentially serialized and propagated to all windows every one second with the current progress value. Kind of questionable, but super convenient. - I also cleaned up ListTabular and MultiselectList a bit because they applied the className prop to an inner element and not the top one. - If a DestroyDraft task is created for a draft without a server id, it ends with Task.Status.Continue and not Failed. - The SendDraftTask doesn't delete uploads until the send actually goes through, in case the app crashes and it forgets the file IDs it created. Test Plan: Tests coming soon Reviewers: juan, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D2524
32 lines
829 B
CoffeeScript
32 lines
829 B
CoffeeScript
React = require 'react'
|
|
{Actions} = require 'nylas-exports'
|
|
{RetinaImg} = require 'nylas-component-kit'
|
|
|
|
class SendingCancelButton extends React.Component
|
|
@displayName: 'SendingCancelButton'
|
|
|
|
@propTypes:
|
|
taskId: React.PropTypes.string.isRequired
|
|
|
|
constructor: (@props) ->
|
|
@state =
|
|
cancelling: false
|
|
|
|
render: =>
|
|
if @state.cancelling
|
|
<RetinaImg
|
|
style={width: 20, height: 20, marginTop: 2}
|
|
name="inline-loading-spinner.gif"
|
|
mode={RetinaImg.Mode.ContentPreserve} />
|
|
else
|
|
<div onClick={@_onClick} style={marginTop: 1}>
|
|
<RetinaImg
|
|
name="image-cancel-button.png"
|
|
mode={RetinaImg.Mode.ContentPreserve} />
|
|
</div>
|
|
|
|
_onClick: =>
|
|
Actions.dequeueTask(@props.taskId)
|
|
@setState(cancelling: true)
|
|
|
|
module.exports = SendingCancelButton
|