{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: BUSL-1.1
~}}

<section class="section">
  <header class="acl-explainer">
    <p>
      Namespaces allow jobs and associated objects to be segmented from each other and other users of the cluster.
    </p>
    <div>
      {{#if (can "write namespace")}}
        <Hds::Button
          @text="Create Namespace"
          @icon="plus"
          @route="administration.namespaces.new"
          {{keyboard-shortcut
            pattern=(array "n" "n")
            action=(action this.goToNewNamespace)
            label="Create Namespace"
          }}
          data-test-create-namespace
        />
      {{else}}
        <Hds::Button
          @text="Create Namespace"
          @icon="plus"
          disabled
          data-test-disabled-create-namespace
        />
      {{/if}}
    </div>
  </header>

<Hds::Table @caption="A list of namespaces for this cluster" class="acl-table"
    @model={{this.model.namespaces}}
    @columns={{this.columns}}
    @sortBy="name"
>
    <:body as |B|>
    <B.Tr
        {{keyboard-shortcut
        enumerated=true
        action=(action "openNamespace" B.data)
        }}
        data-test-namespace-row
    >
        <B.Td>
          <LinkTo data-test-namespace-name={{B.data.name}} @route="administration.namespaces.acl-namespace" @model={{B.data.name}}>{{B.data.name}}</LinkTo>
        </B.Td>
        <B.Td>{{B.data.description}}</B.Td>
    </B.Tr>
    </:body>
</Hds::Table>
</section>
