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

91 lines
3.2 KiB
Handlebars

{{#app-view class="nspace list" loading=isLoading}}
{{#block-slot 'notification' as |status type subject|}}
{{partial 'dc/nspaces/notifications'}}
{{/block-slot}}
{{#block-slot 'header'}}
<h1>
Namespaces
</h1>
{{/block-slot}}
{{#block-slot 'actions'}}
<a data-test-create href="{{href-to 'dc.nspaces.create'}}" class="type-create">Create</a>
{{/block-slot}}
{{#block-slot 'content'}}
{{#if (gt items.length 0) }}
<form class="filter-bar">
{{freetext-filter searchable=searchable value=s placeholder="Search"}}
</form>
{{/if}}
{{#changeable-set dispatcher=searchable}}
{{#block-slot 'set' as |filtered|}}
{{#tabular-collection
items=filtered as |item index|
}}
{{#block-slot 'header'}}
<th>Name</th>
<th>Description</th>
{{#if (env 'CONSUL_ACLS_ENABLED')}}
<th>Roles &amp; Policies</th>
{{/if}}
{{/block-slot}}
{{#block-slot '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}}
{{/block-slot}}
{{#block-slot 'actions' as |index change checked|}}
{{#confirmation-dialog confirming=false index=index message="Are you sure you want to delete this Namespace?"}}
{{#block-slot 'action' as |confirm|}}
{{#action-group index=index onchange=(action change) checked=(if (eq checked index) 'checked')}}
<ul>
<li>
<a data-test-edit href={{href-to 'dc.nspaces.edit' item.Name}}>Edit</a>
</li>
{{#if (not-eq item.Name 'default')}}
<li>
<button type="button" class="type-delete" data-test-delete {{action confirm 'delete' item}}>Delete</button>
</li>
{{/if}}
</ul>
{{/action-group}}
{{/block-slot}}
{{#block-slot 'dialog' as |execute cancel message name|}}
<p>
{{message}}
</p>
<button type="button" class="type-delete" {{action execute}}>
Confirm Delete
</button>
<button type="button" class="type-cancel" {{action cancel}}>Cancel</button>
{{/block-slot}}
{{/confirmation-dialog}}
{{/block-slot}}
{{/tabular-collection}}
{{/block-slot}}
{{#block-slot 'empty'}}
<p>
There are no Namespaces.
</p>
{{/block-slot}}
{{/changeable-set}}
{{/block-slot}}
{{/app-view}}