open-consul/ui/packages/consul-ui/app/components/data-form/index.hbs
Ronald 6bcb98ea71
Add UI copyright headers files (#16614)
* Add copyright headers to UI files

* Ensure copywrite file ignores external libs
2023-03-14 09:18:55 -04:00

69 lines
1.3 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: MPL-2.0
}}
<DataLoader
@items={{item}}
@src={{uri
'/${partition}/${nspace}/${dc}/${type}/${src}'
(hash
partition=partition
nspace=nspace
dc=dc
type=type
src=src
)
}}
@onchange={{action "setData"}}
@once={{true}}
>
<BlockSlot @name="loaded">
<DataWriter
@sink={{uri
'/${partition}/${nspace}/${dc}/${type}'
(hash
partition=partition
nspace=nspace
dc=(or data.Datacenter dc)
type=type
)
}}
@type={{type}}
@label={{label}}
@ondelete={{action ondelete}}
@onchange={{action onsubmit}}
as |writer|>
{{#let (hash
data=data
change=(action "change")
isCreate=create
error=writer.error
disabled=writer.inflight
submit=(action writer.persist data)
delete=(action writer.delete data)
) as |api|}}
{{yield api}}
{{#if hasError}}
<BlockSlot @name="error">
<YieldSlot @name="error">
{{yield api}}
</YieldSlot>
</BlockSlot>
{{/if}}
<BlockSlot @name="content">
<YieldSlot @name="form">
{{yield api}}
</YieldSlot>
</BlockSlot>
{{/let}}
</DataWriter>
</BlockSlot>
</DataLoader>