open-consul/ui-v2/app/templates/dc/intentions/index.hbs
John Cowen 96ea5b799a WIP: First draft intentions
1. Listing, filtering by action and searching by source name and
destination name
2. Edit/Create page, edits ping the API double fine, need to work through
creates and deletes
3. Currently uses a `Precedence` intention keyname that doesn't yet
exist in the real API
2018-06-25 12:25:14 -07:00

72 lines
2.8 KiB
Handlebars

{{#app-view class="intention list"}}
{{#block-slot 'header'}}
<h1>
Intentions
</h1>
{{/block-slot}}
{{#block-slot 'actions'}}
<a href="{{href-to 'dc.intentions.create'}}" class="type-create">Create</a>
{{/block-slot}}
{{#block-slot 'toolbar'}}
{{#if (gt items.length 0) }}
{{intention-filter filters=actionFilters search=filters.s type=filters.action onchange=(action 'filter')}}
{{/if}}
{{/block-slot}}
{{#block-slot 'content'}}
{{#if (gt filtered.length 0) }}
{{#tabular-collection
route='dc.intentions.edit'
key='SourceName'
items=filtered as |item index|
}}
{{#block-slot 'header'}}
<th>Source</th>
<th>&nbsp;</th>
<th>Destination</th>
<th>Precedence</th>
{{/block-slot}}
{{#block-slot 'row'}}
<td data-test-intention="{{item.ID}}">
<a href={{href-to 'dc.intentions.edit' item.ID}}>{{item.SourceName}}</a>
</td>
<td class="intent-{{item.Action}}">
<strong>{{item.Action}}</strong>
</td>
<td>
{{item.DestinationName}}
</td>
<td>
{{item.Precedence}}
</td>
{{/block-slot}}
{{#block-slot 'actions' as |index change checked|}}
{{#confirmation-dialog confirming=false index=index message='Are you sure you want to delete this intention?'}}
{{#block-slot 'action' as |confirm|}}
{{#action-group index=index onchange=(action change) checked=(if (eq checked index) 'checked')}}
<ul>
<li>
<a href={{href-to 'dc.intentions.edit' item.ID}}>Edit</a>
</li>
<li>
<a onclick={{action confirm 'delete' item}}>Delete</a>
</li>
</ul>
{{/action-group}}
{{/block-slot}}
{{#block-slot 'dialog' as |execute cancel message|}}
<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}}
{{else}}
<p>
There are no intentions.
</p>
{{/if}}
{{/block-slot}}
{{/app-view}}