diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/netmonitor/toolbar-view.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/netmonitor/toolbar-view.js')
-rw-r--r-- | devtools/client/netmonitor/toolbar-view.js | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/devtools/client/netmonitor/toolbar-view.js b/devtools/client/netmonitor/toolbar-view.js new file mode 100644 index 000000000..28c3cf99b --- /dev/null +++ b/devtools/client/netmonitor/toolbar-view.js @@ -0,0 +1,77 @@ +/* globals dumpn, $, NetMonitorView */ +"use strict"; + +const { createFactory, DOM } = require("devtools/client/shared/vendor/react"); +const ReactDOM = require("devtools/client/shared/vendor/react-dom"); +const Provider = createFactory(require("devtools/client/shared/vendor/react-redux").Provider); +const FilterButtons = createFactory(require("./components/filter-buttons")); +const ToggleButton = createFactory(require("./components/toggle-button")); +const SearchBox = createFactory(require("./components/search-box")); +const { L10N } = require("./l10n"); + +// Shortcuts +const { button } = DOM; + +/** + * Functions handling the toolbar view: expand/collapse button etc. + */ +function ToolbarView() { + dumpn("ToolbarView was instantiated"); +} + +ToolbarView.prototype = { + /** + * Initialization function, called when the debugger is started. + */ + initialize: function (store) { + dumpn("Initializing the ToolbarView"); + + this._clearContainerNode = $("#react-clear-button-hook"); + this._filterContainerNode = $("#react-filter-buttons-hook"); + this._toggleContainerNode = $("#react-details-pane-toggle-hook"); + this._searchContainerNode = $("#react-search-box-hook"); + + // clear button + ReactDOM.render(button({ + id: "requests-menu-clear-button", + className: "devtools-button devtools-clear-icon", + title: L10N.getStr("netmonitor.toolbar.clear"), + onClick: () => { + NetMonitorView.RequestsMenu.clear(); + } + }), this._clearContainerNode); + + // filter button + ReactDOM.render(Provider( + { store }, + FilterButtons() + ), this._filterContainerNode); + + // search box + ReactDOM.render(Provider( + { store }, + SearchBox() + ), this._searchContainerNode); + + // details pane toggle button + ReactDOM.render(Provider( + { store }, + ToggleButton() + ), this._toggleContainerNode); + }, + + /** + * Destruction function, called when the debugger is closed. + */ + destroy: function () { + dumpn("Destroying the ToolbarView"); + + ReactDOM.unmountComponentAtNode(this._clearContainerNode); + ReactDOM.unmountComponentAtNode(this._filterContainerNode); + ReactDOM.unmountComponentAtNode(this._toggleContainerNode); + ReactDOM.unmountComponentAtNode(this._searchContainerNode); + } + +}; + +exports.ToolbarView = ToolbarView; |