mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 05:45:46 +00:00
5fb9df1640
* Adding explicit MPL license for sub-package This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Adding explicit MPL license for sub-package This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Updating the license from MPL to Business Source License Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at <Blog URL>, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl. * add missing license headers * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
108 lines
2.6 KiB
Handlebars
108 lines
2.6 KiB
Handlebars
{{!
|
|
Copyright (c) HashiCorp, Inc.
|
|
SPDX-License-Identifier: BUSL-1.1
|
|
}}
|
|
|
|
<StateChart @src={{chart}} as |State Guard Action dispatch state|>
|
|
|
|
<Ref @target={{this}} @name="dispatch" @value={{dispatch}} />
|
|
|
|
{{#let (hash
|
|
data=data
|
|
error=error
|
|
persist=(action "persist")
|
|
delete=(queue (action (mut data)) (action dispatch "REMOVE"))
|
|
inflight=(state-matches state (array "persisting" "removing"))
|
|
disabled=(state-matches state (array "persisting" "removing"))
|
|
) as |api|}}
|
|
|
|
{{yield api}}
|
|
|
|
<State @matches="removing">
|
|
<DataSink
|
|
@sink={{sink}}
|
|
@item={{data}}
|
|
@data={{null}}
|
|
@onchange={{action dispatch "SUCCESS"}}
|
|
@onerror={{action "error"}}
|
|
/>
|
|
</State>
|
|
|
|
<State @matches="persisting">
|
|
<DataSink
|
|
@sink={{sink}}
|
|
@item={{data}}
|
|
@onchange={{action dispatch "SUCCESS"}}
|
|
@onerror={{action "error"}}
|
|
/>
|
|
</State>
|
|
|
|
<State @matches="removed">
|
|
{{#let
|
|
(queue (action dispatch "RESET") (action ondelete))
|
|
as |after|}}
|
|
{{#yield-slot name="removed" params=(block-params after)}}
|
|
{{yield api}}
|
|
{{else}}
|
|
<Hds::Toast
|
|
@color='success'
|
|
{{notification
|
|
after=(action after)
|
|
}} as |T|>
|
|
<T.Title>Success!</T.Title>
|
|
<T.Description>Your {{or label type}} has been deleted.</T.Description>
|
|
</Hds::Toast>
|
|
{{/yield-slot}}
|
|
{{/let}}
|
|
</State>
|
|
|
|
<State @matches="persisted">
|
|
{{#let
|
|
(action onchange)
|
|
as |after|}}
|
|
{{#yield-slot name="persisted" params=(block-params after)}}
|
|
{{yield api}}
|
|
{{else}}
|
|
<Hds::Toast
|
|
@color='success'
|
|
{{notification
|
|
after=(action after)
|
|
}} as |T|>
|
|
<T.Title>Success!</T.Title>
|
|
<T.Description>Your {{or label type}} has been saved.</T.Description>
|
|
</Hds::Toast>
|
|
{{/yield-slot}}
|
|
{{/let}}
|
|
</State>
|
|
|
|
<State @matches="error">
|
|
{{#let
|
|
(action dispatch "RESET")
|
|
as |after|}}
|
|
{{#yield-slot name="error" params=(block-params after api.error)}}
|
|
{{yield api}}
|
|
{{else}}
|
|
<Hds::Toast
|
|
@color='critical'
|
|
{{notification
|
|
after=(action after)
|
|
}} as |T|>
|
|
<T.Title>Error!</T.Title>
|
|
<T.Description>There was an error saving your {{or label type}}.
|
|
{{#if (and api.error.status api.error.detail)}}
|
|
<br />{{api.error.status}}: {{api.error.detail}}
|
|
{{else if api.error.message}}
|
|
<br />{{api.error.message}}
|
|
{{/if}}
|
|
</T.Description>
|
|
</Hds::Toast>
|
|
{{/yield-slot}}
|
|
{{/let}}
|
|
</State>
|
|
|
|
<YieldSlot @name="content">
|
|
{{yield api}}
|
|
</YieldSlot>
|
|
|
|
{{/let}}
|
|
</StateChart> |