Commit 0012a2ee authored by Maxime Chaillet's avatar Maxime Chaillet

clear warning related to dropdownbutton (nested <a>).

parent 896cf465
import React from 'react';
import { Well, Navbar, Nav, NavItem, MenuItem, DropdownButton, Radio } from 'react-bootstrap';
import EventListMenuButton from '../EventListMenuButton';
import { Well, Navbar, Nav, NavItem, MenuItem, DropdownButton, Radio, NavDropdown } from 'react-bootstrap';
import EventListMenuButton from './EventListMenuButton';
import { getPDF } from '../../../api/icat/icatPlus';
import { ComboSearch } from 'react-combo-search';
import PropTypes from 'prop-types';
......@@ -13,7 +13,7 @@ import NewlyAvailableEventsDialogue from './NewlyAvailableEventsDialogue';
require('./react-datetime.css');
require('./react-combo-select.css');
require('./react-combo-search.css');
require('./eventListMenu.css');
/**
* The menu displayed above the event list
*/
......@@ -72,22 +72,17 @@ class EventListMenu extends React.Component {
<Navbar.Collapse>
<Nav>
<NavItem eventKey={2} href="#" className="logbookNavItem" >
<DropdownButton id='dropdownbuttonId' onClick={(e) => { e.stopPropagation() }}
bsStyle={'primary'}
title={'View'}
bsSize='small'>
<MenuItem eventKey="1" onSelect={() => setView(DOC_VIEW)} > {view === DOC_VIEW ? <Radio checked> Classic (user's commented logs)</Radio> : <Radio checked={false}> Classic (user's commented logs)</Radio>} </MenuItem>
<MenuItem eventKey="2" onSelect={() => setView(LIST_VIEW)} > {view === LIST_VIEW ? <Radio checked> Full (all logs)</Radio> : <Radio checked={false}> Full (all logs)</Radio>} </MenuItem>
<MenuItem divider />
<MenuItem eventKey="3" onSelect={() => this.sortByDate(SORT_EVENTS_FROM_OLDEST)} > {getCurrentlyPressedSortButton() === SORT_EVENTS_FROM_OLDEST ? <Radio checked> Oldest log on top</Radio> : <Radio checked={false}> Oldest log on top</Radio>} </MenuItem>
<MenuItem eventKey="4" onSelect={() => this.sortByDate(SORT_EVENTS_FROM_YOUNGEST)} > {getCurrentlyPressedSortButton() === SORT_EVENTS_FROM_YOUNGEST ? <Radio checked> Latest log on top</Radio> : <Radio checked={false}> Latest log on top</Radio>} </MenuItem>
</DropdownButton>
</NavItem>
<NavItem eventKey={3} href={getPDF(sessionId, investigationId, selectionFilter)} target='_blank' className="logbookNavItem" >
<NavDropdown eventKey={3} title={<div className='btn btn-sm btn-primary'> View <span class='caret'></span></div>} id="nav-dropdown" className="logbookNavItem">
<MenuItem eventKey={3.1} onSelect={() => setView(DOC_VIEW)} > {view === DOC_VIEW ? <Radio checked> Classic (user's commented logs)</Radio> : <Radio checked={false}> Classic (user's commented logs)</Radio>} </MenuItem>
<MenuItem eventKey={3.2} onSelect={() => setView(LIST_VIEW)} > {view === LIST_VIEW ? <Radio checked> Full (all logs)</Radio> : <Radio checked={false}> Full (all logs)</Radio>} </MenuItem>
<MenuItem divider />
<MenuItem eventKey={3.3} onSelect={() => this.sortByDate(SORT_EVENTS_FROM_OLDEST)} > {getCurrentlyPressedSortButton() === SORT_EVENTS_FROM_OLDEST ? <Radio checked> Oldest log on top</Radio> : <Radio checked={false}> Oldest log on top</Radio>} </MenuItem>
<MenuItem eventKey={3.4} onSelect={() => this.sortByDate(SORT_EVENTS_FROM_YOUNGEST)} > {getCurrentlyPressedSortButton() === SORT_EVENTS_FROM_YOUNGEST ? <Radio checked> Latest log on top</Radio> : <Radio checked={false}> Latest log on top</Radio>} </MenuItem>
</NavDropdown>
<NavItem eventKey={4} href={getPDF(sessionId, investigationId, selectionFilter)} target='_blank' className="logbookNavItem" >
<EventListMenuButton text='PDF' glyph='download' tooltipText='Download as PDF' isEnabled={!(isNewEventVisible === undefined || isNewEventVisible === true || numberOfMatchingEventsFound === 0)} />
</NavItem>
<NavItem>
<NavItem eventKey={5} className="logbookNavItem">
<NewlyAvailableEventsDialogue latestEvents={this.props.periodicData} eventCountSinceLastRefresh={this.props.eventCountSinceLastRefresh} onIconClicked={this.props.getEvents} />
</NavItem>
</Nav>
......
......@@ -7,12 +7,14 @@ class EventListMenuButton extends React.Component {
render() {
let { isEnabled, text, glyph, tooltipText } = this.props;
if (isEnabled === false) {
return (<Button bsSize="small" bsStyle="primary" disabled > <Glyphicon glyph={glyph} />{text} </Button>);
//return (<Button bsSize="small" bsStyle="primary" disabled > <Glyphicon glyph={glyph} />{text} </Button>);
return (<div className='btn btn-sm btn-primary'> <Glyphicon glyph={glyph} />{text} </div>);
}
// default behavior
return (<OverlayTrigger placement="bottom" overlay={<Tooltip id="tooltip"> {tooltipText} </Tooltip>}>
<Button bsSize="small" bsStyle="primary" disabled={false} > <Glyphicon glyph={glyph} /> {text} </Button>
{/* <Button bsSize="small" bsStyle="primary" disabled={false} > <Glyphicon glyph={glyph} /> {text} </Button> */}
<div className='btn btn-sm btn-primary'> <Glyphicon glyph={glyph} /> {text} </div>
</OverlayTrigger>
)
}
......
......@@ -10,8 +10,8 @@ class NewlyAvailableEventsDialogue extends React.Component {
if (latestEvents && latestEvents.data && eventCountSinceLastRefresh) {
newEventCountSinceLastRefresh = (latestEvents.data.length < eventCountSinceLastRefresh) ? 0 : latestEvents.data.length - eventCountSinceLastRefresh
}
return (<span style={{ color: '#888888' }}> {newEventCountSinceLastRefresh
} new logs arrived. <Glyphicon onClick={onIconClicked} glyph='refresh' /> </span>)
return (<div className='btn btn-sm' style={{ color: '#888888' }}> {newEventCountSinceLastRefresh
} new logs arrived. <Glyphicon onClick={onIconClicked} glyph='refresh' /> </div>)
}
}
......
#nav-dropdown-menu {
padding: 0px;
color: white;
}
@media screen and (min-height: 768px) {
.dropdown {
margin-top: 8px;
}
/* this hides the caret in the navdropdown used in the EventListMenu */
.logbookNavItem.dropdown>a>span {
display: none
}
\ No newline at end of file
......@@ -23,6 +23,16 @@ class NewOrEditEventPanel extends React.Component {
isEditorContentValid: false,
optionPanelDecollaped: false
}
this.createEvent = this.createEvent.bind(this);
this.onCancelButtonClicked = this.onCancelButtonClicked.bind(this);
this.onEventModified = this.onEventModified.bind(this);
this.onSaveButtonClicked = this.onSaveButtonClicked.bind(this);
this.onSuccessfullyCreated = this.onSuccessfullyCreated.bind(this);
this.onSuccessfullyUpdated = this.onSuccessfullyUpdated.bind(this);
this.setTagContainer = this.setTagContainer.bind(this);
this.setTitleInput = this.setTitleInput.bind(this);
this.updateEvent = this.updateEvent.bind(this);
}
render() {
let { event, user, context, investigationId, setEditEventVisibility } = this.props;
......
......@@ -12,6 +12,9 @@ class OverlayBox extends React.Component {
this.state = {
isChildComponentVisible: false
};
this.onEntered = this.onEntered.bind(this);
this.onExited = this.onExited.bind(this);
}
render() {
......
import React from 'react';
import PropTypes from 'prop-types';
import { ButtonToolbar, Grid, Row, Col } from 'react-bootstrap';
import EventListMenuButton from '../EventListMenuButton';
import EventListMenuButton from '../Menu/EventListMenuButton';
/**
* The menu displayed above the tag list
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment