abstract relmixd from filemanager

pull/1/head
yann300 6 years ago
parent 215db3a879
commit 2cc774b230
  1. 3
      src/app/files/fileManager.js
  2. 7
      src/app/files/shared-folder.js
  3. 8
      src/app/panels/file-panel.js

@ -40,6 +40,9 @@ class FileManager {
self._deps.localhostExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) }) self._deps.localhostExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) })
self._deps.configExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) }) self._deps.configExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) })
self._deps.gistExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) }) self._deps.gistExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) })
self._deps.localhostExplorer.event.register('errored', (event) => { this.removeTabsOf(self._deps.localhostExplorer) })
self._deps.localhostExplorer.event.register('closed', (event) => { this.removeTabsOf(self._deps.localhostExplorer) })
} }
fileRenamedEvent (oldName, newName, isFolder) { fileRenamedEvent (oldName, newName, isFolder) {

@ -14,6 +14,13 @@ module.exports = class SharedFolder {
this.filesContent = {} this.filesContent = {}
this.files = {} this.files = {}
var remixdEvents = ['connecting', 'connected', 'errored', 'closed']
remixdEvents.forEach((value) => {
remixd.event.register(value, (event) => {
this.event.trigger(value, [event])
})
})
remixd.event.register('notified', (data) => { remixd.event.register('notified', (data) => {
if (data.scope === 'sharedfolder') { if (data.scope === 'sharedfolder') {
if (data.name === 'created') { if (data.name === 'created') {

@ -143,24 +143,24 @@ function filepanel (localRegistry) {
fileExplorer.ensureRoot() fileExplorer.ensureRoot()
configExplorer.ensureRoot() configExplorer.ensureRoot()
var websocketconn = element.querySelector('.websocketconn') var websocketconn = element.querySelector('.websocketconn')
self._deps.fileProviders['localhost'].remixd.event.register('connecting', (event) => { self._deps.fileProviders['localhost'].event.register('connecting', (event) => {
websocketconn.style.color = styles.colors.yellow websocketconn.style.color = styles.colors.yellow
websocketconn.setAttribute('title', 'Connecting to localhost. ' + JSON.stringify(event)) websocketconn.setAttribute('title', 'Connecting to localhost. ' + JSON.stringify(event))
}) })
self._deps.fileProviders['localhost'].remixd.event.register('connected', (event) => { self._deps.fileProviders['localhost'].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() fileSystemExplorer.show()
}) })
self._deps.fileProviders['localhost'].remixd.event.register('errored', (event) => { self._deps.fileProviders['localhost'].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))
fileSystemExplorer.hide() fileSystemExplorer.hide()
}) })
self._deps.fileProviders['localhost'].remixd.event.register('closed', (event) => { self._deps.fileProviders['localhost'].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))
fileSystemExplorer.hide() fileSystemExplorer.hide()

Loading…
Cancel
Save