Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
253b5cc1
Unverified
Commit
253b5cc1
authored
May 15, 2019
by
yann300
Committed by
GitHub
May 15, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1969 from ethereum/plugin_putin
Plugin put in
parents
14fbab03
3f3eb07d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
15 deletions
+28
-15
local-plugin.js
src/app/components/local-plugin.js
+23
-15
plugin-manager-component.js
src/app/components/plugin-manager-component.js
+5
-0
No files found.
src/app/components/local-plugin.js
View file @
253b5cc1
...
@@ -34,12 +34,13 @@ module.exports = class LocalPlugin {
...
@@ -34,12 +34,13 @@ module.exports = class LocalPlugin {
*/
*/
create
()
{
create
()
{
const
profile
=
{
const
profile
=
{
...
this
.
profile
,
icon
:
'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMjYyIDEwNzVxLTM3IDEyMS0xMzggMTk1dC0yMjggNzQtMjI4LTc0LTEzOC0xOTVxLTgtMjUgNC00OC41dDM4LTMxLjVxMjUtOCA0OC41IDR0MzEuNSAzOHEyNSA4MCA5Mi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jVxMjUtOCA0OC41IDR0MzEuNSAzOHEyNSA4MCA5Mi41IDEyOS41dDE1MS41IDQ5LjUgMTUxLjUtNDkuNSA5Mi41LTEyOS41cTgtMjYgMzItMzh0NDktNCAzNyAzMS41IDQgNDguNXptLTQ5NC00MzVxMCA1My0zNy41IDkwLjV0LTkwLjUgMzcuNS05MC41LTM3LjUtMzcuNS05MC41IDM3LjUtOTAuNSA5MC41LTM3LjUgOTAuNSAzNy41IDM3LjUgOTAuNXptNTEyIDBxMCA1My0zNy41IDkwLjV0LTkwLjUgMzcuNS05MC41LTM3LjUtMzcuNS05MC41IDM3LjUtOTAuNSA5MC41LTM3LjUgOTAuNSAzNy41IDM3LjUgOTAuNXptMjU2IDI1NnEwLTEzMC01MS0yNDguNXQtMTM2LjUtMjA0LTIwNC0xMzYuNS0yNDguNS01MS0yNDguNSA1MS0yMDQgMTM2LjUtMTM2LjUgMjA0LTUxIDI0OC41IDUxIDI0OC41IDEzNi41IDIwNCAyMDQgMTM2LjUgMjQ4LjUgNTEgMjQ4LjUtNTEgMjA0LTEzNi41IDEzNi41LTIwNCA1MS0yNDguNXptMTI4IDBxMCAyMDktMTAzIDM4NS41dC0yNzkuNSAyNzkuNS0zODUuNSAxMDMtMzg1LjUtMTAzLTI3OS41LTI3OS41LTEwMy0zODUuNSAxMDMtMzg1LjUgMjc5LjUtMjc5LjUgMzg1LjUtMTAzIDM4NS41IDEwMyAyNzkuNSAyNzkuNSAxMDMgMzg1LjV6Ii8+PC9zdmc+'
,
methods
:
[],
methods
:
[],
location
:
'swapPanel'
,
...
this
.
profile
,
hash
:
`local-
${
this
.
profile
.
name
}
`
hash
:
`local-
${
this
.
profile
.
name
}
`
}
}
profile
.
events
=
profile
.
events
.
filter
((
item
)
=>
{
return
item
!==
''
}
)
profile
.
events
=
(
profile
.
events
||
[]).
filter
(
item
=>
item
!==
''
)
if
(
!
profile
.
location
)
throw
new
Error
(
'Plugin should have a location'
)
if
(
!
profile
.
location
)
throw
new
Error
(
'Plugin should have a location'
)
if
(
!
profile
.
name
)
throw
new
Error
(
'Plugin should have a name'
)
if
(
!
profile
.
name
)
throw
new
Error
(
'Plugin should have a name'
)
...
@@ -95,11 +96,11 @@ module.exports = class LocalPlugin {
...
@@ -95,11 +96,11 @@ module.exports = class LocalPlugin {
notificationCheckbox
(
plugin
,
event
)
{
notificationCheckbox
(
plugin
,
event
)
{
const
notifications
=
this
.
profile
.
notifications
||
{}
const
notifications
=
this
.
profile
.
notifications
||
{}
const
checkbox
=
notifications
[
plugin
]
&&
notifications
[
plugin
].
includes
(
event
)
const
checkbox
=
notifications
[
plugin
]
&&
notifications
[
plugin
].
includes
(
event
)
?
yo
`<input type="checkbox" checked onchange="
${
e
=>
this
.
toggleNotification
(
e
,
plugin
,
event
)}
">`
?
yo
`<input
id="
${
plugin
}${
event
}
"
type="checkbox" checked onchange="
${
e
=>
this
.
toggleNotification
(
e
,
plugin
,
event
)}
">`
:
yo
`<input type="checkbox" onchange="
${
e
=>
this
.
toggleNotification
(
e
,
plugin
,
event
)}
">`
:
yo
`<input
id="
${
plugin
}${
event
}
"
type="checkbox" onchange="
${
e
=>
this
.
toggleNotification
(
e
,
plugin
,
event
)}
">`
return
yo
`<div>
return
yo
`<div>
${
checkbox
}
${
checkbox
}
<label>
${
plugin
}
-
${
event
}
</label>
<label
for="
${
plugin
}${
event
}
"
>
${
plugin
}
-
${
event
}
</label>
</div>`
</div>`
}
}
...
@@ -120,6 +121,20 @@ module.exports = class LocalPlugin {
...
@@ -120,6 +121,20 @@ module.exports = class LocalPlugin {
return
yo
`<input class="form-control" onchange="
${
e
=>
this
.
updateEvents
(
e
,
i
)}
" value="
${
event
}
" />`
return
yo
`<input class="form-control" onchange="
${
e
=>
this
.
updateEvents
(
e
,
i
)}
" value="
${
event
}
" />`
})}
</div>`
})}
</div>`
}
}
const
radioLocations
=
(
label
,
displayN
)
=>
{
const
radioButton
=
(
this
.
profile
.
location
===
label
)
?
yo
`<div class="radio">
<label for="
${
label
}
">
<input type="radio" name="location" onclick="
${
e
=>
this
.
updateLoc
(
e
)}
" value="
${
label
}
" id="
${
label
}
" checked="checked" />
${
displayN
}
</label>
</div>`
:
yo
`<div class="radio">
<label for="
${
label
}
">
<input type="radio" name="location" onclick="
${
e
=>
this
.
updateLoc
(
e
)}
" value="
${
label
}
" id="
${
label
}
" />
${
displayN
}
</label>
</div>`
return
yo
`<div>
${
radioButton
}
</div>`
}
const
eventsEl
=
eventsForm
(
this
.
profile
.
events
||
[])
const
eventsEl
=
eventsForm
(
this
.
profile
.
events
||
[])
const
pushEvent
=
()
=>
{
const
pushEvent
=
()
=>
{
if
(
!
this
.
profile
.
events
)
this
.
profile
.
events
=
[]
if
(
!
this
.
profile
.
events
)
this
.
profile
.
events
=
[]
...
@@ -156,16 +171,9 @@ module.exports = class LocalPlugin {
...
@@ -156,16 +171,9 @@ module.exports = class LocalPlugin {
</div>
</div>
<div class="form-group">
<div class="form-group">
<h6>Location in remix <small>(required)</small></h6>
<h6>Location in remix <small>(required)</small></h6>
${
radioLocations
(
'swapPanel'
,
'Swap Panel'
)}
<div class="radio">
${
radioLocations
(
'mainPanel'
,
'Main Panel'
)}
<label for="loc1"><input type="radio" name="location" onclick="
${
e
=>
this
.
updateLoc
(
e
)}
" value="swapPanel" id="loc1" >Swap Panel</label>
${
radioLocations
(
'none'
,
'None'
)}
</div>
<div class="radio">
<label for="loc2"><input type="radio" name="location" onclick="
${
e
=>
this
.
updateLoc
(
e
)}
" value="mainPanel" id="loc2" >Main Panel</label>
</div>
<div class="radio">
<label for="loc3"><input type="radio" name="location" onclick="
${
e
=>
this
.
updateLoc
(
e
)}
" value="hiddenPanel" id="loc3" >None</label>
</div>
</form>`
</form>`
}
}
}
}
src/app/components/plugin-manager-component.js
View file @
253b5cc1
...
@@ -4,6 +4,7 @@ const EventEmitter = require('events')
...
@@ -4,6 +4,7 @@ const EventEmitter = require('events')
const
LocalPlugin
=
require
(
'./local-plugin'
)
const
LocalPlugin
=
require
(
'./local-plugin'
)
import
{
Plugin
,
BaseApi
}
from
'remix-plugin'
import
{
Plugin
,
BaseApi
}
from
'remix-plugin'
import
{
PluginManagerSettings
}
from
'./plugin-manager-settings'
import
{
PluginManagerSettings
}
from
'./plugin-manager-settings'
const
addToolTip
=
require
(
'../ui/tooltip'
)
const
css
=
csjs
`
const
css
=
csjs
`
.pluginSearch {
.pluginSearch {
...
@@ -109,11 +110,15 @@ class PluginManagerComponent extends BaseApi {
...
@@ -109,11 +110,15 @@ class PluginManagerComponent extends BaseApi {
try
{
try
{
const
profile
=
await
this
.
localPlugin
.
open
(
this
.
store
.
getAll
())
const
profile
=
await
this
.
localPlugin
.
open
(
this
.
store
.
getAll
())
if
(
!
profile
)
return
if
(
!
profile
)
return
if
(
this
.
store
.
ids
.
includes
(
profile
.
name
))
{
throw
new
Error
(
'This name has already been used'
)
}
this
.
appManager
.
registerOne
(
new
Plugin
(
profile
))
this
.
appManager
.
registerOne
(
new
Plugin
(
profile
))
this
.
appManager
.
activateOne
(
profile
.
name
)
this
.
appManager
.
activateOne
(
profile
.
name
)
}
catch
(
err
)
{
}
catch
(
err
)
{
// TODO : Use an alert to handle this error instead of a console.log
// TODO : Use an alert to handle this error instead of a console.log
console
.
log
(
`Cannot create Plugin :
${
err
.
message
}
`
)
console
.
log
(
`Cannot create Plugin :
${
err
.
message
}
`
)
addToolTip
(
`Cannot create Plugin :
${
err
.
message
}
`
)
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment