summaryrefslogtreecommitdiffstats
path: root/devtools/client/dom/content/components/MainToolbar.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /devtools/client/dom/content/components/MainToolbar.js
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/dom/content/components/MainToolbar.js')
-rw-r--r--devtools/client/dom/content/components/MainToolbar.js76
1 files changed, 76 insertions, 0 deletions
diff --git a/devtools/client/dom/content/components/MainToolbar.js b/devtools/client/dom/content/components/MainToolbar.js
new file mode 100644
index 0000000000..f3f018741a
--- /dev/null
+++ b/devtools/client/dom/content/components/MainToolbar.js
@@ -0,0 +1,76 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+"use strict";
+
+// React
+const {
+ Component,
+ createFactory,
+} = require("resource://devtools/client/shared/vendor/react.js");
+const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js");
+const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.js");
+const SearchBox = createFactory(
+ require("resource://devtools/client/shared/components/SearchBox.js")
+);
+
+const { l10n } = require("resource://devtools/client/dom/content/utils.js");
+
+// Actions
+const {
+ fetchProperties,
+} = require("resource://devtools/client/dom/content/actions/grips.js");
+const {
+ setVisibilityFilter,
+} = require("resource://devtools/client/dom/content/actions/filter.js");
+
+/**
+ * This template is responsible for rendering a toolbar
+ * within the 'Headers' panel.
+ */
+class MainToolbar extends Component {
+ static get propTypes() {
+ return {
+ object: PropTypes.any.isRequired,
+ dispatch: PropTypes.func.isRequired,
+ };
+ }
+
+ constructor(props) {
+ super(props);
+ this.onRefresh = this.onRefresh.bind(this);
+ this.onSearch = this.onSearch.bind(this);
+ }
+
+ onRefresh() {
+ this.props.dispatch(fetchProperties(this.props.object));
+ }
+
+ onSearch(value) {
+ this.props.dispatch(setVisibilityFilter(value));
+ }
+
+ render() {
+ return dom.div(
+ { className: "devtools-toolbar devtools-input-toolbar" },
+ SearchBox({
+ key: "filter",
+ delay: 250,
+ onChange: this.onSearch,
+ placeholder: l10n.getStr("dom.filterDOMPanel"),
+ type: "filter",
+ }),
+ dom.span({ className: "devtools-separator" }),
+ dom.button({
+ key: "refresh",
+ className: "refresh devtools-button",
+ id: "dom-refresh-button",
+ title: l10n.getStr("dom.refresh"),
+ onClick: this.onRefresh,
+ })
+ );
+ }
+}
+
+// Exports from this module
+module.exports = MainToolbar;