🎨(plugins): Add install button in preferences

This commit is contained in:
Jackie Luo 2016-03-09 16:49:01 -08:00
parent 94580240ba
commit 6823b31e21
3 changed files with 9 additions and 3 deletions

View file

@ -31,6 +31,7 @@ PackagesStore = Reflux.createStore
NylasEnv.commands.add 'body',
'application:install-package': => @_onInstallPackage()
@listenTo PluginsActions.installNewPackage, @_onInstallPackage
@listenTo PluginsActions.createPackage, @_onCreatePackage
@listenTo PluginsActions.updatePackage, @_onUpdatePackage
@listenTo PluginsActions.setGlobalSearchValue, @_onGlobalSearchChange
@ -169,7 +170,7 @@ PackagesStore = Reflux.createStore
_onInstallPackage: ->
NylasEnv.showOpenDialog
title: "Choose a Package Directory"
title: "Choose a Plugin Directory"
properties: ['openDirectory']
, (filenames) =>
return if not filenames or filenames.length is 0
@ -177,9 +178,9 @@ PackagesStore = Reflux.createStore
return if err
packageName = path.basename(filenames[0])
msg = "#{packageName} has been installed and enabled. No need to \
restart! If you don't see the package loaded, check the \
restart! If you don't see the plugin loaded, check the \
console for errors."
@_displayMessage("Plugin installed 🎉", msg)
@_displayMessage("Plugin installed! 🎉", msg)
_onCreatePackage: ->
if not NylasEnv.inDevMode()

View file

@ -8,6 +8,7 @@ Actions = [
'disablePackage',
'enablePackage',
'installPackage',
'installNewPackage'
'uninstallPackage',
'createPackage',
'reloadPackage',

View file

@ -38,6 +38,7 @@ class TabInstalled extends React.Component
value={@state.search}
onChange={@_onSearchChange }
placeholder="Search Installed Plugins"/>
<div className="btn btn-large" onClick={@_onInstallPackage}>Install Plugin...</div>
<PackageSet
packages={@state.packages.user}
title="Third Party"
@ -74,6 +75,9 @@ class TabInstalled extends React.Component
_onChange: =>
@setState(@_getStateFromStores())
_onInstallPackage: =>
PluginsActions.installNewPackage()
_onCreatePackage: =>
PluginsActions.createPackage()