import getTablePostData from "../../../../../../utils/getTablePostData";
export default (function (_ref) {
  var formatMessage = _ref.formatMessage,
      projectId = _ref.projectId,
      id = _ref.id,
      skipCheckProjectPermission = _ref.skipCheckProjectPermission;
  return {
    selection: false,
    pageSize: 10,
    transport: {
      read: function read(_ref2) {
        var data = _ref2.data;
        var postData = getTablePostData(data);
        var URL = '';

        if (skipCheckProjectPermission) {
          URL = "/devops/v1/projects/".concat(projectId, "/page_projects");
        } else {
          URL = "/devops/v1/projects/".concat(projectId, "/clusters/").concat(id, "/permission/page_related");
        }

        return {
          url: URL,
          method: 'post',
          data: postData
        };
      },
      destroy: {
        url: "/devops/v1/projects/".concat(projectId, "/clusters/clusterId/permission"),
        method: 'delete'
      }
    },
    fields: [{
      name: 'name',
      type: 'string',
      label: formatMessage({
        id: 'cluster.project.name'
      })
    }, {
      name: 'code',
      type: 'string',
      label: formatMessage({
        id: 'cluster.project.code'
      })
    }, {
      name: 'projectId',
      label: formatMessage({
        id: 'c7ncd.cluster.project'
      }),
      valueField: 'id',
      textField: 'name'
    }],
    queryFields: [{
      name: 'name',
      type: 'string',
      label: formatMessage({
        id: 'cluster.project.name'
      })
    }, {
      name: 'code',
      type: 'string',
      label: formatMessage({
        id: 'cluster.project.code'
      })
    }]
  };
});