import "choerodon-ui/lib/button/style";
import _Button from "choerodon-ui/lib/button";
import React from 'react';
import { withRouter } from 'react-router-dom';
import { observer } from 'mobx-react-lite';
import { FormattedMessage } from 'react-intl';
import "./NoChart.less";
var NoChart = observer(function (props) {
  var type = props.type,
      history = props.history,
      search = props.location.search,
      getProRole = props.getProRole;

  var handleClick = function handleClick() {
    switch (type) {
      case 'env':
        history.push({
          pathname: '/devops/environment',
          search: search
        });
        break;

      case 'app':
        history.push({
          pathname: '/devops/app-service',
          search: search
        });
        break;

      case 'pipeline':
        history.push({
          pathname: '/devops/pipeline-manage',
          search: search
        });

      default:
        break;
    }
  };

  var noChart = {
    owner: {
      title: "empty.title.".concat(type),
      des: "empty.tips.".concat(type, ".owner")
    },
    member: {
      title: 'empty.title.prohibited',
      des: "empty.tips.".concat(type, ".member")
    },
    '': {
      title: 'null',
      des: 'null'
    }
  };
  return /*#__PURE__*/React.createElement("div", {
    className: "c7n-no-chart"
  }, /*#__PURE__*/React.createElement("div", {
    className: "c7n-no-chart-pic"
  }, /*#__PURE__*/React.createElement("div", {
    className: "c7n-no-chart-pic-".concat(getProRole)
  })), /*#__PURE__*/React.createElement("div", {
    className: "c7n-no-chart-desc"
  }, /*#__PURE__*/React.createElement("div", {
    className: "c7n-no-chart-title"
  }, getProRole === '' ? '' : /*#__PURE__*/React.createElement(FormattedMessage, {
    id: noChart[getProRole].title
  })), /*#__PURE__*/React.createElement("div", {
    className: "c7n-no-chart-des"
  }, getProRole === '' ? '' : /*#__PURE__*/React.createElement(FormattedMessage, {
    id: noChart[getProRole].des
  })), getProRole === 'owner' && /*#__PURE__*/React.createElement(_Button, {
    type: "primary",
    funcType: "raised",
    onClick: handleClick
  }, /*#__PURE__*/React.createElement(FormattedMessage, {
    id: "empty.link.".concat(type)
  }))));
});
export default withRouter(NoChart);