2019-01-03 17:14:25 +03:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2019-01-10 20:23:33 +03:00
|
|
|
import { Button, Toolbar, Divider } from 'devui';
|
2020-08-09 04:18:45 +03:00
|
|
|
import { MdSave } from 'react-icons/md';
|
2019-01-03 17:14:25 +03:00
|
|
|
import ExportButton from './buttons/ExportButton';
|
|
|
|
import ImportButton from './buttons/ImportButton';
|
|
|
|
import PrintButton from './buttons/PrintButton';
|
|
|
|
import DispatcherButton from './buttons/DispatcherButton';
|
|
|
|
import SliderButton from './buttons/SliderButton';
|
|
|
|
import MonitorSelector from './MonitorSelector';
|
2020-10-26 02:32:04 +03:00
|
|
|
import { Options } from '../reducers/instances';
|
2019-01-03 17:14:25 +03:00
|
|
|
|
2020-10-26 02:32:04 +03:00
|
|
|
interface Props {
|
|
|
|
dispatcherIsOpen: boolean;
|
|
|
|
sliderIsOpen: boolean;
|
|
|
|
options: Options;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default class BottomButtons extends Component<Props> {
|
2019-01-03 17:14:25 +03:00
|
|
|
static propTypes = {
|
|
|
|
dispatcherIsOpen: PropTypes.bool,
|
|
|
|
sliderIsOpen: PropTypes.bool,
|
2020-08-08 23:26:39 +03:00
|
|
|
options: PropTypes.object.isRequired,
|
2019-01-03 17:14:25 +03:00
|
|
|
};
|
|
|
|
|
2020-10-26 02:32:04 +03:00
|
|
|
shouldComponentUpdate(nextProps: Props) {
|
2019-01-10 21:51:14 +03:00
|
|
|
return (
|
|
|
|
nextProps.dispatcherIsOpen !== this.props.dispatcherIsOpen ||
|
|
|
|
nextProps.sliderIsOpen !== this.props.sliderIsOpen ||
|
|
|
|
nextProps.options !== this.props.options
|
|
|
|
);
|
2019-01-03 17:14:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const features = this.props.options.features;
|
|
|
|
return (
|
|
|
|
<Toolbar borderPosition="top">
|
2019-01-10 21:51:14 +03:00
|
|
|
{features.export && (
|
|
|
|
<Button title="Save a report" tooltipPosition="top-right">
|
2020-08-09 04:18:45 +03:00
|
|
|
<MdSave />
|
2019-01-10 21:51:14 +03:00
|
|
|
</Button>
|
|
|
|
)}
|
|
|
|
{features.export && <ExportButton />}
|
|
|
|
{features.import && <ImportButton />}
|
2019-01-03 17:14:25 +03:00
|
|
|
<PrintButton />
|
|
|
|
<Divider />
|
|
|
|
<MonitorSelector />
|
|
|
|
<Divider />
|
2019-01-10 21:51:14 +03:00
|
|
|
{features.jump && <SliderButton isOpen={this.props.sliderIsOpen} />}
|
|
|
|
{features.dispatch && (
|
|
|
|
<DispatcherButton dispatcherIsOpen={this.props.dispatcherIsOpen} />
|
|
|
|
)}
|
2019-01-03 17:14:25 +03:00
|
|
|
</Toolbar>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|