-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Toolbars: TopologyToolbar converted to a React component.
- Loading branch information
1 parent
16bd789
commit 14a61df
Showing
2 changed files
with
74 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = () => ( | ||
<div className="toolbar-pf-actions miq-toolbar-actions"> | ||
<div className="miq-toolbar-group form-group"> | ||
<div className="form-group text"> | ||
<label className="topology-checkbox checkbox-inline"> | ||
<input id="box_display_names" type="checkbox" /> | ||
{__('Display Names')} | ||
</label> | ||
</div> | ||
<div className="form-group"> | ||
<button type="button" className="btn btn-default" title={__('Refresh this page')} onClick={refreshClick} > | ||
<i className="fa fa-refresh fa-lg" /> | ||
{__('Refresh')} | ||
</button> | ||
</div> | ||
<form | ||
style={{ display: 'inline' }} | ||
className="search-pf topology-search" | ||
onSubmit={searchClick} | ||
> | ||
<div className="form-group has-clear"> | ||
<div className="search-pf-input-group"> | ||
<label className="sr-only" htmlFor="search"> | ||
{__('Search')} | ||
</label> | ||
<input id="search_topology" className="form-control" type="search" placeholder={__('Search')} /> | ||
<button type="button" className="hidden" onClick={searchClick} /> | ||
<button type="button" className="clear" aria-hidden="true" onClick={resetSearchClick}> | ||
<span className="pficon pficon-close" /> | ||
</button> | ||
</div> | ||
</div> | ||
<div className="form-group search-button"> | ||
<button type="button" className="btn btn-default search-topology-button" onClick={searchClick}> | ||
<span className="fa fa-search" /> | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
|
||
TopologyToolbar.propTypes = { | ||
}; | ||
|
||
export default TopologyToolbar; |