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
75987af1
Commit
75987af1
authored
Mar 01, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
linting
parent
67146f1f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
fileManager.js
apps/remix-ide/src/app/files/fileManager.js
+1
-1
file-panel.js
apps/remix-ide/src/app/panels/file-panel.js
+17
-17
No files found.
apps/remix-ide/src/app/files/fileManager.js
View file @
75987af1
...
...
@@ -593,7 +593,7 @@ class FileManager extends Plugin {
async
workspaceExists
(
name
)
{
const
workspaceProvider
=
this
.
_deps
.
filesProviders
.
workspace
const
workspacePath
=
'browser/'
+
workspaceProvider
.
workspacesPath
+
'/'
+
name
return
this
.
exists
(
workspacePath
)
return
this
.
exists
(
workspacePath
)
}
}
...
...
apps/remix-ide/src/app/panels/file-panel.js
View file @
75987af1
...
...
@@ -46,17 +46,17 @@ const profile = {
module
.
exports
=
class
Filepanel
extends
ViewPlugin
{
constructor
(
appManager
)
{
super
(
profile
)
this
.
event
=
new
EventManager
()
this
.
event
=
new
EventManager
()
this
.
_components
=
{}
this
.
_components
.
registry
=
globalRegistry
this
.
_deps
=
{
fileProviders
:
this
.
_components
.
registry
.
get
(
'fileproviders'
).
api
,
fileManager
:
this
.
_components
.
registry
.
get
(
'filemanager'
).
api
}
this
.
el
=
document
.
createElement
(
'div'
)
this
.
el
.
setAttribute
(
'id'
,
'fileExplorerView'
)
this
.
remixdHandle
=
new
RemixdHandle
(
this
.
remixdExplorer
,
this
.
_deps
.
fileProviders
.
localhost
,
appManager
)
this
.
gitHandle
=
new
GitHandle
()
this
.
registeredMenuItems
=
[]
...
...
@@ -69,7 +69,7 @@ module.exports = class Filepanel extends ViewPlugin {
return
this
.
el
}
renderComponent
()
{
renderComponent
()
{
ReactDOM
.
render
(
<
Workspace
createWorkspace
=
{
this
.
createWorkspace
.
bind
(
this
)}
...
...
@@ -91,14 +91,14 @@ module.exports = class Filepanel extends ViewPlugin {
,
this
.
el
)
}
/**
* @param item { id: string, name: string, type?: string[], path?: string[], extension?: string[], pattern?: string[] }
* @param callback (...args) => void
*/
registerContextMenuItem
(
item
)
{
if
(
!
item
)
throw
new
Error
(
'Invalid register context menu argument'
)
if
(
!
item
.
name
||
!
item
.
id
)
throw
new
Error
(
'Item name and id is mandatory'
)
if
(
!
item
.
type
&&
!
item
.
path
&&
!
item
.
extension
&&
!
item
.
pattern
)
throw
new
Error
(
'Invalid file matching criteria provided'
)
/**
* @param item { id: string, name: string, type?: string[], path?: string[], extension?: string[], pattern?: string[] }
* @param callback (...args) => void
*/
registerContextMenuItem
(
item
)
{
if
(
!
item
)
throw
new
Error
(
'Invalid register context menu argument'
)
if
(
!
item
.
name
||
!
item
.
id
)
throw
new
Error
(
'Item name and id is mandatory'
)
if
(
!
item
.
type
&&
!
item
.
path
&&
!
item
.
extension
&&
!
item
.
pattern
)
throw
new
Error
(
'Invalid file matching criteria provided'
)
this
.
registeredMenuItems
=
[...
this
.
registeredMenuItems
,
item
]
this
.
renderComponent
()
...
...
@@ -166,12 +166,12 @@ module.exports = class Filepanel extends ViewPlugin {
async
uploadFile
()
{
return
await
this
.
request
.
uploadFile
()
}
}
async
createWorkspace
(
workspaceName
)
{
if
(
await
this
.
_deps
.
fileManager
.
workspaceExists
(
workspaceName
))
throw
new
Error
(
'workspace already exists'
)
const
workspacesPath
=
this
.
_deps
.
fileProviders
.
workspace
.
workspacesPath
await
this
.
_deps
.
fileManager
.
createWorkspace
(
workspaceName
)
await
this
.
_deps
.
fileManager
.
createWorkspace
(
workspaceName
)
for
(
const
file
in
examples
)
{
try
{
await
this
.
_deps
.
fileManager
.
writeFile
(
'browser/'
+
workspacesPath
+
'/'
+
workspaceName
+
'/'
+
examples
[
file
].
name
,
examples
[
file
].
content
)
...
...
@@ -179,7 +179,7 @@ module.exports = class Filepanel extends ViewPlugin {
console
.
error
(
error
)
}
}
}
}
/** these are called by the react component, action is already finished whent it's called */
async
setWorkspace
(
workspace
)
{
...
...
@@ -191,7 +191,7 @@ module.exports = class Filepanel extends ViewPlugin {
}
this
.
emit
(
'setWorkspace'
,
workspace
)
}
workspaceRenamed
(
workspace
)
{
this
.
emit
(
'renameWorkspace'
,
workspace
)
}
...
...
@@ -203,5 +203,5 @@ module.exports = class Filepanel extends ViewPlugin {
workspaceCreated
(
workspace
)
{
this
.
emit
(
'createWorkspace'
,
workspace
)
}
/** end section */
/** end section */
}
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