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
822475d0
Commit
822475d0
authored
Aug 25, 2017
by
yann300
Committed by
GitHub
Aug 25, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #724 from ethereum/appjs
move packageFiles to FilePanel
parents
788172dd
3387cac9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
19 deletions
+17
-19
app.js
src/app.js
+0
-17
file-panel.js
src/app/panels/file-panel.js
+17
-2
No files found.
src/app.js
View file @
822475d0
'use strict'
'use strict'
var
async
=
require
(
'async'
)
var
$
=
require
(
'jquery'
)
var
$
=
require
(
'jquery'
)
var
csjs
=
require
(
'csjs-inject'
)
var
csjs
=
require
(
'csjs-inject'
)
var
yo
=
require
(
'yo-yo'
)
var
yo
=
require
(
'yo-yo'
)
...
@@ -216,19 +215,6 @@ function run () {
...
@@ -216,19 +215,6 @@ function run () {
filesProviders
:
filesProviders
filesProviders
:
filesProviders
})
})
// return all the files, except the temporary/readonly ones.. package only files from the browser storage.
function
packageFiles
(
callback
)
{
var
ret
=
{}
var
files
=
filesProviders
[
'browser'
]
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
)
})
}
function
createNonClashingName
(
path
)
{
function
createNonClashingName
(
path
)
{
var
counter
=
''
var
counter
=
''
if
(
path
.
endsWith
(
'.sol'
))
path
=
path
.
substring
(
0
,
path
.
lastIndexOf
(
'.sol'
))
if
(
path
.
endsWith
(
'.sol'
))
path
=
path
.
substring
(
0
,
path
.
lastIndexOf
(
'.sol'
))
...
@@ -300,9 +286,6 @@ function run () {
...
@@ -300,9 +286,6 @@ function run () {
},
},
setText
:
function
(
text
)
{
setText
:
function
(
text
)
{
editor
.
setText
(
text
)
editor
.
setText
(
text
)
},
packageFiles
:
(
cb
)
=>
{
packageFiles
(
cb
)
}
}
}
}
var
filePanel
=
new
FilePanel
(
FilePanelAPI
,
filesProviders
)
var
filePanel
=
new
FilePanel
(
FilePanelAPI
,
filesProviders
)
...
...
src/app/panels/file-panel.js
View file @
822475d0
/* global confirm, prompt */
/* global confirm, prompt */
var
async
=
require
(
'async'
)
var
$
=
require
(
'jquery'
)
var
$
=
require
(
'jquery'
)
var
csjs
=
require
(
'csjs-inject'
)
var
csjs
=
require
(
'csjs-inject'
)
var
yo
=
require
(
'yo-yo'
)
var
yo
=
require
(
'yo-yo'
)
...
@@ -297,7 +298,8 @@ function filepanel (appAPI, filesProvider) {
...
@@ -297,7 +298,8 @@ function filepanel (appAPI, filesProvider) {
}
}
}
}
if
(
confirm
(
'Are you sure you want to publish all your files anonymously as a public gist on github.com?'
))
{
if
(
confirm
(
'Are you sure you want to publish all your files anonymously as a public gist on github.com?'
))
{
appAPI
.
packageFiles
((
error
,
packaged
)
=>
{
// package only files from the browser storage.
packageFiles
(
filesProvider
[
'browser'
],
(
error
,
packaged
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
}
else
{
}
else
{
...
@@ -327,7 +329,8 @@ function filepanel (appAPI, filesProvider) {
...
@@ -327,7 +329,8 @@ function filepanel (appAPI, filesProvider) {
if
(
target
===
null
)
{
if
(
target
===
null
)
{
return
return
}
}
appAPI
.
packageFiles
((
error
,
packaged
)
=>
{
// package only files from the browser storage.
packageFiles
(
filesProvider
[
'browser'
],
(
error
,
packaged
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
}
else
{
}
else
{
...
@@ -340,3 +343,15 @@ function filepanel (appAPI, filesProvider) {
...
@@ -340,3 +343,15 @@ function filepanel (appAPI, filesProvider) {
})
})
}
}
}
}
// return all the files, except the temporary/readonly ones..
function
packageFiles
(
files
,
callback
)
{
var
ret
=
{}
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
)
})
}
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