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
736aab3e
Commit
736aab3e
authored
Sep 10, 2021
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch to localhost
parent
daf50154
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
39 deletions
+34
-39
remixDProvider.js
apps/remix-ide/src/app/files/remixDProvider.js
+1
-3
workspace.ts
libs/remix-ui/workspace/src/lib/actions/workspace.ts
+20
-27
workspace.ts
libs/remix-ui/workspace/src/lib/reducers/workspace.ts
+9
-2
remix-ui-workspace.tsx
libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
+4
-7
No files found.
apps/remix-ide/src/app/files/remixDProvider.js
View file @
736aab3e
...
@@ -57,7 +57,7 @@ module.exports = class RemixDProvider extends FileProvider {
...
@@ -57,7 +57,7 @@ module.exports = class RemixDProvider extends FileProvider {
}
}
preInit
()
{
preInit
()
{
this
.
event
.
emit
(
'loading'
)
this
.
event
.
emit
(
'loading
Localhost
'
)
}
}
init
(
cb
)
{
init
(
cb
)
{
...
@@ -177,9 +177,7 @@ module.exports = class RemixDProvider extends FileProvider {
...
@@ -177,9 +177,7 @@ module.exports = class RemixDProvider extends FileProvider {
}
}
resolveDirectory
(
path
,
callback
)
{
resolveDirectory
(
path
,
callback
)
{
var
self
=
this
if
(
path
[
0
]
===
'/'
)
path
=
path
.
substring
(
1
)
if
(
path
[
0
]
===
'/'
)
path
=
path
.
substring
(
1
)
if
(
!
path
)
return
callback
(
null
,
{
[
self
.
type
]:
{
}
})
const
unprefixedpath
=
this
.
removePrefix
(
path
)
const
unprefixedpath
=
this
.
removePrefix
(
path
)
if
(
!
this
.
_isReady
)
return
callback
&&
callback
(
'provider not ready'
)
if
(
!
this
.
_isReady
)
return
callback
&&
callback
(
'provider not ready'
)
...
...
libs/remix-ui/workspace/src/lib/actions/workspace.ts
View file @
736aab3e
...
@@ -304,37 +304,29 @@ const listenOnEvents = (provider) => {
...
@@ -304,37 +304,29 @@ const listenOnEvents = (provider) => {
await
executeEvent
(
'rootFolderChanged'
,
path
)
await
executeEvent
(
'rootFolderChanged'
,
path
)
})
})
provider
.
event
.
on
(
'disconnected'
,
()
=>
{
dispatch
(
setMode
(
'browser'
))
})
// provider.event.on('connected', () => {
// props.plugin.fileManager.setMode('localhost')
// setState(prevState => {
// return { ...prevState, hideRemixdExplorer: false, loadingLocalhost: false }
// })
// })
// provider.event.on('disconnected', () => {
// provider.event.on('disconnected', () => {
// // If 'connect to localhost' is clicked from home tab, mode is not 'localhost'
// dispatch(setMode('browser'))
// if (props.fileManager.mode === 'localhost') {
// await setWorkspace(NO_WORKSPACE)
// props.plugin.fileManager.setMode('browser')
// setState(prevState => {
// return { ...prevState, hideRemixdExplorer: true, loadingLocalhost: false }
// })
// })
// } else {
// // Hide spinner in file explorer
provider
.
event
.
on
(
'connected'
,
async
()
=>
{
fetchWorkspaceDirectory
(
'/'
)(
dispatch
)
// setState(prevState => {
// setState(prevState => {
// return { ...prevState, loadingLocalhost: false }
// return { ...prevState, hideRemixdExplorer: false, loadingLocalhost: false }
// })
// }
// })
// })
})
// provider.event.on('loading', () => {
provider
.
event
.
on
(
'disconnected'
,
async
()
=>
{
const
workspaceProvider
=
plugin
.
fileProviders
.
workspace
await
switchToWorkspace
(
workspaceProvider
.
workspace
)(
dispatch
)
})
provider
.
event
.
on
(
'loadingLocalhost'
,
async
()
=>
{
await
switchToWorkspace
(
LOCALHOST
)(
dispatch
)
// setState(prevState => {
// setState(prevState => {
// return { ...prevState, loadingLocalhost: true }
// return { ...prevState, loadingLocalhost: true }
// })
// })
//
})
})
provider
.
event
.
on
(
'fileExternallyChanged'
,
async
(
path
:
string
,
file
:
{
content
:
string
})
=>
{
provider
.
event
.
on
(
'fileExternallyChanged'
,
async
(
path
:
string
,
file
:
{
content
:
string
})
=>
{
const
config
=
plugin
.
registry
.
get
(
'config'
).
api
const
config
=
plugin
.
registry
.
get
(
'config'
).
api
...
@@ -458,6 +450,7 @@ export const createWorkspace = (workspaceName: string) => (dispatch: React.Dispa
...
@@ -458,6 +450,7 @@ export const createWorkspace = (workspaceName: string) => (dispatch: React.Dispa
promise
.
then
(
async
()
=>
{
promise
.
then
(
async
()
=>
{
await
plugin
.
fileManager
.
closeAllFiles
()
await
plugin
.
fileManager
.
closeAllFiles
()
dispatch
(
createWorkspaceSuccess
(
workspaceName
))
dispatch
(
createWorkspaceSuccess
(
workspaceName
))
switchToWorkspace
(
workspaceName
)(
dispatch
)
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
dispatch
(
createWorkspaceError
({
error
}))
dispatch
(
createWorkspaceError
({
error
}))
})
})
...
@@ -486,21 +479,21 @@ export const fetchWorkspaceDirectory = (path: string) => (dispatch: React.Dispat
...
@@ -486,21 +479,21 @@ export const fetchWorkspaceDirectory = (path: string) => (dispatch: React.Dispat
export
const
switchToWorkspace
=
(
name
:
string
)
=>
async
(
dispatch
:
React
.
Dispatch
<
any
>
)
=>
{
export
const
switchToWorkspace
=
(
name
:
string
)
=>
async
(
dispatch
:
React
.
Dispatch
<
any
>
)
=>
{
await
plugin
.
fileManager
.
closeAllFiles
()
await
plugin
.
fileManager
.
closeAllFiles
()
if
(
name
===
LOCALHOST
)
{
if
(
name
===
LOCALHOST
)
{
plugin
.
file
Providers
.
workspace
.
clearWorkspace
(
)
plugin
.
file
Manager
.
setMode
(
'localhost'
)
const
isActive
=
await
plugin
.
call
(
'manager'
,
'isActive'
,
'remixd'
)
const
isActive
=
await
plugin
.
call
(
'manager'
,
'isActive'
,
'remixd'
)
if
(
!
isActive
)
plugin
.
call
(
'manager'
,
'activatePlugin'
,
'remixd'
)
if
(
!
isActive
)
await
plugin
.
call
(
'manager'
,
'activatePlugin'
,
'remixd'
)
plugin
.
fileManager
.
setMode
(
'localhost'
)
dispatch
(
setMode
(
'localhost'
))
dispatch
(
setMode
(
'localhost'
))
plugin
.
emit
(
'setWorkspace'
,
{
name
:
LOCALHOST
,
isLocalhost
:
true
})
plugin
.
emit
(
'setWorkspace'
,
{
name
:
LOCALHOST
,
isLocalhost
:
true
})
}
else
if
(
name
===
NO_WORKSPACE
)
{
}
else
if
(
name
===
NO_WORKSPACE
)
{
plugin
.
fileProviders
.
workspace
.
clearWorkspace
()
plugin
.
fileProviders
.
workspace
.
clearWorkspace
()
}
else
{
}
else
{
plugin
.
fileManager
.
setMode
(
'browser'
)
const
isActive
=
await
plugin
.
call
(
'manager'
,
'isActive'
,
'remixd'
)
const
isActive
=
await
plugin
.
call
(
'manager'
,
'isActive'
,
'remixd'
)
if
(
isActive
)
plugin
.
call
(
'manager'
,
'deactivatePlugin'
,
'remixd'
)
if
(
isActive
)
plugin
.
call
(
'manager'
,
'deactivatePlugin'
,
'remixd'
)
await
plugin
.
fileProviders
.
workspace
.
setWorkspace
(
name
)
await
plugin
.
fileProviders
.
workspace
.
setWorkspace
(
name
)
plugin
.
fileManager
.
setMode
(
'browser'
)
dispatch
(
setMode
(
'browser'
))
dispatch
(
setMode
(
'browser'
))
dispatch
(
setCurrentWorkspace
(
name
))
dispatch
(
setCurrentWorkspace
(
name
))
plugin
.
emit
(
'setWorkspace'
,
{
name
,
isLocalhost
:
false
})
plugin
.
emit
(
'setWorkspace'
,
{
name
,
isLocalhost
:
false
})
...
...
libs/remix-ui/workspace/src/lib/reducers/workspace.ts
View file @
736aab3e
...
@@ -187,6 +187,13 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
...
@@ -187,6 +187,13 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
isRequesting
:
false
,
isRequesting
:
false
,
isSuccessful
:
true
,
isSuccessful
:
true
,
error
:
null
error
:
null
},
localhost
:
{
...
state
.
localhost
,
files
:
state
.
mode
===
'localhost'
?
fetchWorkspaceDirectoryContent
(
state
,
payload
)
:
state
.
localhost
.
files
,
isRequesting
:
false
,
isSuccessful
:
true
,
error
:
null
}
}
}
}
}
}
...
@@ -422,7 +429,7 @@ const fileRemoved = (state: BrowserState, path: string): { [x: string]: Record<s
...
@@ -422,7 +429,7 @@ const fileRemoved = (state: BrowserState, path: string): { [x: string]: Record<s
}
}
// IDEA: Modify function to remove blank input field without fetching content
// IDEA: Modify function to remove blank input field without fetching content
const
fetchDirectoryContent
=
(
state
:
BrowserState
,
payload
:
{
fileTree
,
path
:
string
,
type
?:
'file'
|
'folder'
},
deletePath
?:
string
)
=>
{
const
fetchDirectoryContent
=
(
state
:
BrowserState
,
payload
:
{
fileTree
,
path
:
string
,
type
?:
'file'
|
'folder'
},
deletePath
?:
string
)
:
{
[
x
:
string
]:
Record
<
string
,
File
>
}
=>
{
if
(
!
payload
.
fileTree
)
return
state
.
mode
===
'browser'
?
state
.
browser
.
files
:
state
[
state
.
mode
].
files
if
(
!
payload
.
fileTree
)
return
state
.
mode
===
'browser'
?
state
.
browser
.
files
:
state
[
state
.
mode
].
files
if
(
state
.
mode
===
'browser'
)
{
if
(
state
.
mode
===
'browser'
)
{
if
(
payload
.
path
===
state
.
browser
.
currentWorkspace
)
{
if
(
payload
.
path
===
state
.
browser
.
currentWorkspace
)
{
...
@@ -446,7 +453,7 @@ const fetchDirectoryContent = (state: BrowserState, payload: { fileTree, path: s
...
@@ -446,7 +453,7 @@ const fetchDirectoryContent = (state: BrowserState, payload: { fileTree, path: s
return
files
return
files
}
}
}
else
{
}
else
{
if
(
payload
.
path
===
state
.
mode
)
{
if
(
payload
.
path
===
state
.
mode
||
payload
.
path
===
'/'
)
{
let
files
=
normalize
(
payload
.
fileTree
,
payload
.
path
,
payload
.
type
)
let
files
=
normalize
(
payload
.
fileTree
,
payload
.
path
,
payload
.
type
)
files
=
_
.
merge
(
files
,
state
[
state
.
mode
].
files
[
state
.
mode
])
files
=
_
.
merge
(
files
,
state
[
state
.
mode
].
files
[
state
.
mode
])
...
...
libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
View file @
736aab3e
...
@@ -29,14 +29,11 @@ export function Workspace (props: WorkspaceProps) {
...
@@ -29,14 +29,11 @@ export function Workspace (props: WorkspaceProps) {
setCurrentWorkspace
(
global
.
fs
.
browser
.
currentWorkspace
)
setCurrentWorkspace
(
global
.
fs
.
browser
.
currentWorkspace
)
global
.
dispatchFetchWorkspaceDirectory
(
global
.
fs
.
browser
.
currentWorkspace
)
global
.
dispatchFetchWorkspaceDirectory
(
global
.
fs
.
browser
.
currentWorkspace
)
}
else
if
(
global
.
fs
.
mode
===
'localhost'
)
{
}
else
if
(
global
.
fs
.
mode
===
'localhost'
)
{
global
.
dispatchFetchWorkspaceDirectory
(
'localhost'
)
// global.dispatchFetchWorkspaceDirectory('/')
setCurrentWorkspace
(
LOCALHOST
)
}
}
},
[
global
.
fs
.
browser
.
currentWorkspace
,
global
.
fs
.
localhost
.
sharedFolder
,
global
.
fs
.
mode
])
},
[
global
.
fs
.
browser
.
currentWorkspace
,
global
.
fs
.
localhost
.
sharedFolder
,
global
.
fs
.
mode
])
useEffect
(()
=>
{
if
(
global
.
fs
.
mode
===
'localhost'
)
setCurrentWorkspace
(
LOCALHOST
)
},
[
global
.
fs
.
mode
])
props
.
plugin
.
resetNewFile
=
()
=>
{
props
.
plugin
.
resetNewFile
=
()
=>
{
setState
(
prevState
=>
{
setState
(
prevState
=>
{
return
{
...
prevState
,
displayNewFile
:
!
state
.
displayNewFile
}
return
{
...
prevState
,
displayNewFile
:
!
state
.
displayNewFile
}
...
@@ -217,7 +214,7 @@ export function Workspace (props: WorkspaceProps) {
...
@@ -217,7 +214,7 @@ export function Workspace (props: WorkspaceProps) {
<
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'
>
{
state
.
hideRemixdExplorer
&&
currentWorkspace
&&
currentWorkspace
!==
NO_WORKSPACE
&&
currentWorkspace
!==
LOCALHOST
&&
{
global
.
fs
.
mode
===
'browser'
&&
<
FileExplorer
<
FileExplorer
name=
{
currentWorkspace
}
name=
{
currentWorkspace
}
registry=
{
props
.
plugin
.
registry
}
registry=
{
props
.
plugin
.
registry
}
...
@@ -237,7 +234,7 @@ export function Workspace (props: WorkspaceProps) {
...
@@ -237,7 +234,7 @@ export function Workspace (props: WorkspaceProps) {
{
{
state
.
loadingLocalhost
?
<
div
className=
"text-center py-5"
><
i
className=
"fas fa-spinner fa-pulse fa-2x"
></
i
></
div
>
state
.
loadingLocalhost
?
<
div
className=
"text-center py-5"
><
i
className=
"fas fa-spinner fa-pulse fa-2x"
></
i
></
div
>
:
<
div
className=
'pl-2 filesystemexplorer remixui_treeview'
>
:
<
div
className=
'pl-2 filesystemexplorer remixui_treeview'
>
{
!
state
.
hideRemixdExplorer
&&
{
global
.
fs
.
mode
===
'localhost'
&&
<
FileExplorer
<
FileExplorer
name=
'localhost'
name=
'localhost'
registry=
{
props
.
plugin
.
registry
}
registry=
{
props
.
plugin
.
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