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
f58d473d
Commit
f58d473d
authored
Feb 23, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix switching workspaces
parent
365a42a6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
workspaceFileProvider.js
apps/remix-ide/src/app/files/workspaceFileProvider.js
+4
-0
file-panel.js
apps/remix-ide/src/app/panels/file-panel.js
+18
-6
No files found.
apps/remix-ide/src/app/files/workspaceFileProvider.js
View file @
f58d473d
...
@@ -13,6 +13,10 @@ class WorkspaceFileProvider extends FileProvider {
...
@@ -13,6 +13,10 @@ class WorkspaceFileProvider extends FileProvider {
this
.
workspace
=
workspace
this
.
workspace
=
workspace
}
}
clearWorkspace
()
{
this
.
workspace
=
null
}
removePrefix
(
path
)
{
removePrefix
(
path
)
{
path
=
path
.
replace
(
/^
\/
|
\/
$/g
,
''
)
// remove first and last slash
path
=
path
.
replace
(
/^
\/
|
\/
$/g
,
''
)
// remove first and last slash
if
(
path
.
startsWith
(
this
.
workspacesPath
+
'/'
+
this
.
workspace
))
return
path
if
(
path
.
startsWith
(
this
.
workspacesPath
+
'/'
+
this
.
workspace
))
return
path
...
...
apps/remix-ide/src/app/panels/file-panel.js
View file @
f58d473d
...
@@ -58,10 +58,12 @@ module.exports = class Filepanel extends ViewPlugin {
...
@@ -58,10 +58,12 @@ module.exports = class Filepanel extends ViewPlugin {
fileManager
:
this
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
fileManager
:
this
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
config
:
this
.
_components
.
registry
.
get
(
'config'
).
api
config
:
this
.
_components
.
registry
.
get
(
'config'
).
api
}
}
this
.
LOCALHOST
=
'<Connect Localhost>'
this
.
LOCALHOST
=
' - connect to localhost - '
this
.
NO_WORKSPACE
=
' - none - '
this
.
hideRemixdExplorer
=
true
this
.
hideRemixdExplorer
=
true
this
.
remixdExplorer
=
{
this
.
remixdExplorer
=
{
hide
:
()
=>
{
hide
:
()
=>
{
if
(
this
.
currentWorkspace
===
this
.
LOCALHOST
)
this
.
setWorkspace
(
this
.
NO_WORKSPACE
)
this
.
_deps
.
fileManager
.
setMode
(
'browser'
)
this
.
_deps
.
fileManager
.
setMode
(
'browser'
)
this
.
hideRemixdExplorer
=
true
this
.
hideRemixdExplorer
=
true
this
.
renderComponent
()
this
.
renderComponent
()
...
@@ -102,6 +104,11 @@ module.exports = class Filepanel extends ViewPlugin {
...
@@ -102,6 +104,11 @@ module.exports = class Filepanel extends ViewPlugin {
this
.
currentWorkspace
=
null
this
.
currentWorkspace
=
null
const
workspacesPath
=
this
.
_deps
.
fileProviders
.
workspace
.
workspacesPath
this
.
_deps
.
fileProviders
.
browser
.
resolveDirectory
(
'/'
+
workspacesPath
,
(
error
,
fileTree
)
=>
{
if
(
error
)
return
console
.
error
(
error
)
this
.
setWorkspace
(
Object
.
keys
(
fileTree
)[
0
].
replace
(
workspacesPath
+
'/'
,
''
))
})
this
.
renderComponent
()
this
.
renderComponent
()
}
}
...
@@ -146,16 +153,16 @@ module.exports = class Filepanel extends ViewPlugin {
...
@@ -146,16 +153,16 @@ module.exports = class Filepanel extends ViewPlugin {
if
(
error
)
console
.
error
(
error
)
if
(
error
)
console
.
error
(
error
)
const
items
=
fileTree
const
items
=
fileTree
items
[
this
.
LOCALHOST
]
=
{
isLocalHost
:
true
}
items
[
this
.
LOCALHOST
]
=
{
isLocalHost
:
true
}
items
[
this
.
NO_WORKSPACE
]
=
{
isNone
:
true
}
ReactDOM
.
render
(
ReactDOM
.
render
(
(
(
Object
.
keys
(
items
)
Object
.
keys
(
items
)
.
filter
((
item
)
=>
fileTree
[
item
].
isDirectory
||
fileTree
[
item
].
isLocalHost
)
.
filter
((
item
)
=>
fileTree
[
item
].
isDirectory
||
fileTree
[
item
].
isLocalHost
||
fileTree
[
item
].
isNone
)
.
map
((
folder
)
=>
{
.
map
((
folder
)
=>
{
folder
=
folder
.
replace
(
workspacesPath
+
'/'
,
''
)
folder
=
folder
.
replace
(
workspacesPath
+
'/'
,
''
)
return
<
option
selected
=
{
this
.
currentWorkspace
===
folder
}
value
=
{
folder
}
>
{
folder
}
<
/option
>
return
<
option
selected
=
{
this
.
currentWorkspace
===
folder
}
value
=
{
folder
}
>
{
folder
}
<
/option
>
})),
document
.
getElementById
(
'workspacesSelect'
)
})),
document
.
getElementById
(
'workspacesSelect'
)
)
)
if
(
!
this
.
currentWorkspace
)
this
.
setWorkspace
(
Object
.
keys
(
fileTree
)[
0
].
replace
(
workspacesPath
+
'/'
,
''
))
})
})
}
}
...
@@ -188,16 +195,20 @@ module.exports = class Filepanel extends ViewPlugin {
...
@@ -188,16 +195,20 @@ module.exports = class Filepanel extends ViewPlugin {
return
this
.
el
return
this
.
el
}
}
setWorkspace
(
name
)
{
async
setWorkspace
(
name
)
{
this
.
_deps
.
fileManager
.
removeTabsOf
(
this
.
_deps
.
fileProviders
.
workspace
)
this
.
_deps
.
fileManager
.
removeTabsOf
(
this
.
_deps
.
fileProviders
.
workspace
)
this
.
currentWorkspace
=
name
this
.
currentWorkspace
=
name
if
(
name
===
this
.
LOCALHOST
)
{
if
(
name
===
this
.
LOCALHOST
)
{
this
.
_deps
.
fileProviders
.
workspace
.
clearWorkspace
()
this
.
call
(
'manager'
,
'activatePlugin'
,
'remixd'
)
this
.
call
(
'manager'
,
'activatePlugin'
,
'remixd'
)
}
else
if
(
name
===
this
.
NO_WORKSPACE
)
{
this
.
_deps
.
fileProviders
.
workspace
.
clearWorkspace
()
}
else
{
}
else
{
this
.
_deps
.
fileProviders
.
workspace
.
setWorkspace
(
name
)
this
.
_deps
.
fileProviders
.
workspace
.
setWorkspace
(
name
)
}
if
(
name
!==
this
.
LOCALHOST
&&
await
this
.
call
(
'manager'
,
'isActive'
,
'remixd'
))
{
this
.
call
(
'manager'
,
'deactivatePlugin'
,
'remixd'
)
this
.
call
(
'manager'
,
'deactivatePlugin'
,
'remixd'
)
}
}
// TODO remove the opened tabs from the previous workspace
this
.
renderComponent
()
this
.
renderComponent
()
}
}
...
@@ -244,6 +255,7 @@ module.exports = class Filepanel extends ViewPlugin {
...
@@ -244,6 +255,7 @@ module.exports = class Filepanel extends ViewPlugin {
const
workspacesPath
=
this
.
_deps
.
fileProviders
.
workspace
.
workspacesPath
const
workspacesPath
=
this
.
_deps
.
fileProviders
.
workspace
.
workspacesPath
this
.
_deps
.
fileProviders
.
browser
.
remove
(
workspacesPath
+
'/'
+
this
.
currentWorkspace
)
this
.
_deps
.
fileProviders
.
browser
.
remove
(
workspacesPath
+
'/'
+
this
.
currentWorkspace
)
this
.
currentWorkspace
=
null
this
.
currentWorkspace
=
null
this
.
setWorkspace
(
this
.
NO_WORKSPACE
)
this
.
renderComponent
()
this
.
renderComponent
()
})
})
}
}
...
@@ -300,7 +312,7 @@ module.exports = class Filepanel extends ViewPlugin {
...
@@ -300,7 +312,7 @@ module.exports = class Filepanel extends ViewPlugin {
<
div
className
=
'remixui_fileExplorerTree'
>
<
div
className
=
'remixui_fileExplorerTree'
>
<
div
>
<
div
>
<
div
className
=
'pl-2 remixui_treeview'
data
-
id
=
'filePanelFileExplorerTree'
>
<
div
className
=
'pl-2 remixui_treeview'
data
-
id
=
'filePanelFileExplorerTree'
>
{
this
.
hideRemixdExplorer
&&
this
.
currentWorkspace
&&
{
this
.
hideRemixdExplorer
&&
this
.
currentWorkspace
&&
this
.
currentWorkspace
!==
this
.
NO_WORKSPACE
&&
<
FileExplorer
<
FileExplorer
name
=
{
this
.
currentWorkspace
}
name
=
{
this
.
currentWorkspace
}
registry
=
{
this
.
_components
.
registry
}
registry
=
{
this
.
_components
.
registry
}
...
...
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