import "choerodon-ui/pro/lib/modal/style";
import _Modal from "choerodon-ui/pro/lib/modal";
import "choerodon-ui/pro/lib/table/style";
import _Table from "@hzero-front-ui/c7n-ui/lib/TablePro";
import React, { useEffect } from 'react';
import { Action } from '@choerodon/boot';
import { observer } from 'mobx-react-lite';
import TimePopover from "../../../../../../components/timePopover";
import { useClusterContentStore } from "../stores";
import EnvForm from "./EnvForm";
import "./index.less";
var Column = _Table.Column;
var EnvManageLists = observer(function () {
  var _useClusterContentSto = useClusterContentStore(),
      intlPrefix = _useClusterContentSto.intlPrefix,
      formatMessage = _useClusterContentSto.formatMessage,
      projectId = _useClusterContentSto.projectId,
      EnvMgListDs = _useClusterContentSto.EnvMgListDs,
      EnvQuotaFormDs = _useClusterContentSto.EnvQuotaFormDs;

  var renderTime = function renderTime(_ref) {
    var text = _ref.text;
    return text && /*#__PURE__*/React.createElement(TimePopover, {
      content: text
    });
  };

  var openQuataModal = function openQuataModal() {
    _Modal.open({
      title: formatMessage({
        id: "".concat(intlPrefix, ".env.manage.resourceQuota.title")
      }),
      drawer: true,
      style: {
        width: '3.8rem'
      },
      className: 'c7ncd-cluster-envQuota-modal',
      children: /*#__PURE__*/React.createElement(EnvForm, {
        EnvQuotaFormDs: EnvQuotaFormDs,
        projectId: projectId,
        intlPrefix: intlPrefix
      }),
      okText: formatMessage({
        id: 'save'
      })
    });
  };

  var renderOpts = function renderOpts() {
    var actionData = [{
      service: [],
      text: formatMessage({
        id: "".concat(intlPrefix, ".env.manage.resourceQuota")
      }),
      action: openQuataModal
    }];
    return /*#__PURE__*/React.createElement(Action, {
      data: actionData
    });
  };

  useEffect(function () {}, []);
  return /*#__PURE__*/React.createElement(_Table, {
    dataSet: EnvMgListDs,
    border: false,
    queryBar: "none"
  }, /*#__PURE__*/React.createElement(Column, {
    name: "envDetail"
  }), /*#__PURE__*/React.createElement(Column, {
    renderer: renderOpts
  }), /*#__PURE__*/React.createElement(Column, {
    name: "projects"
  }), /*#__PURE__*/React.createElement(Column, {
    name: "cpu"
  }), /*#__PURE__*/React.createElement(Column, {
    name: "stack"
  }), /*#__PURE__*/React.createElement(Column, {
    name: "createTime",
    renderer: renderTime
  }));
});
export default EnvManageLists;