import React from 'react';
import { injectIntl } from 'react-intl';
import { withRouter } from 'react-router-dom';
import { TabCode } from '@choerodon/master';
import MouserOverWrapper from "../../../../components/MouseOverWrapper";
import "./index.less";
export default withRouter(injectIntl(function (_ref) {
  var record = _ref.record,
      intlPrefix = _ref.intlPrefix,
      prefixCls = _ref.prefixCls,
      formatMessage = _ref.intl.formatMessage,
      history = _ref.history,
      search = _ref.location.search;

  function linkToInstance() {
    if (record) {
      var instanceId = record.get('instanceId');
      var appServiceId = record.get('appServiceId');
      var envId = record.get('envId');
      history.push({
        pathname: '/devops/resource',
        search: "".concat(search, "&activeKey=").concat(TabCode.get('/devops/resource').tabCodes[0]),
        state: {
          instanceId: instanceId,
          appServiceId: appServiceId,
          envId: envId
        }
      });
    }

    history.push("/devops/resource".concat(search));
  }

  return /*#__PURE__*/React.createElement("ul", {
    className: "".concat(prefixCls, "-detail-manual")
  }, /*#__PURE__*/React.createElement("li", {
    className: "".concat(prefixCls, "-detail-manual-item")
  }, /*#__PURE__*/React.createElement("span", {
    className: "".concat(prefixCls, "-detail-manual-text")
  }, formatMessage({
    id: "".concat(intlPrefix, ".service")
  })), /*#__PURE__*/React.createElement("span", null, record.get('appServiceName'))), /*#__PURE__*/React.createElement("li", {
    className: "".concat(prefixCls, "-detail-manual-item ").concat(prefixCls, "-detail-manual-item-flex")
  }, /*#__PURE__*/React.createElement("span", {
    className: "".concat(prefixCls, "-detail-manual-text")
  }, formatMessage({
    id: "".concat(intlPrefix, ".version")
  })), /*#__PURE__*/React.createElement(MouserOverWrapper, {
    text: record.get('appServiceVersion'),
    width: "230px"
  }, /*#__PURE__*/React.createElement("span", null, record.get('appServiceVersion')))), /*#__PURE__*/React.createElement("li", {
    className: "".concat(prefixCls, "-detail-manual-item")
  }, /*#__PURE__*/React.createElement("span", {
    className: "".concat(prefixCls, "-detail-manual-text")
  }, formatMessage({
    id: "".concat(intlPrefix, ".env")
  })), /*#__PURE__*/React.createElement("span", null, record.get('envName'))), /*#__PURE__*/React.createElement("li", {
    className: "".concat(prefixCls, "-detail-manual-item")
  }, /*#__PURE__*/React.createElement("span", {
    className: "".concat(prefixCls, "-detail-manual-text")
  }, formatMessage({
    id: "".concat(intlPrefix, ".instance")
  })), /*#__PURE__*/React.createElement("span", {
    role: "none",
    onClick: linkToInstance,
    className: "".concat(prefixCls, "-detail-manual-instance")
  }, record.get('instanceName'))));
}));