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
fda7349d
Commit
fda7349d
authored
Feb 22, 2019
by
Grandschtroumpf
Committed by
yann300
Mar 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch File Manager API to promise based methods
parent
aab0dfb2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
25 deletions
+22
-25
fileManager.js
src/app/files/fileManager.js
+22
-25
No files found.
src/app/files/fileManager.js
View file @
fda7349d
...
...
@@ -119,39 +119,36 @@ class FileManager {
return
path
?
path
[
1
]
:
null
}
getCurrentFile
(
cb
)
{
var
path
=
this
.
currentFile
()
if
(
!
path
)
{
cb
(
'no file selected'
)
}
else
{
cb
(
null
,
path
)
}
async
getCurrentFile
()
{
const
path
=
this
.
currentFile
()
if
(
!
path
)
throw
'no file selected'
return
path
}
getFile
(
path
,
cb
)
{
var
provider
=
this
.
fileProviderOf
(
path
)
if
(
provider
)
{
// TODO add approval to user for external plugin to get the content of the given `path`
provider
.
get
(
path
,
(
error
,
content
)
=>
{
cb
(
error
,
content
)
getFile
(
path
)
{
const
provider
=
this
.
fileProviderOf
(
path
)
if
(
!
provider
)
throw
new
Error
(
`
${
path
}
not available`
)
// TODO: change provider to Promise
return
new
Promise
((
resolve
,
reject
)
=>
{
provider
.
get
(
path
,
(
err
,
content
)
=>
{
if
(
err
)
reject
(
err
)
resolve
(
content
)
})
}
else
{
cb
(
path
+
' not available'
)
}
})
}
setFile
(
path
,
content
,
cb
)
{
var
provider
=
this
.
fileProviderOf
(
path
)
if
(
provider
)
{
// TODO add approval to user for external plugin to set the content of the given `path`
setFile
(
path
,
content
)
{
const
provider
=
this
.
fileProviderOf
(
path
)
if
(
!
provider
)
throw
new
Error
(
`
${
path
}
not availble`
)
// TODO : Add permission
// TODO : Change Provider to Promise
return
new
Promise
((
resolve
,
reject
)
=>
{
provider
.
set
(
path
,
content
,
(
error
)
=>
{
if
(
error
)
re
turn
cb
(
error
)
if
(
error
)
re
ject
(
error
)
this
.
syncEditor
(
path
)
cb
(
)
resolve
(
true
)
})
}
else
{
cb
(
path
+
' not available'
)
}
})
}
removeTabsOf
(
provider
)
{
...
...
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