import React, { Component } from 'react';
import {
  Button,
} from "antd";
import {
  WeaLocaleProvider,
} from "ecCom";

const {getLabel} = WeaLocaleProvider;

// 做到最后，又把这个需求去掉了...Y_Y

class PopoverButton extends Component {

  handleClick = () => {
    if(this.props.onClick && typeof(this.props.onClick) === "function") {
      this.props.onClick();
    }
  }

  render() {
    let {
      description,
      content,
      type="",
      disabled=false,
      menuType="0",  // 1代表右键
    } = this.props;
    if(description === undefined) {
      description = <div>
        1. {getLabel('518932','该操作会同步配置')}；<br/>
        2. {getLabel('518933','同步配置前请在 [升级中心 -> 升级 -> 节点设置] 中配置好节点信息')}；<br/>
        3. {getLabel('518934','同步后各节点会自动重启服务，请同步配置后检查各节点服务是否正常')}。
      </div>
    }
    if(content === undefined) {
      content = getLabel('514733','部署');
    }
    return (menuType == "1"
      ? <span className="inte-tool">
          {content}
          {/* <WeaHelpfulTip style={{marginLeft: 10}} placement="bottom" title={description} /> */}
        </span>
      : <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@IntegrationPluginPopoverButton`} disabled={disabled} type={type} onClick={this.handleClick}>{content}</Button>
      // : <Tooltip className="inte-tools" autoAdjustOverflow placement={placement || "bottomLeft"} title={description}>
      //     <Button disabled={disabled} type={type} onClick={this.handleClick}>{content}</Button>
      //   </Tooltip>
    );
  }
}

export default PopoverButton;