Commit 4fe31d7e authored by yann300's avatar yann300

fix remixd provider

parent 447745fe
...@@ -54,6 +54,11 @@ module.exports = class RemixDProvider { ...@@ -54,6 +54,11 @@ module.exports = class RemixDProvider {
close (cb) { close (cb) {
this._isReady = false this._isReady = false
cb() cb()
this.event.trigger('disconnected')
}
preInit () {
this._registerEvent()
} }
init (cb) { init (cb) {
...@@ -63,6 +68,7 @@ module.exports = class RemixDProvider { ...@@ -63,6 +68,7 @@ module.exports = class RemixDProvider {
this._isReady = true this._isReady = true
this._readOnlyMode = result this._readOnlyMode = result
this._registerEvent() this._registerEvent()
this.event.trigger('connected')
cb && cb() cb && cb()
}).catch((error) => { }).catch((error) => {
cb && cb(error) cb && cb(error)
......
...@@ -30,15 +30,13 @@ const profile = { ...@@ -30,15 +30,13 @@ const profile = {
} }
export class RemixdHandle extends WebsocketPlugin { export class RemixdHandle extends WebsocketPlugin {
constructor (fileSystemExplorer, locahostProvider, appManager) { constructor (locahostProvider, appManager) {
super(profile) super(profile)
this.fileSystemExplorer = fileSystemExplorer
this.locahostProvider = locahostProvider this.locahostProvider = locahostProvider
this.appManager = appManager this.appManager = appManager
} }
deactivate () { deactivate () {
this.fileSystemExplorer.hide()
if (super.socket) super.deactivate() if (super.socket) super.deactivate()
this.call('manager', 'deactivatePlugin', 'git') this.call('manager', 'deactivatePlugin', 'git')
this.locahostProvider.close((error) => { this.locahostProvider.close((error) => {
...@@ -82,9 +80,7 @@ export class RemixdHandle extends WebsocketPlugin { ...@@ -82,9 +80,7 @@ export class RemixdHandle extends WebsocketPlugin {
this.canceled() this.canceled()
} }
}, 3000) }, 3000)
this.locahostProvider.init(() => { this.locahostProvider.init(() => {})
this.fileSystemExplorer.show()
})
this.call('manager', 'activatePlugin', 'git') this.call('manager', 'activatePlugin', 'git')
} }
} }
......
...@@ -57,7 +57,7 @@ module.exports = class Filepanel extends ViewPlugin { ...@@ -57,7 +57,7 @@ module.exports = class Filepanel extends ViewPlugin {
this.el = document.createElement('div') this.el = document.createElement('div')
this.el.setAttribute('id', 'fileExplorerView') this.el.setAttribute('id', 'fileExplorerView')
this.remixdHandle = new RemixdHandle(this.remixdExplorer, this._deps.fileProviders.localhost, appManager) this.remixdHandle = new RemixdHandle(this._deps.fileProviders.localhost, appManager)
this.gitHandle = new GitHandle() this.gitHandle = new GitHandle()
this.registeredMenuItems = [] this.registeredMenuItems = []
this.request = {} this.request = {}
...@@ -106,7 +106,7 @@ module.exports = class Filepanel extends ViewPlugin { ...@@ -106,7 +106,7 @@ module.exports = class Filepanel extends ViewPlugin {
} }
async getCurrentWorkspace () { async getCurrentWorkspace () {
return await this.request.getWorkspaces() return await this.request.getCurrentWorkspace()
} }
async getWorkspaces () { async getWorkspaces () {
......
...@@ -83,6 +83,16 @@ export const Workspace = (props: WorkspaceProps) => { ...@@ -83,6 +83,16 @@ export const Workspace = (props: WorkspaceProps) => {
getWorkspaces() getWorkspaces()
}, [props.workspaces]) }, [props.workspaces])
useEffect(() => {
props.localhost.event.register('connected', (event) => {
remixdExplorer.show()
})
props.localhost.event.register('disconnected', (event) => {
remixdExplorer.hide()
})
}, [])
const [state, setState] = useState({ const [state, setState] = useState({
workspaces: [], workspaces: [],
reset: false, reset: false,
...@@ -222,20 +232,6 @@ export const Workspace = (props: WorkspaceProps) => { ...@@ -222,20 +232,6 @@ export const Workspace = (props: WorkspaceProps) => {
} }
} }
props.localhost.event.register('connecting', (event) => {})
props.localhost.event.register('connected', (event) => {
remixdExplorer.show()
})
props.localhost.event.register('errored', (event) => {
remixdExplorer.hide()
})
props.localhost.event.register('closed', (event) => {
remixdExplorer.hide()
})
const handleHideModal = () => { const handleHideModal = () => {
setState(prevState => { setState(prevState => {
return { ...prevState, modal: { ...state.modal, hide: true, message: null } } return { ...prevState, modal: { ...state.modal, hide: true, message: null } }
...@@ -352,7 +348,7 @@ export const Workspace = (props: WorkspaceProps) => { ...@@ -352,7 +348,7 @@ export const 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 && state.currentWorkspace && state.currentWorkspace !== NO_WORKSPACE && { state.hideRemixdExplorer && state.currentWorkspace && state.currentWorkspace !== NO_WORKSPACE && state.currentWorkspace !== LOCALHOST &&
<FileExplorer <FileExplorer
name={state.currentWorkspace} name={state.currentWorkspace}
registry={props.registry} registry={props.registry}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment