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
5a723d2c
Unverified
Commit
5a723d2c
authored
Feb 12, 2018
by
yann300
Committed by
GitHub
Feb 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1060 from ethereum/bugfix_fileexplorer
Fix - File explorer
parents
825fd8f7
4333244e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
45 deletions
+63
-45
chromeCloudStorageSync.js
src/app/files/chromeCloudStorageSync.js
+15
-12
file-explorer.js
src/app/files/file-explorer.js
+10
-1
file-panel.js
src/app/panels/file-panel.js
+38
-32
No files found.
src/app/files/chromeCloudStorageSync.js
View file @
5a723d2c
...
...
@@ -46,16 +46,19 @@ module.exports = function (filesProviders) {
})
}
for
(
var
y
in
filesProviders
[
'browser'
].
list
())
{
console
.
log
(
'checking'
,
y
)
filesProviders
[
'browser'
].
get
(
y
,
(
error
,
content
)
=>
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
obj
[
y
]
=
content
count
++
check
(
y
)
}
})
}
filesProviders
[
'browser'
].
resolve
(
'browser'
,
(
error
,
files
)
=>
{
if
(
!
error
)
{
Object
.
keys
(
files
).
forEach
((
path
)
=>
{
filesProviders
[
'browser'
].
get
(
path
,
(
error
,
content
)
=>
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
obj
[
path
]
=
content
count
++
check
(
path
)
}
})
})
}
})
}
src/app/files/file-explorer.js
View file @
5a723d2c
...
...
@@ -228,14 +228,23 @@ function fileExplorer (appAPI, files) {
}
}
fileExplorer
.
prototype
.
hide
=
function
()
{
if
(
this
.
container
)
this
.
container
.
style
.
display
=
'none'
}
fileExplorer
.
prototype
.
show
=
function
()
{
if
(
this
.
container
)
this
.
container
.
style
.
display
=
'block'
}
fileExplorer
.
prototype
.
init
=
function
()
{
this
.
container
=
yo
`<div></div>`
return
this
.
container
}
fileExplorer
.
prototype
.
ensureRoot
=
function
(
cb
)
{
cb
=
cb
||
(()
=>
{})
var
self
=
this
if
(
self
.
element
&&
cb
)
return
cb
()
if
(
self
.
element
)
return
cb
()
self
.
files
.
resolveDirectory
(
'/'
,
(
error
,
files
)
=>
{
if
(
error
)
console
.
error
(
error
)
...
...
src/app/panels/file-panel.js
View file @
5a723d2c
...
...
@@ -21,6 +21,23 @@ var limit = 60
var
canUpload
=
window
.
File
||
window
.
FileReader
||
window
.
FileList
||
window
.
Blob
var
ghostbar
=
yo
`<div class=
${
css
.
ghostbar
}
></div>`
/*
Overview of APIs:
* fileManager: @args fileProviders (browser, shared-folder, swarm, github, etc ...) & config & editor
- listen on browser & localhost file provider (`fileRenamed` & `fileRemoved`)
- update the tabs, switchFile
- trigger `currentFileChanged`
- set the current file in the config
* fileProvider: currently browser, swarm, localhost, github, gist
- link to backend
- provide properties `type`, `readonly`
- provide API `resolveDirectory`, `remove`, `exists`, `rename`, `get`, `set`
- trigger `fileExternallyChanged`, `fileRemoved`, `fileRenamed`, `fileRenamedError`, `fileAdded`
* file-explorer: treeview @args fileProvider
- listen on events triggered by fileProvider
- call fileProvider API
*/
function
filepanel
(
appAPI
,
filesProvider
)
{
var
self
=
this
var
fileExplorer
=
new
FileExplorer
(
appAPI
,
filesProvider
[
'browser'
])
...
...
@@ -89,7 +106,6 @@ function filepanel (appAPI, filesProvider) {
self
.
event
=
event
var
element
=
template
()
fileExplorer
.
ensureRoot
()
var
containerFileSystem
=
element
.
querySelector
(
'.filesystemexplorer'
)
var
websocketconn
=
element
.
querySelector
(
'.websocketconn'
)
filesProvider
[
'localhost'
].
remixd
.
event
.
register
(
'connecting'
,
(
event
)
=>
{
websocketconn
.
style
.
color
=
styles
.
colors
.
yellow
...
...
@@ -99,22 +115,19 @@ function filepanel (appAPI, filesProvider) {
filesProvider
[
'localhost'
].
remixd
.
event
.
register
(
'connected'
,
(
event
)
=>
{
websocketconn
.
style
.
color
=
styles
.
colors
.
green
websocketconn
.
setAttribute
(
'title'
,
'Connected to localhost. '
+
JSON
.
stringify
(
event
))
fileSystemExplorer
.
show
()
})
filesProvider
[
'localhost'
].
remixd
.
event
.
register
(
'errored'
,
(
event
)
=>
{
websocketconn
.
style
.
color
=
styles
.
colors
.
red
websocketconn
.
setAttribute
(
'title'
,
'localhost connection errored. '
+
JSON
.
stringify
(
event
))
if
(
fileSystemExplorer
.
element
&&
containerFileSystem
.
children
.
length
>
0
)
{
containerFileSystem
.
removeChild
(
fileSystemExplorer
.
element
)
}
fileSystemExplorer
.
hide
()
})
filesProvider
[
'localhost'
].
remixd
.
event
.
register
(
'closed'
,
(
event
)
=>
{
websocketconn
.
style
.
color
=
styles
.
colors
.
black
websocketconn
.
setAttribute
(
'title'
,
'localhost connection closed. '
+
JSON
.
stringify
(
event
))
if
(
fileSystemExplorer
.
element
&&
containerFileSystem
.
children
.
length
>
0
)
{
containerFileSystem
.
removeChild
(
fileSystemExplorer
.
element
)
}
fileSystemExplorer
.
hide
()
})
fileExplorer
.
events
.
register
(
'focus'
,
function
(
path
)
{
...
...
@@ -256,6 +269,8 @@ function filepanel (appAPI, filesProvider) {
modalDialogCustom
.
confirm
(
null
,
`Created a gist at
${
data
.
html_url
}
. Would you like to open it in a new window?`
,
()
=>
{
window
.
open
(
data
.
html_url
,
'_blank'
)
})
}
else
{
modalDialogCustom
.
alert
(
data
.
message
+
' '
+
data
.
documentation_url
)
}
}
}
...
...
@@ -309,33 +324,24 @@ function filepanel (appAPI, filesProvider) {
}
// return all the files, except the temporary/readonly ones..
function
packageFiles
(
files
,
callback
)
{
function
packageFiles
(
files
Provider
,
callback
)
{
var
ret
=
{}
// @TODO remove use of `list()`
var
filtered
=
Object
.
keys
(
files
.
list
()).
filter
(
function
(
path
)
{
if
(
!
files
.
isReadOnly
(
path
))
{
return
path
}
})
async
.
eachSeries
(
filtered
,
function
(
path
,
cb
)
{
ret
[
path
.
replace
(
files
.
type
+
'/'
,
''
)]
=
{
content
:
files
.
get
(
path
)
}
cb
()
},
()
=>
{
callback
(
null
,
ret
)
filesProvider
.
resolveDirectory
(
'browser'
,
(
error
,
files
)
=>
{
if
(
error
)
callback
(
error
)
else
{
async
.
eachSeries
(
Object
.
keys
(
files
),
(
path
,
cb
)
=>
{
filesProvider
.
get
(
path
,
(
error
,
content
)
=>
{
if
(
error
)
cb
(
error
)
else
{
ret
[
path
]
=
{
content
}
cb
()
}
})
},
(
error
)
=>
{
callback
(
error
,
ret
)
})
}
})
}
/*
Overview of APIs:
* fileManager: @args fileProviders (browser, shared-folder, swarm, github, etc ...) & config & editor
- listen on browser & localhost file provider (`fileRenamed` & `fileRemoved`)
- update the tabs, switchFile
- trigger `currentFileChanged`
- set the current file in the config
* fileProvider: currently browser, swarm, localhost, github, gist
- link to backend
- provide properties `type`, `readonly`
- provide API `resolveDirectory`, `remove`, `exists`, `rename`, `get`, `set`
- trigger `fileExternallyChanged`, `fileRemoved`, `fileRenamed`, `fileRenamedError`, `fileAdded`
* file-explorer: treeview @args fileProvider
- listen on events triggered by fileProvider
- call fileProvider API
*/
module
.
exports
=
filepanel
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