pull/1/head
Iuri Matias 6 years ago committed by yann300
parent 7f2c2900e5
commit e207efbcfa
  1. 96
      src/app/debugger/debuggerUI/vmDebugger/DropdownPanel.js

@ -2,8 +2,8 @@
var yo = require('yo-yo') var yo = require('yo-yo')
const copy = require('clipboard-copy') const copy = require('clipboard-copy')
var remixLib = require('remix-lib') var remixLib = require('remix-lib')
var TreeView = require('../../../ui/TreeView') // TODO setup a direct reference to the UI components
var EventManager = remixLib.EventManager var EventManager = remixLib.EventManager
var TreeView = require('../../../ui/TreeView') // TODO setup a direct reference to the UI components
var csjs = require('csjs-inject') var csjs = require('csjs-inject')
var styleGuide = require('../../../ui/styles-guide/theme-chooser') var styleGuide = require('../../../ui/styles-guide/theme-chooser')
@ -69,51 +69,46 @@ function DropdownPanel (_name, _opts) {
} }
DropdownPanel.prototype.setMessage = function (message) { DropdownPanel.prototype.setMessage = function (message) {
if (this.view) { if (!this.view) return
this.view.querySelector('.dropdownpanel .dropdownrawcontent').style.display = 'none' this.view.querySelector('.dropdownpanel .dropdownrawcontent').style.display = 'none'
this.view.querySelector('.dropdownpanel .dropdowncontent').style.display = 'none' this.view.querySelector('.dropdownpanel .dropdowncontent').style.display = 'none'
this.view.querySelector('.dropdownpanel .fa-refresh').style.display = 'none' this.view.querySelector('.dropdownpanel .fa-refresh').style.display = 'none'
this.message(message) this.message(message)
}
} }
DropdownPanel.prototype.setLoading = function () { DropdownPanel.prototype.setLoading = function () {
if (this.view) { if (!this.view) return
this.view.querySelector('.dropdownpanel .dropdownrawcontent').style.display = 'none' this.view.querySelector('.dropdownpanel .dropdownrawcontent').style.display = 'none'
this.view.querySelector('.dropdownpanel .dropdowncontent').style.display = 'none' this.view.querySelector('.dropdownpanel .dropdowncontent').style.display = 'none'
this.view.querySelector('.dropdownpanel .fa-refresh').style.display = 'inline-block' this.view.querySelector('.dropdownpanel .fa-refresh').style.display = 'inline-block'
this.message('') this.message('')
}
} }
DropdownPanel.prototype.setUpdating = function () { DropdownPanel.prototype.setUpdating = function () {
if (this.view) { if (!this.view) return
this.view.querySelector('.dropdownpanel .dropdowncontent').style.color = styles.appProperties.greyedText_color this.view.querySelector('.dropdownpanel .dropdowncontent').style.color = styles.appProperties.greyedText_color
}
} }
DropdownPanel.prototype.update = function (_data, _header) { DropdownPanel.prototype.update = function (_data, _header) {
if (this.view) { if (!this.view) return
this.view.querySelector('.dropdownpanel .fa-refresh').style.display = 'none' this.view.querySelector('.dropdownpanel .fa-refresh').style.display = 'none'
this.view.querySelector('.dropdownpanel .dropdowncontent').style.display = 'block' this.view.querySelector('.dropdownpanel .dropdowncontent').style.display = 'block'
this.view.querySelector('.dropdownpanel .dropdowncontent').style.color = styles.appProperties.mainText_Color this.view.querySelector('.dropdownpanel .dropdowncontent').style.color = styles.appProperties.mainText_Color
this.view.querySelector('.dropdownpanel .dropdownrawcontent').innerText = JSON.stringify(_data, null, '\t') this.view.querySelector('.dropdownpanel .dropdownrawcontent').innerText = JSON.stringify(_data, null, '\t')
if (!this.displayContentOnly) { if (!this.displayContentOnly) {
this.view.querySelector('.title div.btn').style.display = 'block' this.view.querySelector('.title div.btn').style.display = 'block'
this.view.querySelector('.title span').innerText = _header || ' ' this.view.querySelector('.title span').innerText = _header || ' '
} }
this.message('') this.message('')
if (this.json) { if (this.json) {
this.treeView.update(_data) this.treeView.update(_data)
}
} }
} }
DropdownPanel.prototype.setContent = function (node) { DropdownPanel.prototype.setContent = function (node) {
if (this.view) { if (!this.view) return
var parent = this.view.querySelector('.dropdownpanel div.dropdowncontent') var parent = this.view.querySelector('.dropdownpanel div.dropdowncontent')
parent.replaceChild(node, parent.firstElementChild) parent.replaceChild(node, parent.firstElementChild)
}
} }
DropdownPanel.prototype.render = function (overridestyle) { DropdownPanel.prototype.render = function (overridestyle) {
@ -178,31 +173,28 @@ DropdownPanel.prototype.toggle = function () {
} }
DropdownPanel.prototype.hide = function () { DropdownPanel.prototype.hide = function () {
if (this.view && !this.displayContentOnly) { if (!(this.view && !this.displayContentOnly)) return
var caret = this.view.querySelector('.title').firstElementChild var caret = this.view.querySelector('.title').firstElementChild
var el = this.view.querySelector('.dropdownpanel') var el = this.view.querySelector('.dropdownpanel')
el.style.display = 'none' el.style.display = 'none'
caret.className = `${css.icon} fa fa-caret-right` caret.className = `${css.icon} fa fa-caret-right`
this.event.trigger('hide', []) this.event.trigger('hide', [])
}
} }
DropdownPanel.prototype.show = function () { DropdownPanel.prototype.show = function () {
if (this.view && !this.displayContentOnly) { if (!(this.view && !this.displayContentOnly)) return
var caret = this.view.querySelector('.title').firstElementChild var caret = this.view.querySelector('.title').firstElementChild
var el = this.view.querySelector('.dropdownpanel') var el = this.view.querySelector('.dropdownpanel')
el.style.display = '' el.style.display = ''
caret.className = `${css.icon} fa fa-caret-down` caret.className = `${css.icon} fa fa-caret-down`
this.event.trigger('show', []) this.event.trigger('show', [])
}
} }
DropdownPanel.prototype.message = function (message) { DropdownPanel.prototype.message = function (message) {
if (this.view) { if (!this.view) return
var mes = this.view.querySelector('.dropdownpanel .message') var mes = this.view.querySelector('.dropdownpanel .message')
mes.innerText = message mes.innerText = message
mes.style.display = (message === '') ? 'none' : 'block' mes.style.display = (message === '') ? 'none' : 'block'
}
} }
module.exports = DropdownPanel module.exports = DropdownPanel

Loading…
Cancel
Save