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
0644b462
Commit
0644b462
authored
Jul 02, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
load oraclize plugin
parent
cda14a10
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
8 deletions
+53
-8
righthand-panel.js
src/app/panels/righthand-panel.js
+19
-4
pluginManager.js
src/app/plugin/pluginManager.js
+5
-0
plugins.js
src/app/plugin/plugins.js
+8
-0
settings-tab.js
src/app/tabs/settings-tab.js
+10
-4
tabbed-menu.js
src/app/tabs/tabbed-menu.js
+11
-0
No files found.
src/app/panels/righthand-panel.js
View file @
0644b462
...
@@ -16,7 +16,9 @@ const PluginTab = require('../tabs/plugin-tab')
...
@@ -16,7 +16,9 @@ const PluginTab = require('../tabs/plugin-tab')
const
TestTab
=
require
(
'../tabs/test-tab'
)
const
TestTab
=
require
(
'../tabs/test-tab'
)
const
RunTab
=
require
(
'../tabs/run-tab'
)
const
RunTab
=
require
(
'../tabs/run-tab'
)
const
PluginAPI
=
require
(
'../plugin/pluginAPI'
)
const
PluginAPI
=
require
(
'../plugin/pluginAPI'
)
const
plugins
=
require
(
'../plugin/plugins'
)
var
toolTip
=
require
(
'../ui/tooltip'
)
const
EventManager
=
remixLib
.
EventManager
const
EventManager
=
remixLib
.
EventManager
const
styles
=
styleguide
.
chooser
()
const
styles
=
styleguide
.
chooser
()
...
@@ -73,11 +75,24 @@ module.exports = class RighthandPanel {
...
@@ -73,11 +75,24 @@ module.exports = class RighthandPanel {
self
.
loadPlugin
(
json
)
self
.
loadPlugin
(
json
)
})
})
self
.
event
.
register
(
'plugin-name-loadRequest'
,
name
=>
{
if
(
plugins
[
name
])
{
self
.
loadPlugin
(
plugins
[
name
])
}
else
{
toolTip
(
'unknown plugin '
+
name
)
}
})
self
.
loadPlugin
=
function
(
json
)
{
self
.
loadPlugin
=
function
(
json
)
{
var
tab
=
new
PluginTab
(
json
)
if
(
self
.
_components
.
pluginManager
.
plugins
[
json
.
title
])
{
var
content
=
tab
.
render
()
self
.
_components
.
tabbedMenu
.
removeTabByTitle
(
json
.
title
)
self
.
_components
.
tabbedMenu
.
addTab
(
json
.
title
,
json
.
title
+
' plugin'
,
content
)
self
.
_components
.
pluginManager
.
unregister
(
json
)
self
.
_components
.
pluginManager
.
register
(
json
,
content
)
}
else
{
var
tab
=
new
PluginTab
(
json
)
var
content
=
tab
.
render
()
self
.
_components
.
tabbedMenu
.
addTab
(
json
.
title
,
json
.
title
+
' plugin'
,
content
)
self
.
_components
.
pluginManager
.
register
(
json
,
content
)
}
}
}
self
.
_view
.
dragbar
=
yo
`<div id="dragbar" class=
${
css
.
dragbar
}
></div>`
self
.
_view
.
dragbar
=
yo
`<div id="dragbar" class=
${
css
.
dragbar
}
></div>`
...
...
src/app/plugin/pluginManager.js
View file @
0644b462
...
@@ -161,6 +161,11 @@ module.exports = class PluginManager {
...
@@ -161,6 +161,11 @@ module.exports = class PluginManager {
// }
// }
},
false
)
},
false
)
}
}
unregister
(
desc
)
{
const
self
=
this
delete
self
.
plugins
[
desc
.
title
]
delete
self
.
origins
[
desc
.
url
]
}
register
(
desc
,
content
)
{
register
(
desc
,
content
)
{
const
self
=
this
const
self
=
this
self
.
plugins
[
desc
.
title
]
=
{
content
,
origin
:
desc
.
url
}
self
.
plugins
[
desc
.
title
]
=
{
content
,
origin
:
desc
.
url
}
...
...
src/app/plugin/plugins.js
0 → 100644
View file @
0644b462
'use strict'
module
.
exports
=
{
'oraclize'
:
{
url
:
'https://remix-plugin.oraclize.it'
,
title
:
'Oraclize'
}
}
src/app/tabs/settings-tab.js
View file @
0644b462
...
@@ -26,7 +26,8 @@ module.exports = class SettingsTab {
...
@@ -26,7 +26,8 @@ module.exports = class SettingsTab {
compiler
:
self
.
_components
.
registry
.
get
(
'compiler'
).
api
,
compiler
:
self
.
_components
.
registry
.
get
(
'compiler'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
editorPanel
:
self
.
_components
.
registry
.
get
(
'editorpanel'
).
api
,
editorPanel
:
self
.
_components
.
registry
.
get
(
'editorpanel'
).
api
,
editor
:
self
.
_components
.
registry
.
get
(
'editor'
).
api
editor
:
self
.
_components
.
registry
.
get
(
'editor'
).
api
,
righthandpanel
:
self
.
_components
.
registry
.
get
(
'righthandpanel'
).
api
}
}
self
.
_view
=
{
/* eslint-disable */
self
.
_view
=
{
/* eslint-disable */
el
:
null
,
el
:
null
,
...
@@ -155,8 +156,9 @@ module.exports = class SettingsTab {
...
@@ -155,8 +156,9 @@ module.exports = class SettingsTab {
</div>
</div>
<div>
<div>
${
self
.
_view
.
pluginInput
}
${
self
.
_view
.
pluginInput
}
<input onclick=
${
onloadPlugin
}
type="button" value="Load" class="
${
css
.
pluginLoad
}
">
<input onclick=
${
onloadPlugin
Json
}
type="button" value="Load" class="
${
css
.
pluginLoad
}
">
</div>
</div>
<input onclick=
${()
=>
{
onLoadPlugin
(
'oraclize'
)
}}
type
=
"button"
value
=
"Oraclize"
class
=
"${css.pluginLoad}"
>
<
/div
>
<
/div
>
<
/div>
`
<
/div>
`
self
.
_view
.
config
.
remixd
=
yo
`
self
.
_view
.
config
.
remixd
=
yo
`
...
@@ -197,14 +199,18 @@ module.exports = class SettingsTab {
...
@@ -197,14 +199,18 @@ module.exports = class SettingsTab {
function
onchangeOption
(
event
)
{
function
onchangeOption
(
event
)
{
self
.
_deps
.
config
.
set
(
'settings/always-use-vm'
,
!
self
.
_deps
.
config
.
get
(
'settings/always-use-vm'
))
self
.
_deps
.
config
.
set
(
'settings/always-use-vm'
,
!
self
.
_deps
.
config
.
get
(
'settings/always-use-vm'
))
}
}
function
onloadPlugin
(
event
)
{
function onLoadPlugin (name) {
// @TODO: BAD! REFACTOR: no module should trigger events of another modules emitter
self._deps.righthandpanel.event.trigger('plugin-name-loadRequest', [name])
}
function onloadPluginJson (event) {
try {
try {
var json = JSON.parse(self._view.pluginInput.value)
var json = JSON.parse(self._view.pluginInput.value)
} catch (e) {
} catch (e) {
return modal.alert('cannot parse the plugin definition to JSON')
return modal.alert('cannot parse the plugin definition to JSON')
}
}
// @TODO: BAD! REFACTOR: no module should trigger events of another modules emitter
// @TODO: BAD! REFACTOR: no module should trigger events of another modules emitter
self
.
_
events
.
rhp
.
trigger
(
'plugin-loadRequest'
,
[
json
])
self._
deps.righthandpanel.event
.trigger('plugin-loadRequest', [json])
}
}
function onswitch2darkTheme (event) {
function onswitch2darkTheme (event) {
styleGuide.switchTheme('dark')
styleGuide.switchTheme('dark')
...
...
src/app/tabs/tabbed-menu.js
View file @
0644b462
...
@@ -46,6 +46,17 @@ module.exports = class TabbedMenu {
...
@@ -46,6 +46,17 @@ module.exports = class TabbedMenu {
if
(
self
.
_view
.
el
)
self
.
_view
.
el
.
appendChild
(
self
.
_view
.
tabs
[
title
])
if
(
self
.
_view
.
el
)
self
.
_view
.
el
.
appendChild
(
self
.
_view
.
tabs
[
title
])
if
(
self
.
_view
.
viewport
)
self
.
_view
.
viewport
.
appendChild
(
self
.
_view
.
contents
[
title
])
if
(
self
.
_view
.
viewport
)
self
.
_view
.
viewport
.
appendChild
(
self
.
_view
.
contents
[
title
])
}
}
removeTabByTitle
(
title
)
{
const
self
=
this
if
(
self
.
_view
.
tabs
[
title
])
{
self
.
_view
.
tabs
[
title
].
parentNode
.
removeChild
(
self
.
_view
.
tabs
[
title
])
}
if
(
self
.
_view
.
contents
[
title
])
{
self
.
_view
.
contents
[
title
].
parentNode
.
removeChild
(
self
.
_view
.
contents
[
title
])
}
delete
self
.
_view
.
contents
[
title
]
delete
self
.
_view
.
tabs
[
title
]
}
getTabByClass
(
tabClass
)
{
getTabByClass
(
tabClass
)
{
const
self
=
this
const
self
=
this
return
self
.
_view
.
el
.
querySelector
(
`li.
${
tabClass
}
`
)
return
self
.
_view
.
el
.
querySelector
(
`li.
${
tabClass
}
`
)
...
...
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