import "choerodon-ui/lib/spin/style";
import _Spin from "@hzero-front-ui/c7n-ui/lib/Spin";
import "choerodon-ui/lib/tabs/style";
import _Tabs from "choerodon-ui/lib/tabs";
import React, { Fragment, lazy, Suspense, useMemo } from 'react';
import { observer } from 'mobx-react-lite';
import { useNodeContentStore } from "./stores";
import { useClusterMainStore } from "../../stores";
import { useClusterStore } from "../../../stores";
var TabPane = _Tabs.TabPane;
var NodeContent = /*#__PURE__*/lazy(function () {
  return import("./NodeContent");
});
var Monitor = /*#__PURE__*/lazy(function () {
  return import("./monitor");
});
export default observer(function (props) {
  var _useClusterMainStore = useClusterMainStore(),
      intlPrefix = _useClusterMainStore.intlPrefix;

  var _useNodeContentStore = useNodeContentStore(),
      formatMessage = _useNodeContentStore.formatMessage,
      _useNodeContentStore$ = _useNodeContentStore.tabs,
      RESOURCE_TAB = _useNodeContentStore$.RESOURCE_TAB,
      MONITOR_TAB = _useNodeContentStore$.MONITOR_TAB,
      contentStore = _useNodeContentStore.contentStore;

  var _useClusterStore = useClusterStore(),
      name = _useClusterStore.clusterStore.getSelectedMenu.name;

  function handleChange(key) {
    contentStore.setTabKey(key);
  }

  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("h1", null, name), /*#__PURE__*/React.createElement(_Tabs, {
    animated: false,
    activeKey: contentStore.getTabKey,
    onChange: handleChange,
    className: "c7ncd-cluster-tab-content"
  }, /*#__PURE__*/React.createElement(TabPane, {
    key: RESOURCE_TAB,
    tab: formatMessage({
      id: "".concat(intlPrefix, ".node.resource")
    })
  }, /*#__PURE__*/React.createElement(Suspense, {
    fallback: /*#__PURE__*/React.createElement(_Spin, null)
  }, /*#__PURE__*/React.createElement(NodeContent, null))), /*#__PURE__*/React.createElement(TabPane, {
    key: MONITOR_TAB,
    tab: formatMessage({
      id: "".concat(intlPrefix, ".node.monitor")
    })
  }, /*#__PURE__*/React.createElement(Suspense, {
    fallback: /*#__PURE__*/React.createElement(_Spin, null)
  }, /*#__PURE__*/React.createElement(Monitor, null)))));
});