open-consul/ui-v2/app/templates/dc/nspaces/index.hbs

100 lines
3.7 KiB
Handlebars

{{title 'Namespaces'}}
<AppView @class="nspace list" @loading={{isLoading}}>
<BlockSlot @name="notification" as |status type subject|>
{{partial 'dc/nspaces/notifications'}}
</BlockSlot>
<BlockSlot @name="header">
<h1>
Namespaces
</h1>
</BlockSlot>
<BlockSlot @name="actions">
<a data-test-create href="{{href-to 'dc.nspaces.create'}}" class="type-create">Create</a>
</BlockSlot>
<BlockSlot @name="content">
{{#if (gt items.length 0) }}
<form class="filter-bar">
<FreetextFilter @searchable={{searchable}} @value={{s}} @placeholder="Search" />
</form>
{{/if}}
<ChangeableSet @dispatcher={{searchable}}>
<BlockSlot @name="set" as |filtered|>
<TabularCollection @items={{filtered}} as |item index|>
<BlockSlot @name="header">
<th>Name</th>
<th>Description</th>
{{#if (env 'CONSUL_ACLS_ENABLED')}}
<th>Roles &amp; Policies</th>
{{/if}}
</BlockSlot>
<BlockSlot @name="row">
{{#if item.DeletedAt}}
<td class="no-actions" colspan="3">
<p>
Deleting {{item.Name}}...
</p>
</td>
{{else}}
<td data-test-namespace={{item.Name}}>
<a href={{href-to 'dc.nspaces.edit' item.Name}}>{{item.Name}}</a>
</td>
<td data-test-description>
<p>{{item.Description}}</p>
</td>
{{#if (env 'CONSUL_ACLS_ENABLED')}}
<td>
{{#each (compact (append item.ACLs.PolicyDefaults item.ACLs.RoleDefaults)) as |item|}}
<strong data-test-policy class={{policy/typeof item}}>{{item.Name}}</strong>
{{/each}}
</td>
{{/if}}
{{/if}}
</BlockSlot>
<BlockSlot @name="actions" as |index change checked|>
<PopoverMenu @expanded={{if (eq checked index) true false}} @onchange={{action change index}} @keyboardAccess={{false}}>
<BlockSlot @name="trigger">
More
</BlockSlot>
<BlockSlot @name="menu" as |confirm send keypressClick|>
<li role="none">
<a data-test-edit role="menuitem" tabindex="-1" href={{href-to 'dc.nspaces.edit' item.Name}}>Edit</a>
</li>
{{#if (not-eq item.Name 'default') }}
<li role="none" class="dangerous">
<label for={{confirm}} role="menuitem" tabindex="-1" onkeypress={{keypressClick}} data-test-delete>Delete</label>
<div role="menu">
<div class="confirmation-alert warning">
<div>
<header>
Confirm Delete
</header>
<p>
Are you sure you want to delete this key?
</p>
</div>
<ul>
<li class="dangerous">
<button tabindex="-1" type="button" class="type-delete" onclick={{action send 'delete' item}}>Delete</button>
</li>
<li>
<label for={{confirm}}>Cancel</label>
</li>
</ul>
</div>
</div>
</li>
{{/if}}
</BlockSlot>
</PopoverMenu>
</BlockSlot>
</TabularCollection>
</BlockSlot>
<BlockSlot @name="empty">
<p>
There are no Namespaces.
</p>
</BlockSlot>
</ChangeableSet>
</BlockSlot>
</AppView>