{# Define the columns #}
{% set columns = [
  {'name':'project', 'data':'project.name', 'title':_('Project'), 'className': 'never export'},
  {'name':'name', 'data':'name', 'title':_('Name'), 'className':'text-nowrap all export'},
  {'name':'role', 'data':'project.role_name', 'title':_('Permission'), 'className': 'export', 'priority':2},
  {'name':'quota', 'data':'cpu', 'title':_('CPU, Memory & Storage Quota'), 'render': 'sspQuota',  'priority':1},
  {'name':'cpu', 'data':'cpu', 'title':_('CPU'), 'className':'export never', 'render': 'number', 'render_args':['', '', 0, '', _(' cores')]},
  {'name':'ram', 'data':'ram', 'title':_('Memory'), 'className':'export never', 'render': 'number', 'render_args':['', '', 0, '', _(' GiB')]},
  {'name':'disk', 'data':'disk', 'title':_('Storage'), 'className':'export never', 'render': 'number', 'render_args':['', '', 0, '', _(' GiB')]},
] %}
{# Define a custom button to enable openstack #}
{% if user.username == username %}
  {% set buttons = [
      {'text': _('Request more resource'), 'extend': 'sspShowModal', 'target':'#modal-enable-openstack', 'className': 'ssp-show-modal btn-primary', 'enabled':openstack_enabled},
      {'text': _('Enable OpenStack access'), 'extend': 'sspShowModal', 'target':'#modal-enable-openstack', 'className': 'ssp-show-modal btn-primary', 'enabled':openstack_enabled},
    ] %}
{% else %}
  {% set buttons = [] %}
{% endif %}
{# Template for the group is declare in a strange way because we need to use "{{" "}}" #}
<DatatableCard id="cloud-table" data={{ url_for('dashboard', 'cloud.json', u=user.username) }} columns={{ columns }} buttons={{ buttons }} empty_message={{ _("No cloud resources.") }} icon="bi-cloud" label={{ _("Cloud") }} rowgroup={{ {"dataSrc":"project.id", "startRender": "sspProject" } }} enabled={{ openstack_enabled }} />
{# Modal dialog - Request access to OpenStack #}
{% if user.username == username and openstack_enabled %}
  <form method="post" action="{{ url_for('dashboard', 'enable-openstack') }}">
    <Modal id="modal-enable-openstack" title={{ _("Enable Access to OpenStack") }} submit={{ _("Enable OpenStack") }}>
    <p>
      {% trans %}Please fill out the form below to request your OpenStack access. Your account will be created automatically. FIXME{% endtrans %}
    </p>
    <Fields form={{ enable_openstack_form }} />
    <p>
      {% trans %}Once submitted, your OpenStack account will be provisioned automatically. You will receive an email with login details within a few minutes. FIXME.{% endtrans %}
    </p>
    </Modal>
  </form>
{% endif %}
