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
838f0caa
Commit
838f0caa
authored
Oct 26, 2021
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed getCurrentWorkspace and getWorkspaces api
parent
b1e9fc98
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
18 deletions
+22
-18
file-panel.js
apps/remix-ide/src/app/panels/file-panel.js
+2
-1
index.ts
libs/remix-ui/workspace/src/lib/actions/index.ts
+8
-4
payload.ts
libs/remix-ui/workspace/src/lib/actions/payload.ts
+3
-6
workspace.ts
libs/remix-ui/workspace/src/lib/actions/workspace.ts
+9
-7
No files found.
apps/remix-ide/src/app/panels/file-panel.js
View file @
838f0caa
...
...
@@ -102,7 +102,7 @@ module.exports = class Filepanel extends ViewPlugin {
}
setWorkspaces
(
workspaces
)
{
this
.
worspaces
=
workspaces
this
.
wor
k
spaces
=
workspaces
}
createNewFile
()
{
...
...
@@ -146,6 +146,7 @@ module.exports = class Filepanel extends ViewPlugin {
const
workspaceProvider
=
this
.
fileProviders
.
workspace
this
.
currentWorkspaceMetadata
=
{
name
:
workspace
.
name
,
isLocalhost
:
workspace
.
isLocalhost
,
absolutePath
:
`
${
workspaceProvider
.
workspacesPath
}
/
${
workspace
.
name
}
`
}
this
.
emit
(
'setWorkspace'
,
workspace
)
}
workspaceDeleted
(
workspace
)
{
...
...
libs/remix-ui/workspace/src/lib/actions/index.ts
View file @
838f0caa
...
...
@@ -28,20 +28,24 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
if
(
params
.
gist
)
{
await
createWorkspaceTemplate
(
'gist-sample'
,
'gist-template'
)
await
loadWorkspacePreset
(
'gist-template'
)
dispatch
(
setCurrentWorkspace
(
'gist-sample'
,
plugin
))
plugin
.
setWorkspace
({
name
:
'gist-sample'
,
isLocalhost
:
false
})
dispatch
(
setCurrentWorkspace
(
'gist-sample'
))
}
else
if
(
params
.
code
||
params
.
url
)
{
await
createWorkspaceTemplate
(
'code-sample'
,
'code-template'
)
await
loadWorkspacePreset
(
'code-template'
)
dispatch
(
setCurrentWorkspace
(
'code-sample'
,
plugin
))
plugin
.
setWorkspace
({
name
:
'code-sample'
,
isLocalhost
:
false
})
dispatch
(
setCurrentWorkspace
(
'code-sample'
))
}
else
{
if
(
workspaces
.
length
===
0
)
{
await
createWorkspaceTemplate
(
'default_workspace'
,
'default-template'
)
await
loadWorkspacePreset
(
'default-template'
)
dispatch
(
setCurrentWorkspace
(
'default_workspace'
,
plugin
))
plugin
.
setWorkspace
({
name
:
'default_workspace'
,
isLocalhost
:
false
})
dispatch
(
setCurrentWorkspace
(
'default_workspace'
))
}
else
{
if
(
workspaces
.
length
>
0
)
{
workspaceProvider
.
setWorkspace
(
workspaces
[
workspaces
.
length
-
1
])
dispatch
(
setCurrentWorkspace
(
workspaces
[
workspaces
.
length
-
1
],
plugin
))
plugin
.
setWorkspace
({
name
:
workspaces
[
workspaces
.
length
-
1
],
isLocalhost
:
false
})
dispatch
(
setCurrentWorkspace
(
workspaces
[
workspaces
.
length
-
1
]))
}
}
}
...
...
libs/remix-ui/workspace/src/lib/actions/payload.ts
View file @
838f0caa
import
{
action
}
from
'../types'
export
const
setCurrentWorkspace
=
(
workspace
:
string
,
plugin
?)
=>
{
plugin
&&
plugin
.
setWorkspace
(
workspace
)
export
const
setCurrentWorkspace
=
(
workspace
:
string
)
=>
{
return
{
type
:
'SET_CURRENT_WORKSPACE'
,
payload
:
workspace
...
...
@@ -126,8 +125,7 @@ export const createWorkspaceRequest = (promise: Promise<any>) => {
}
}
export
const
createWorkspaceSuccess
=
(
workspaceName
:
string
,
plugin
?)
=>
{
plugin
&&
plugin
.
setWorkspace
(
workspaceName
)
export
const
createWorkspaceSuccess
=
(
workspaceName
:
string
)
=>
{
return
{
type
:
'CREATE_WORKSPACE_SUCCESS'
,
payload
:
workspaceName
...
...
@@ -155,8 +153,7 @@ export const fetchWorkspaceDirectorySuccess = (path: string, fileTree) => {
}
}
export
const
setRenameWorkspace
=
(
oldName
:
string
,
workspaceName
:
string
,
plugin
?)
=>
{
plugin
&&
plugin
.
setWorkspace
(
workspaceName
)
export
const
setRenameWorkspace
=
(
oldName
:
string
,
workspaceName
:
string
)
=>
{
return
{
type
:
'RENAME_WORKSPACE'
,
payload
:
{
oldName
,
workspaceName
}
...
...
libs/remix-ui/workspace/src/lib/actions/workspace.ts
View file @
838f0caa
...
...
@@ -45,9 +45,9 @@ export const createWorkspace = async (workspaceName: string, isEmpty = false, cb
dispatch
(
createWorkspaceRequest
(
promise
))
promise
.
then
(
async
()
=>
{
dispatch
(
createWorkspaceSuccess
(
workspaceName
,
plugin
))
dispatch
(
createWorkspaceSuccess
(
workspaceName
))
if
(
!
isEmpty
)
await
loadWorkspacePreset
(
'default-template'
)
plugin
.
emit
(
'setWorkspace'
,
{
name
:
workspaceName
,
isLocalhost
:
false
})
plugin
.
setWorkspace
(
{
name
:
workspaceName
,
isLocalhost
:
false
})
plugin
.
setWorkspaces
(
await
getWorkspaces
())
cb
&&
cb
(
null
,
workspaceName
)
}).
catch
((
error
)
=>
{
...
...
@@ -173,7 +173,8 @@ export const fetchWorkspaceDirectory = async (path: string) => {
export
const
renameWorkspace
=
async
(
oldName
:
string
,
workspaceName
:
string
)
=>
{
await
renameWorkspaceFromProvider
(
oldName
,
workspaceName
)
await
dispatch
(
setRenameWorkspace
(
oldName
,
workspaceName
,
plugin
))
await
dispatch
(
setRenameWorkspace
(
oldName
,
workspaceName
))
plugin
.
setWorkspace
({
name
:
workspaceName
,
isLocalhost
:
false
})
}
export
const
renameWorkspaceFromProvider
=
async
(
oldName
:
string
,
workspaceName
:
string
)
=>
{
...
...
@@ -195,19 +196,20 @@ export const switchToWorkspace = async (name: string) => {
if
(
!
isActive
)
await
plugin
.
call
(
'manager'
,
'activatePlugin'
,
'remixd'
)
dispatch
(
setMode
(
'localhost'
))
plugin
.
emit
(
'setWorkspace'
,
{
name
:
LOCALHOST
,
isLocalhost
:
true
})
plugin
.
emit
(
'setWorkspace'
,
{
name
:
null
,
isLocalhost
:
true
})
}
else
if
(
name
===
NO_WORKSPACE
)
{
plugin
.
fileProviders
.
workspace
.
clearWorkspace
()
dispatch
(
setCurrentWorkspace
(
null
,
plugin
))
plugin
.
setWorkspace
({
name
:
null
,
isLocalhost
:
false
})
dispatch
(
setCurrentWorkspace
(
null
))
}
else
{
const
isActive
=
await
plugin
.
call
(
'manager'
,
'isActive'
,
'remixd'
)
if
(
isActive
)
plugin
.
call
(
'manager'
,
'deactivatePlugin'
,
'remixd'
)
await
plugin
.
fileProviders
.
workspace
.
setWorkspace
(
name
)
plugin
.
setWorkspace
({
name
,
isLocalhost
:
false
})
dispatch
(
setMode
(
'browser'
))
dispatch
(
setCurrentWorkspace
(
name
,
plugin
))
dispatch
(
setCurrentWorkspace
(
name
))
dispatch
(
setReadOnlyMode
(
false
))
plugin
.
emit
(
'setWorkspace'
,
{
name
,
isLocalhost
:
false
})
}
}
...
...
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