text: import New from '@apps/datasets/admin/views/types/new'
  import { Panel } from '@admin'
  import React from 'react'
  
  const mapPropsToPanel = (props, context) => ({
    title: 'Types',
    collection: {
      endpoint: `/api/admin/datasets/datasets/${props.dataset.id}/types`,
      table: [
        { label: 'ID', key: 'id', collapsing: true, visible: false },
        { label: 'Title', key: 'title', primary: true }
      ],
      empty: {
        icon: 'database',
        title: 'No Types',
        text: 'You have not yet created any types',
        buttons: [
          { label: 'Create Type', modal: <New dataset={ props.dataset } /> }
        ]
      },
      recordTasks: (record) => [
        {
          label: 'Delete Type',
          confirm: 'Are you sure you want to delete this type? It will delete all associated fields and records.',
          request: {
            endpoint: `/api/admin/datasets/datasets/${props.dataset.id}/types/${record.id}`,
            method: 'DELETE',
            onFailure: (result) => context.flash.set('error', 'Unable to delete this type')
          }
        }
      ],
      entity: 'type',
      defaultSort: { key: 'title', order: 'asc' },
      selectable: true
    },
    tasks: {
      icon: 'plus',
      items: [
        { label: 'Create Type', modal: <New dataset={ props.dataset } />  }
      ]
    }
  })
  
  export default Panel(null, mapPropsToPanel)
  