Commit 4fe31d7e authored by yann300's avatar yann300

fix remixd provider

parent 447745fe
......@@ -54,6 +54,11 @@ module.exports = class RemixDProvider {
close (cb) {
this._isReady = false
cb()
this.event.trigger('disconnected')
}
preInit () {
this._registerEvent()
}
init (cb) {
......@@ -63,6 +68,7 @@ module.exports = class RemixDProvider {
this._isReady = true
this._readOnlyMode = result
this._registerEvent()
this.event.trigger('connected')
cb && cb()
}).catch((error) => {
cb && cb(error)
......
......@@ -30,15 +30,13 @@ const profile = {
}
export class RemixdHandle extends WebsocketPlugin {
constructor (fileSystemExplorer, locahostProvider, appManager) {
constructor (locahostProvider, appManager) {
super(profile)
this.fileSystemExplorer = fileSystemExplorer
this.locahostProvider = locahostProvider
this.appManager = appManager
}
deactivate () {
this.fileSystemExplorer.hide()
if (super.socket) super.deactivate()
this.call('manager', 'deactivatePlugin', 'git')
this.locahostProvider.close((error) => {
......@@ -82,9 +80,7 @@ export class RemixdHandle extends WebsocketPlugin {
this.canceled()
}
}, 3000)
this.locahostProvider.init(() => {
this.fileSystemExplorer.show()
})
this.locahostProvider.init(() => {})
this.call('manager', 'activatePlugin', 'git')
}
}
......
......@@ -57,7 +57,7 @@ module.exports = class Filepanel extends ViewPlugin {
this.el = document.createElement('div')
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.registeredMenuItems = []
this.request = {}
......@@ -106,7 +106,7 @@ module.exports = class Filepanel extends ViewPlugin {
}
async getCurrentWorkspace () {
return await this.request.getWorkspaces()
return await this.request.getCurrentWorkspace()
}
async getWorkspaces () {
......
......@@ -83,6 +83,16 @@ export const Workspace = (props: WorkspaceProps) => {
getWorkspaces()
}, [props.workspaces])
useEffect(() => {
props.localhost.event.register('connected', (event) => {
remixdExplorer.show()
})
props.localhost.event.register('disconnected', (event) => {
remixdExplorer.hide()
})
}, [])
const [state, setState] = useState({
workspaces: [],
reset: false,
......@@ -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 = () => {
setState(prevState => {
return { ...prevState, modal: { ...state.modal, hide: true, message: null } }
......@@ -352,7 +348,7 @@ export const Workspace = (props: WorkspaceProps) => {
<div className='remixui_fileExplorerTree'>
<div>
<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
name={state.currentWorkspace}
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