import "choerodon-ui/pro/lib/table/style";
import _Table from "@hzero-front-ui/c7n-ui/lib/TablePro";
import React from 'react';
import { Permission, Action } from '@choerodon/boot';
import { useClusterContentStore } from "../stores";
var Column = _Table.Column;
export default (function () {
  var _useClusterContentSto = useClusterContentStore(),
      formatMessage = _useClusterContentSto.formatMessage,
      PermissionDs = _useClusterContentSto.PermissionDs,
      ClusterDetailDs = _useClusterContentSto.ClusterDetailDs;

  var cluster = ClusterDetailDs.current;

  function renderActions(_ref) {
    var record = _ref.record;
    var actionData = [{
      service: ['choerodon.code.project.deploy.cluster.cluster-management.ps.permission-manage'],
      text: formatMessage({
        id: 'delete'
      }),
      action: function action() {
        PermissionDs.transport.destroy.params = {
          delete_project_id: record.get('id')
        };
        var modalProps = {
          title: formatMessage({
            id: 'c7ncd.deployment.permission.delete.title'
          }),
          children: formatMessage({
            id: 'c7ncd.deployment.permission.project.delete.des'
          }),
          okText: formatMessage({
            id: 'delete'
          }),
          okProps: {
            color: 'red'
          },
          cancelProps: {
            color: 'dark'
          }
        };
        PermissionDs["delete"](record, modalProps);
      }
    }];
    return /*#__PURE__*/React.createElement(Action, {
      data: actionData
    });
  }

  return /*#__PURE__*/React.createElement(_Table, {
    dataSet: PermissionDs,
    border: false,
    pristine: true
  }, /*#__PURE__*/React.createElement(Column, {
    name: "name",
    width: 200,
    sortable: true
  }), cluster.get('skipCheckProjectPermission') ? null : /*#__PURE__*/React.createElement(Column, {
    renderer: renderActions
  }), /*#__PURE__*/React.createElement(Column, {
    name: "code"
  }));
});