diff options
Diffstat (limited to 'devtools/client/netmonitor/actions')
-rw-r--r-- | devtools/client/netmonitor/actions/filters.js | 57 | ||||
-rw-r--r-- | devtools/client/netmonitor/actions/index.js | 9 | ||||
-rw-r--r-- | devtools/client/netmonitor/actions/moz.build | 10 | ||||
-rw-r--r-- | devtools/client/netmonitor/actions/sidebar.js | 49 |
4 files changed, 125 insertions, 0 deletions
diff --git a/devtools/client/netmonitor/actions/filters.js b/devtools/client/netmonitor/actions/filters.js new file mode 100644 index 000000000..71582546a --- /dev/null +++ b/devtools/client/netmonitor/actions/filters.js @@ -0,0 +1,57 @@ +/* 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"; + +const { + TOGGLE_FILTER_TYPE, + ENABLE_FILTER_TYPE_ONLY, + SET_FILTER_TEXT, +} = require("../constants"); + +/** + * Toggle an existing filter type state. + * If type 'all' is specified, all the other filter types are set to false. + * Available filter types are defined in filters reducer. + * + * @param {string} filter - A filter type is going to be updated + */ +function toggleFilterType(filter) { + return { + type: TOGGLE_FILTER_TYPE, + filter, + }; +} + +/** + * Enable filter type exclusively. + * Except filter type is set to true, all the other filter types are set + * to false. + * Available filter types are defined in filters reducer. + * + * @param {string} filter - A filter type is going to be updated + */ +function enableFilterTypeOnly(filter) { + return { + type: ENABLE_FILTER_TYPE_ONLY, + filter, + }; +} + +/** + * Set filter text. + * + * @param {string} url - A filter text is going to be set + */ +function setFilterText(url) { + return { + type: SET_FILTER_TEXT, + url, + }; +} + +module.exports = { + toggleFilterType, + enableFilterTypeOnly, + setFilterText, +}; diff --git a/devtools/client/netmonitor/actions/index.js b/devtools/client/netmonitor/actions/index.js new file mode 100644 index 000000000..3f7b0bd2f --- /dev/null +++ b/devtools/client/netmonitor/actions/index.js @@ -0,0 +1,9 @@ +/* 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"; + +const filters = require("./filters"); +const sidebar = require("./sidebar"); + +module.exports = Object.assign({}, filters, sidebar); diff --git a/devtools/client/netmonitor/actions/moz.build b/devtools/client/netmonitor/actions/moz.build new file mode 100644 index 000000000..477cafb41 --- /dev/null +++ b/devtools/client/netmonitor/actions/moz.build @@ -0,0 +1,10 @@ +# vim: set filetype=python: +# 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/. + +DevToolsModules( + 'filters.js', + 'index.js', + 'sidebar.js', +) diff --git a/devtools/client/netmonitor/actions/sidebar.js b/devtools/client/netmonitor/actions/sidebar.js new file mode 100644 index 000000000..7e8dca5c1 --- /dev/null +++ b/devtools/client/netmonitor/actions/sidebar.js @@ -0,0 +1,49 @@ +/* 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"; + +const { + DISABLE_TOGGLE_BUTTON, + SHOW_SIDEBAR, + TOGGLE_SIDEBAR, +} = require("../constants"); + +/** + * Change ToggleButton disabled state. + * + * @param {boolean} disabled - expected button disabled state + */ +function disableToggleButton(disabled) { + return { + type: DISABLE_TOGGLE_BUTTON, + disabled: disabled, + }; +} + +/** + * Change sidebar visible state. + * + * @param {boolean} visible - expected sidebar visible state + */ +function showSidebar(visible) { + return { + type: SHOW_SIDEBAR, + visible: visible, + }; +} + +/** + * Toggle to show/hide sidebar. + */ +function toggleSidebar() { + return { + type: TOGGLE_SIDEBAR, + }; +} + +module.exports = { + disableToggleButton, + showSidebar, + toggleSidebar, +}; |