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
83e4561f
Commit
83e4561f
authored
Feb 12, 2019
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move location logic to swappanel
parent
b0bd68b4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
36 deletions
+41
-36
app.js
src/app.js
+3
-3
swap-panel-component.js
src/app/components/swap-panel-component.js
+20
-2
remixAppManager.js
src/remixAppManager.js
+13
-31
sharedFolderExplorer.js
test-browser/tests/sharedFolderExplorer.js
+5
-0
No files found.
src/app.js
View file @
83e4561f
...
@@ -413,14 +413,14 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
...
@@ -413,14 +413,14 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
let
appStore
=
new
EntityStore
(
'module'
,
{
actives
:
[],
ids
:
[],
entities
:
{}
})
let
appStore
=
new
EntityStore
(
'module'
,
{
actives
:
[],
ids
:
[],
entities
:
{}
})
const
pluginManagerComponent
=
new
PluginManagerComponent
()
const
pluginManagerComponent
=
new
PluginManagerComponent
()
const
swapPanelComponent
=
new
SwapPanelComponent
(
appStore
)
const
appManager
=
new
RemixAppManager
(
appStore
)
const
mainPanelComponent
=
new
SwapPanelComponent
(
appStore
)
const
swapPanelComponent
=
new
SwapPanelComponent
(
'swapPanel'
,
appStore
,
appManager
,
{
default
:
true
})
const
mainPanelComponent
=
new
SwapPanelComponent
(
'mainPanel'
,
appStore
,
appManager
,
{
default
:
false
})
const
verticalIconsComponent
=
new
VerticalIconsComponent
(
appStore
)
const
verticalIconsComponent
=
new
VerticalIconsComponent
(
appStore
)
const
swapPanelApi
=
new
SwapPanelApi
(
swapPanelComponent
,
verticalIconsComponent
)
// eslint-disable-line
const
swapPanelApi
=
new
SwapPanelApi
(
swapPanelComponent
,
verticalIconsComponent
)
// eslint-disable-line
const
mainPanelApi
=
new
SwapPanelApi
(
mainPanelComponent
,
verticalIconsComponent
)
// eslint-disable-line
const
mainPanelApi
=
new
SwapPanelApi
(
mainPanelComponent
,
verticalIconsComponent
)
// eslint-disable-line
const
verticalIconsApi
=
new
VerticalIconsApi
(
verticalIconsComponent
)
// eslint-disable-line
const
verticalIconsApi
=
new
VerticalIconsApi
(
verticalIconsComponent
)
// eslint-disable-line
const
appManager
=
new
RemixAppManager
(
appStore
,
swapPanelApi
,
mainPanelApi
,
verticalIconsApi
)
registry
.
put
({
api
:
appManager
.
proxy
(),
name
:
'pluginmanager'
})
registry
.
put
({
api
:
appManager
.
proxy
(),
name
:
'pluginmanager'
})
pluginManagerComponent
.
setApp
(
appManager
)
pluginManagerComponent
.
setApp
(
appManager
)
...
...
src/app/components/swap-panel-component.js
View file @
83e4561f
...
@@ -6,14 +6,29 @@ var csjs = require('csjs-inject')
...
@@ -6,14 +6,29 @@ var csjs = require('csjs-inject')
// const styles = styleguide.chooser()
// const styles = styleguide.chooser()
class
SwapPanelComponent
{
class
SwapPanelComponent
{
constructor
(
appStore
)
{
constructor
(
name
,
appStore
,
appManager
,
opt
)
{
this
.
name
=
name
this
.
opt
=
opt
this
.
store
=
appStore
this
.
store
=
appStore
// list of contents
// list of contents
this
.
contents
=
{}
this
.
contents
=
{}
// name of the current displayed content
// name of the current displayed content
this
.
currentNode
this
.
currentNode
this
.
store
.
event
.
on
(
'activate'
,
(
name
)
=>
{
})
appManager
.
event
.
on
(
'pluginNeedsLocation'
,
(
profile
,
domEl
)
=>
{
if
((
profile
.
prefferedLocation
===
this
.
name
)
||
(
!
profile
.
prefferedLocation
&&
opt
.
default
))
{
this
.
add
(
profile
.
name
,
domEl
)
}
})
this
.
store
.
event
.
on
(
'activate'
,
(
name
)
=>
{
let
item
=
this
.
store
.
get
(
name
)
if
(((
item
.
profile
.
prefferedLocation
===
this
.
name
)
||
(
!
item
.
profile
.
prefferedLocation
&&
opt
.
default
))
&&
item
.
profile
.
icon
&&
item
.
api
.
render
&&
typeof
item
.
api
.
render
===
'function'
)
{
this
.
add
(
name
,
item
.
api
.
render
())
}
})
this
.
store
.
event
.
on
(
'deactivate'
,
(
name
)
=>
{
this
.
store
.
event
.
on
(
'deactivate'
,
(
name
)
=>
{
if
(
this
.
contents
[
name
])
this
.
remove
(
name
)
if
(
this
.
contents
[
name
])
this
.
remove
(
name
)
})
})
...
@@ -35,6 +50,9 @@ class SwapPanelComponent {
...
@@ -35,6 +50,9 @@ class SwapPanelComponent {
}
}
add
(
moduleName
,
content
)
{
add
(
moduleName
,
content
)
{
content
.
style
.
height
=
'100%'
content
.
style
.
width
=
'100%'
content
.
style
.
border
=
'0'
this
.
contents
[
moduleName
]
=
yo
`<div class=
${
css
.
plugItIn
}
>
${
content
}
</div>`
this
.
contents
[
moduleName
]
=
yo
`<div class=
${
css
.
plugItIn
}
>
${
content
}
</div>`
this
.
view
.
appendChild
(
this
.
contents
[
moduleName
])
this
.
view
.
appendChild
(
this
.
contents
[
moduleName
])
}
}
...
...
src/remixAppManager.js
View file @
83e4561f
...
@@ -4,17 +4,10 @@ import PluginManagerProxy from './app/components/plugin-manager-proxy'
...
@@ -4,17 +4,10 @@ import PluginManagerProxy from './app/components/plugin-manager-proxy'
export
class
RemixAppManager
extends
AppManagerApi
{
export
class
RemixAppManager
extends
AppManagerApi
{
constructor
(
store
,
swapPanelApi
,
mainPanelApi
,
verticalIconsApi
)
{
constructor
(
store
)
{
super
(
null
)
super
(
null
)
this
.
location
=
{
'default'
:
swapPanelApi
,
'swapPanel'
:
swapPanelApi
,
'mainPanel'
:
mainPanelApi
}
this
.
store
=
store
this
.
store
=
store
this
.
verticalIconsApi
=
verticalIconsApi
this
.
hiddenServices
=
{}
this
.
swapPanelApi
=
swapPanelApi
this
.
hiddenNodes
=
{}
this
.
event
=
new
EventEmitter
()
this
.
event
=
new
EventEmitter
()
this
.
data
=
{
this
.
data
=
{
proxy
:
new
PluginManagerProxy
()
proxy
:
new
PluginManagerProxy
()
...
@@ -28,20 +21,14 @@ export class RemixAppManager extends AppManagerApi {
...
@@ -28,20 +21,14 @@ export class RemixAppManager extends AppManagerApi {
setActive
(
name
,
isActive
)
{
setActive
(
name
,
isActive
)
{
const
entity
=
this
.
getEntity
(
name
)
const
entity
=
this
.
getEntity
(
name
)
if
(
entity
&&
entity
.
profile
.
icon
&&
entity
.
api
.
render
&&
typeof
entity
.
api
.
render
===
'function'
)
{
// here we have an internal module (it does not need to be rendered necessarily - "rendered" means pushed to the DOM)
// if it contains `render` function, we push the view to `resolveLocation`
isActive
?
this
.
resolveLocation
(
entity
.
profile
,
entity
.
api
.
render
())
:
this
.
removeComponent
(
entity
.
profile
)
}
// at this point, if it's an iframe plugin, it should have already been rendered (to the DOM)
// either using `location` in json profile or using the optionnal api in the `Plugin` class
// temp
// temp
if
(
entity
&&
name
===
'solidity'
)
{
if
(
entity
&&
name
===
'solidity'
)
{
isActive
?
this
.
data
.
proxy
.
register
(
entity
.
api
)
:
this
.
data
.
proxy
.
unregister
(
entity
.
api
)
isActive
?
this
.
data
.
proxy
.
register
(
entity
.
api
)
:
this
.
data
.
proxy
.
unregister
(
entity
.
api
)
}
}
isActive
?
this
.
store
.
activate
(
name
)
:
this
.
store
.
deactivate
(
name
)
isActive
?
this
.
store
.
activate
(
name
)
:
this
.
store
.
deactivate
(
name
)
if
(
!
isActive
)
{
this
.
removeHiddenServices
(
entity
)
}
}
}
getEntity
(
entityName
)
{
getEntity
(
entityName
)
{
...
@@ -52,24 +39,19 @@ export class RemixAppManager extends AppManagerApi {
...
@@ -52,24 +39,19 @@ export class RemixAppManager extends AppManagerApi {
this
.
store
.
add
(
entity
.
profile
.
name
,
entity
)
this
.
store
.
add
(
entity
.
profile
.
name
,
entity
)
}
}
// this function is only used for iframe plugins
resolveLocation
(
profile
,
domEl
)
{
resolveLocation
(
profile
,
domEl
)
{
// if there's an icon, we add to the swap panel
// if not we suppose it just need to be put to DOM (that would be)
if
(
profile
.
icon
)
{
if
(
profile
.
icon
)
{
var
panel
=
this
.
location
[
profile
.
prefferedLocation
]
?
this
.
location
[
profile
.
prefferedLocation
]
:
this
.
location
[
'default'
]
this
.
event
.
emit
(
'pluginNeedsLocation'
,
profile
,
domEl
)
domEl
.
style
.
height
=
'100%'
}
else
{
domEl
.
style
.
width
=
'100%'
this
.
hiddenServices
[
profile
.
name
]
=
domEl
domEl
.
style
.
border
=
'0'
panel
.
add
(
profile
,
domEl
)
return
}
this
.
hiddenNodes
[
profile
.
name
]
=
domEl
document
.
body
.
appendChild
(
domEl
)
document
.
body
.
appendChild
(
domEl
)
}
}
}
remove
Component
(
profile
)
{
remove
HiddenServices
(
profile
)
{
let
hidden
Node
=
this
.
hiddenNod
es
[
profile
.
name
]
let
hidden
Services
=
this
.
hiddenServic
es
[
profile
.
name
]
if
(
hidden
Node
)
document
.
body
.
removeChild
(
hiddenNode
)
if
(
hidden
Services
)
document
.
body
.
removeChild
(
hiddenServices
)
}
}
plugins
()
{
plugins
()
{
...
...
test-browser/tests/sharedFolderExplorer.js
View file @
83e4561f
...
@@ -64,6 +64,11 @@ function runTests (browser, testData) {
...
@@ -64,6 +64,11 @@ function runTests (browser, testData) {
browser
.
end
()
browser
.
end
()
return
return
}
}
if
(
browserName
===
'firefox'
)
{
console
.
log
(
'do not run remixd test for '
+
browserName
+
': TODO to reenable later'
)
browser
.
end
()
return
}
browser
browser
.
waitForElementVisible
(
'#icon-panel'
,
10000
)
.
waitForElementVisible
(
'#icon-panel'
,
10000
)
.
clickLaunchIcon
(
'file explorers'
)
.
clickLaunchIcon
(
'file explorers'
)
...
...
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