mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 12:40:08 +08:00
3ba6c7c59a
Summary: Debounce changes out of the DatabaseStore to prevent lots of calls to persistModel from flooding the app Tasks must always call super so they get IDs The task queue shouldn't save every time it adds/removes a task - there could be hundreds ActivityBar package is actually surprisingly slow, re-rendering needlessly setState in MultiselectList sometimes renders immediately. Don't do this, because sometimes we're rendering twice back to back Remove dead references Never allow duplicate tags in the tags array Don't archive threads that already have the archive tag (it doesn't do anything bad, but why bother creating tasks?) Update DB specs Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1506
32 lines
921 B
CoffeeScript
32 lines
921 B
CoffeeScript
React = require 'react/addons'
|
|
|
|
class ActivityBarCurlItem extends React.Component
|
|
@displayName: 'ActivityBarCurlItem'
|
|
|
|
render: =>
|
|
<div className={"item status-code-#{@props.item.statusCode}"}>
|
|
<div className="code">{@props.item.statusCode}</div>
|
|
<a onClick={@_onRunCommand}>Run</a>
|
|
<a onClick={@_onCopyCommand}>Copy</a>
|
|
{@props.item.command}
|
|
</div>
|
|
|
|
shouldComponentUpdate: (nextProps) =>
|
|
return @props.item isnt nextProps.item
|
|
|
|
_onCopyCommand: =>
|
|
clipboard = require('clipboard')
|
|
clipboard.writeText(@props.item.command)
|
|
|
|
_onRunCommand: =>
|
|
curlFile = "#{atom.getConfigDirPath()}/curl.command"
|
|
fs = require 'fs-plus'
|
|
if fs.existsSync(curlFile)
|
|
fs.unlinkSync(curlFile)
|
|
fs.writeFileSync(curlFile, @props.item.command)
|
|
fs.chmodSync(curlFile, '777')
|
|
shell = require 'shell'
|
|
shell.openItem(curlFile)
|
|
|
|
|
|
module.exports = ActivityBarCurlItem
|