mirror of
https://github.com/status-im/consul.git
synced 2025-02-28 13:20:44 +00:00
* 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>
159 lines
3.8 KiB
Handlebars
159 lines
3.8 KiB
Handlebars
{{!
|
|
Copyright (c) HashiCorp, Inc.
|
|
SPDX-License-Identifier: BUSL-1.1
|
|
}}
|
|
|
|
<Route
|
|
@name={{routeName}}
|
|
as |route|>
|
|
|
|
{{#let
|
|
'/'
|
|
as |separator|}}
|
|
|
|
{{#let
|
|
(concat (join separator (slice 0 -1 (split route.params.key separator))) separator)
|
|
as |parentKey|}}
|
|
|
|
<DataLoader
|
|
@src={{uri '/${partition}/${nspace}/${dc}/kv/${key}'
|
|
(hash
|
|
partition=route.params.partition
|
|
nspace=route.params.nspace
|
|
dc=route.params.dc
|
|
key=(if (string-ends-with routeName 'create') '' route.params.key)
|
|
)
|
|
}}
|
|
as |loader|>
|
|
|
|
<BlockSlot @name="error">
|
|
<AppError
|
|
@error={{loader.error}}
|
|
@login={{route.model.app.login.open}}
|
|
/>
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="loaded">
|
|
{{#let
|
|
|
|
route.params.dc
|
|
route.params.partition
|
|
route.params.nspace
|
|
loader.data
|
|
|
|
as |dc partition nspace item|}}
|
|
|
|
<AppView>
|
|
|
|
<BlockSlot @name="breadcrumbs">
|
|
<ol>
|
|
<li>
|
|
<Action
|
|
data-test-back
|
|
@href={{href-to 'dc.kv.index'}}
|
|
>
|
|
Key / Values
|
|
</Action>
|
|
</li>
|
|
{{#if (not-eq parentKey separator)}}
|
|
|
|
{{#let
|
|
(split parentKey separator)
|
|
as |parts|}}
|
|
|
|
{{#each parts as |breadcrumb index|}}
|
|
{{#if (gt breadcrumb.length 0)}}
|
|
{{! if breadcrumb isn't '' then slice of enough of the parentKey }}
|
|
{{! to make the correct href. 'Enough' is the current index plus 1.}}
|
|
{{! We push on a '' here so make sure we get a trailing slash/separator }}
|
|
<li>
|
|
<Action
|
|
{{action breadcrumb}}
|
|
@href={{href-to 'dc.kv.folder'
|
|
(join '/'
|
|
(append
|
|
(slice 0 (add index 1) parts) ''
|
|
)
|
|
)
|
|
}}
|
|
>
|
|
{{breadcrumb}}
|
|
</Action>
|
|
</li>
|
|
{{/if}}
|
|
{{/each}}
|
|
{{/let}}
|
|
|
|
{{/if}}
|
|
</ol>
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="header">
|
|
<h1 data-test-kv-key={{item.Key}}>
|
|
{{#if (and item.Key (not-eq item.Key parentKey))}}
|
|
<route.Title @title="Edit Key / Value" @render={{false}} />
|
|
{{left-trim item.Key parentKey}}
|
|
{{else}}
|
|
<route.Title @title="New Key / Value" @render={{true}} />
|
|
{{/if}}
|
|
</h1>
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="content">
|
|
|
|
{{! if a KV has a session `Session` will always be populated despite any specific session permissions }}
|
|
{{#if item.Session}}
|
|
<Consul::LockSession::Notifications @type="kv" />
|
|
{{/if}}
|
|
|
|
<Consul::Kv::Form
|
|
@item={{item}}
|
|
@dc={{route.params.dc}}
|
|
@nspace={{route.params.nspace}}
|
|
@partition={{route.params.partition}}
|
|
@onsubmit={{if (eq parentKey separator) (transition-to 'dc.kv.index') (transition-to 'dc.kv.folder' parentKey)}}
|
|
@parent={{parentKey}}
|
|
/>
|
|
|
|
|
|
{{! `session` is slightly different to `item.Session` as we only have `session` }}
|
|
{{! if you have `session:read perms` whereas you can get the sessions ID from }}
|
|
{{! `item.Session` without any session perms }}
|
|
{{#if (and item.Session)}}
|
|
<DataSource
|
|
@src={{uri '/${partition}/${nspace}/${dc}/sessions/for-key/${id}'
|
|
(hash
|
|
partition=route.params.partition
|
|
nspace=route.params.nspace
|
|
dc=route.params.dc
|
|
id=item.Session
|
|
)
|
|
}}
|
|
@onchange={{action (mut session) value="data"}}
|
|
/>
|
|
<h2>
|
|
<Action
|
|
rel="help"
|
|
@href={{concat (env 'CONSUL_DOCS_URL') '/internals/sessions.html#session-design'}}
|
|
@external={{true}}
|
|
>
|
|
Lock Session
|
|
</Action>
|
|
</h2>
|
|
{{#if session.ID}}
|
|
<Consul::LockSession::Form
|
|
@item={{session}}
|
|
@ondelete={{loader.invalidate}}
|
|
/>
|
|
{{/if}}
|
|
{{/if}}
|
|
|
|
</BlockSlot>
|
|
</AppView>
|
|
{{/let}}
|
|
</BlockSlot>
|
|
</DataLoader>
|
|
{{/let}}
|
|
{{/let}}
|
|
</Route>
|