import React, { Component } from 'react';
import PropTypes from 'prop-types';

/**
 *
 *
 * @class CellOperatePanel
 * @extends {Component}
 */
class CellOperatePanel extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  cloneTemplate = () => {
    this.props.updateMainView({ flag: '2', device: this.props.device, resourceFlag: '1' });
  };

  viewTemplate = () => {
    this.props.updateMainView({ flag: '3', device: this.props.device });
  };

  render() {
    return (
      <div className="cell-operate-root">
        <div className="cell-operate-clone" onClick={this.cloneTemplate}>
          添加
        </div>
        <div className="cell-operate-view" onClick={this.viewTemplate}>
          查看
        </div>
      </div>
    );
  }
}

CellOperatePanel.propTypes = {
  updateMainView: PropTypes.func,
  device: PropTypes.object
};

export default CellOperatePanel;
