import "choerodon-ui/lib/spin/style";
import _Spin from "@hzero-front-ui/c7n-ui/lib/Spin";
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { observer } from 'mobx-react-lite';
import map from 'lodash/map';
import { useResourceStore } from "../../../stores";
import { useConfigDetailStore } from "./stores";
import Modals from "./modals";
import ResourceTitle from "../../components/resource-title";
import "./index.less";
var Content = observer(function () {
  var _useResourceStore = useResourceStore(),
      prefixCls = _useResourceStore.prefixCls,
      intlPrefix = _useResourceStore.intlPrefix;

  var _useConfigDetailStore = useConfigDetailStore(),
      detailDs = _useConfigDetailStore.detailDs;

  function getContent() {
    var record = detailDs.current;
    return record ? map(record.get('value'), function (value, key) {
      return /*#__PURE__*/React.createElement("div", {
        className: "configMap-detail-section"
      }, /*#__PURE__*/React.createElement("div", {
        className: "configMap-detail-section-title"
      }, /*#__PURE__*/React.createElement("span", null, key)), /*#__PURE__*/React.createElement("div", {
        className: "configMap-detail-section-content"
      }, /*#__PURE__*/React.createElement("pre", {
        className: "configMap-detail-section-content-pre"
      }, value)));
    }) : '暂无数据';
  }

  return /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefixCls, "-configMap-detail")
  }, /*#__PURE__*/React.createElement(ResourceTitle, {
    iconType: "compare_arrows",
    record: detailDs.current,
    statusKey: "commandStatus"
  }), /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefixCls, "-detail-content-section-title")
  }, /*#__PURE__*/React.createElement(FormattedMessage, {
    id: "".concat(intlPrefix, ".key.value")
  })), /*#__PURE__*/React.createElement(_Spin, {
    spinning: detailDs.status === 'loading'
  }, getContent()), /*#__PURE__*/React.createElement(Modals, null));
});
export default Content;