From 14a61dfd8766ca49ed8177b6cfc9558d0cb31211 Mon Sep 17 00:00:00 2001 From: Martin Povolny Date: Fri, 13 Sep 2019 19:15:10 +0200 Subject: [PATCH] Toolbars: TopologyToolbar converted to a React component. --- .../components/dashboard_toolbar.jsx | 18 +++-- .../components/topology_toolbar.jsx | 66 +++++++++++++++++++ 2 files changed, 74 insertions(+), 10 deletions(-) create mode 100644 app/javascript/components/topology_toolbar.jsx diff --git a/app/javascript/components/dashboard_toolbar.jsx b/app/javascript/components/dashboard_toolbar.jsx index 017c7ac80b12..6aa61497ff81 100644 --- a/app/javascript/components/dashboard_toolbar.jsx +++ b/app/javascript/components/dashboard_toolbar.jsx @@ -1,8 +1,6 @@ -import React, { useEffect, useReducer } from 'react'; +import React from 'react'; import PropTypes from 'prop-types'; -import { Dropdown, DropdownButton, MenuItem } from 'patternfly-react'; - -// app/views/dashboard/_widgets_menu.html.haml +import { Dropdown, MenuItem } from 'patternfly-react'; const resetButton = () => ( ); diff --git a/app/javascript/components/topology_toolbar.jsx b/app/javascript/components/topology_toolbar.jsx new file mode 100644 index 000000000000..ce70530fd599 --- /dev/null +++ b/app/javascript/components/topology_toolbar.jsx @@ -0,0 +1,66 @@ +import React from 'react'; + +const searchClick = () => { + console.log('searchClick'); + sendDataWithRx({ service: 'topologyService', name: 'searchNode' }); +}; + +const refreshClick = () => { + sendDataWithRx({ name: 'refreshTopology' }); +}; + +const resetSearchClick = () => { + console.log('resetSearchClick'); + sendDataWithRx({ service: 'topologyService', name: 'resetSearch' }); +}; +// # this hidden button is a workaround +// # pressing enter in ^input triggers a *click* event on the next button +// # without this, that button is resetSearch, which ..is undesirable :) + +// app/views/shared/_topology_header_toolbar.html.haml +const TopologyToolbar = () => ( +
+
+
+ +
+
+ +
+
+
+
+ + + +
+
+
+ +
+
+
+
+); + +TopologyToolbar.propTypes = { +}; + +export default TopologyToolbar;