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
00cef813
Commit
00cef813
authored
Mar 02, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move workspace creation to file panel
parent
ba28a85f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
18 deletions
+23
-18
fileManager.js
apps/remix-ide/src/app/files/fileManager.js
+0
-14
fileProvider.js
apps/remix-ide/src/app/files/fileProvider.js
+3
-1
file-panel.js
apps/remix-ide/src/app/panels/file-panel.js
+20
-3
No files found.
apps/remix-ide/src/app/files/fileManager.js
View file @
00cef813
...
@@ -600,20 +600,6 @@ class FileManager extends Plugin {
...
@@ -600,20 +600,6 @@ class FileManager extends Plugin {
if
(
callback
)
callback
(
error
)
if
(
callback
)
callback
(
error
)
})
})
}
}
async
createWorkspace
(
name
)
{
const
workspaceProvider
=
this
.
_deps
.
filesProviders
.
workspace
const
workspacePath
=
'browser/'
+
workspaceProvider
.
workspacesPath
+
'/'
+
name
const
workspaceRootPath
=
'browser/'
+
workspaceProvider
.
workspacesPath
if
(
!
this
.
exists
(
workspaceRootPath
))
await
this
.
mkdir
(
workspaceRootPath
)
if
(
!
this
.
exists
(
workspacePath
))
await
this
.
mkdir
(
workspacePath
)
}
async
workspaceExists
(
name
)
{
const
workspaceProvider
=
this
.
_deps
.
filesProviders
.
workspace
const
workspacePath
=
'browser/'
+
workspaceProvider
.
workspacesPath
+
'/'
+
name
return
this
.
exists
(
workspacePath
)
}
}
}
module
.
exports
=
FileManager
module
.
exports
=
FileManager
apps/remix-ide/src/app/files/fileProvider.js
View file @
00cef813
...
@@ -66,7 +66,9 @@ class FileProvider {
...
@@ -66,7 +66,9 @@ class FileProvider {
exists
(
path
,
cb
)
{
exists
(
path
,
cb
)
{
// todo check the type (directory/file) as well #2386
// todo check the type (directory/file) as well #2386
// currently it is not possible to have a file and folder with same path
// currently it is not possible to have a file and folder with same path
return
cb
(
null
,
this
.
_exists
(
path
))
const
ret
=
this
.
_exists
(
path
)
if
(
cb
)
cb
(
null
,
ret
)
return
ret
}
}
_exists
(
path
)
{
_exists
(
path
)
{
...
...
apps/remix-ide/src/app/panels/file-panel.js
View file @
00cef813
...
@@ -170,13 +170,30 @@ module.exports = class Filepanel extends ViewPlugin {
...
@@ -170,13 +170,30 @@ module.exports = class Filepanel extends ViewPlugin {
return
await
this
.
request
.
uploadFile
()
return
await
this
.
request
.
uploadFile
()
}
}
async
processCreateWorkspace
(
name
)
{
const
workspaceProvider
=
this
.
_deps
.
fileProviders
.
workspace
const
browserProvider
=
this
.
_deps
.
fileProviders
.
browser
const
workspacePath
=
'browser/'
+
workspaceProvider
.
workspacesPath
+
'/'
+
name
const
workspaceRootPath
=
'browser/'
+
workspaceProvider
.
workspacesPath
if
(
!
browserProvider
.
exists
(
workspaceRootPath
))
browserProvider
.
createDir
(
workspaceRootPath
)
if
(
!
browserProvider
.
exists
(
workspacePath
))
browserProvider
.
createDir
(
workspacePath
)
}
async
workspaceExists
(
name
)
{
const
workspaceProvider
=
this
.
_deps
.
fileProviders
.
workspace
const
browserProvider
=
this
.
_deps
.
fileProviders
.
browser
const
workspacePath
=
'browser/'
+
workspaceProvider
.
workspacesPath
+
'/'
+
name
return
browserProvider
.
exists
(
workspacePath
)
}
async
createWorkspace
(
workspaceName
)
{
async
createWorkspace
(
workspaceName
)
{
if
(
await
this
.
_deps
.
fileManager
.
workspaceExists
(
workspaceName
))
throw
new
Error
(
'workspace already exists'
)
if
(
await
this
.
workspaceExists
(
workspaceName
))
throw
new
Error
(
'workspace already exists'
)
const
browserProvider
=
this
.
_deps
.
fileProviders
.
browser
const
workspacesPath
=
this
.
_deps
.
fileProviders
.
workspace
.
workspacesPath
const
workspacesPath
=
this
.
_deps
.
fileProviders
.
workspace
.
workspacesPath
await
this
.
_deps
.
fileManager
.
c
reateWorkspace
(
workspaceName
)
await
this
.
processC
reateWorkspace
(
workspaceName
)
for
(
const
file
in
examples
)
{
for
(
const
file
in
examples
)
{
try
{
try
{
await
this
.
_deps
.
fileManager
.
writeFile
(
'browser/'
+
workspacesPath
+
'/'
+
workspaceName
+
'/'
+
examples
[
file
].
name
,
examples
[
file
].
content
)
await
browserProvider
.
set
(
'browser/'
+
workspacesPath
+
'/'
+
workspaceName
+
'/'
+
examples
[
file
].
name
,
examples
[
file
].
content
)
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
error
)
console
.
error
(
error
)
}
}
...
...
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