{# Define the columns #}
{% set columns = [
  {'name':'name', 'data':'name', 'title':_('Name'), 'className':'text-nowrap all export'},
  {'name':'usage', 'data':'usage', 'title':_('Usage'), 'className':'export', 'render':'choices', 'render_arg': {'user': _('user'), 'group': _('group')} },
  {'name':'permission', 'data':'permission', 'title':_('Permission'), 'className':'export','render':'choices', 'render_arg': {'read': _('read'), 'write': _('write')} },
  {'name':'protocol', 'data':'protocol', 'title':_('Protocol'), 'className':'export nerd-column',},
  {'name':'owners', 'data':'owners', 'title':_('Owner'), 'className':'export', 'render': 'sspOwners', 'render_arg': currentuser.ROLE_ADMIN != currentuser.role},
  {'name': 'mountpath_linux', 'data':'mountpath_linux', 'title': _('Linux and macOS'), 'className': 'none export', 'render': 'sspCopyButton'},
  {'name': 'mountpath_linux_managed', 'data':'mountpath_linux_managed', 'title': _('Managed Linux'), 'className': 'none export', 'render': 'sspCopyButton'},
  {'name': 'mountpath_win_managed', 'data':'mountpath_win_managed', 'title': _('Managed Windows'), 'className': 'none export', 'render': 'sspCopyButton'},
  {'name': 'mountpath_win', 'data':'mountpath_win', 'title': _('Unmanaged Windows'), 'className': 'none export', 'render': 'sspCopyButton'},
  {'name': 'action', 'data':'group', 'title':'', 'orderable':False, 'className': 'all', 'render':'sspManageStorageButton'},
] %}
{# Define a custom button to create new storage. #}
{% if user.username == username %}
  {% set buttons = [
      {'text': _('Create storage'), 'extend': 'sspShowModal', 'target':'#modal-create-storage', 'className': 'ssp-show-modal btn-primary'},
      {'text': _('Request access'), 'extend': 'sspShowModal', 'target':'#modal-request-storage-access', 'className': 'ssp-show-modal btn-primary'}
    ] %}
{% else %}
  {% set buttons = [] %}
{% endif %}
<DatatableCard id="storage-table" data={{ url_for('dashboard', 'storage.json', u=user.username) }} columns={{ columns }} buttons={{ buttons }} empty_message={{ _("No storage resources.") }} icon="bi-hdd-stack" label={{ _("Storage") }} />
{% if user.username == username %}
  <ModalCreateStorage form={{ create_storage_form }} />
  <ModalRequestStorageAccess form={{ request_storage_access_form }} />
  <ModalRequestStorageAccessChange form={{ request_storage_access_change_form }} />
{% endif %}
