Commit d054f317 authored by yann300's avatar yann300

fix localhost explorer ui interface

parent 825fd8f7
...@@ -228,14 +228,23 @@ function fileExplorer (appAPI, files) { ...@@ -228,14 +228,23 @@ function fileExplorer (appAPI, files) {
} }
} }
fileExplorer.prototype.hide = function () {
if (this.container) this.container.style.display = 'none'
}
fileExplorer.prototype.show = function () {
if (this.container) this.container.style.display = 'block'
}
fileExplorer.prototype.init = function () { fileExplorer.prototype.init = function () {
this.container = yo`<div></div>` this.container = yo`<div></div>`
return this.container return this.container
} }
fileExplorer.prototype.ensureRoot = function (cb) { fileExplorer.prototype.ensureRoot = function (cb) {
cb = cb || (() => {})
var self = this var self = this
if (self.element && cb) return cb() if (self.element) return cb()
self.files.resolveDirectory('/', (error, files) => { self.files.resolveDirectory('/', (error, files) => {
if (error) console.error(error) if (error) console.error(error)
......
...@@ -89,7 +89,6 @@ function filepanel (appAPI, filesProvider) { ...@@ -89,7 +89,6 @@ function filepanel (appAPI, filesProvider) {
self.event = event self.event = event
var element = template() var element = template()
fileExplorer.ensureRoot() fileExplorer.ensureRoot()
var containerFileSystem = element.querySelector('.filesystemexplorer')
var websocketconn = element.querySelector('.websocketconn') var websocketconn = element.querySelector('.websocketconn')
filesProvider['localhost'].remixd.event.register('connecting', (event) => { filesProvider['localhost'].remixd.event.register('connecting', (event) => {
websocketconn.style.color = styles.colors.yellow websocketconn.style.color = styles.colors.yellow
...@@ -99,22 +98,19 @@ function filepanel (appAPI, filesProvider) { ...@@ -99,22 +98,19 @@ function filepanel (appAPI, filesProvider) {
filesProvider['localhost'].remixd.event.register('connected', (event) => { filesProvider['localhost'].remixd.event.register('connected', (event) => {
websocketconn.style.color = styles.colors.green websocketconn.style.color = styles.colors.green
websocketconn.setAttribute('title', 'Connected to localhost. ' + JSON.stringify(event)) websocketconn.setAttribute('title', 'Connected to localhost. ' + JSON.stringify(event))
fileSystemExplorer.show()
}) })
filesProvider['localhost'].remixd.event.register('errored', (event) => { filesProvider['localhost'].remixd.event.register('errored', (event) => {
websocketconn.style.color = styles.colors.red websocketconn.style.color = styles.colors.red
websocketconn.setAttribute('title', 'localhost connection errored. ' + JSON.stringify(event)) websocketconn.setAttribute('title', 'localhost connection errored. ' + JSON.stringify(event))
if (fileSystemExplorer.element && containerFileSystem.children.length > 0) { fileSystemExplorer.hide()
containerFileSystem.removeChild(fileSystemExplorer.element)
}
}) })
filesProvider['localhost'].remixd.event.register('closed', (event) => { filesProvider['localhost'].remixd.event.register('closed', (event) => {
websocketconn.style.color = styles.colors.black websocketconn.style.color = styles.colors.black
websocketconn.setAttribute('title', 'localhost connection closed. ' + JSON.stringify(event)) websocketconn.setAttribute('title', 'localhost connection closed. ' + JSON.stringify(event))
if (fileSystemExplorer.element && containerFileSystem.children.length > 0) { fileSystemExplorer.hide()
containerFileSystem.removeChild(fileSystemExplorer.element)
}
}) })
fileExplorer.events.register('focus', function (path) { fileExplorer.events.register('focus', function (path) {
......
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