consul/ui/packages/consul-ui/app/templates/dc/intentions/edit.hbs

62 lines
1.5 KiB
Handlebars

<Route
@name={{routeName}}
as |route|>
<DataLoader @src={{
uri '/${partition}/${nspace}/${dc}/intention/${id}'
(hash
partition=route.params.partition
nspace=route.params.nspace
dc=route.params.dc
id=(or route.params.intention_id '')
)
}}
as |loader|>
<BlockSlot @name="error">
<AppError
@error={{loader.error}}
@login={{route.model.app.login.open}}
/>
</BlockSlot>
<BlockSlot @name="loaded">
{{#let
loader.data
as |item|}}
<AppView>
<BlockSlot @name="breadcrumbs">
<ol>
<li><a data-test-back href={{href-to 'dc.intentions'}}>All Intentions</a></li>
</ol>
</BlockSlot>
<BlockSlot @name="header">
<h1>
{{#if (can "write intention" item=item)}}
{{#if item.ID}}
<route.Title @title="Edit Intention" />
{{else}}
<route.Title @title="New Intention" />
{{/if}}
{{else}}
<route.Title @title="View Intention" />
{{/if}}
</h1>
</BlockSlot>
<BlockSlot @name="content">
<Consul::Intention::Form
@item={{item}}
@dc={{route.params.dc}}
@nspace={{route.params.nspace}}
@partition={{route.params.partition}}
@onsubmit={{route-action 'transitionTo' 'dc.intentions.index'
(hash
dc=route.params.dc
)
}}
/>
</BlockSlot>
</AppView>
{{/let}}
</BlockSlot>
</DataLoader>
</Route>