<commit_before><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') parentKey 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>
            <a data-test-back href={{href-to 'dc.kv.index'}}>Key / Values</a>
          </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>
            <a
              href={{href-to 'dc.kv.folder'
                  (join '/'
                    (append
                      (slice 0 (add index 1) parts) ''
                    )
                  )
              }}
            >
              {{breadcrumb}}
            </a>
          </li>
      {{/if}}
    {{/each}}
{{/let}}

{{/if}}
      </ol>
    </BlockSlot>
    <BlockSlot @name="header">
        <h1>
  {{#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}}
      <Notice
        @type="warning"
        data-test-session-warning
      as |notice|>
        <notice.Body>
          <p>
            <strong>Warning.</strong> This KV has a lock session. You can edit KV's with lock sessions, but we recommend doing so with care, or not doing so at all. It may negatively impact the active node it's associated with. See below for more details on the Lock Session and see <a href="{{env 'CONSUL_DOCS_URL'}}/internals/sessions.html" target="_blank" rel="noopener noreferrer">our documentation</a> for more information.
          </p>
        </notice.Body>
      </Notice>
{{/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}}
{{#if (and item.Session (can "read sessions"))}}
      <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"}}
      />
  {{#if session}}
      {{!FIXME}}
      <Consul::LockSession::Form
        @item={{session}}
        @dc={{route.params.dc}}
        @nspace={{route.params.nspace}}
        @partition={{route.params.partition}}
        @onsubmit={{action (noop) undefined}}
      />
  {{/if}}

{{/if}}<commit_msg>ui: Don't check global session permissions for a single session (#11657)<commit_after><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') parentKey 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>
            <a data-test-back href={{href-to 'dc.kv.index'}}>Key / Values</a>
          </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>
            <a
              href={{href-to 'dc.kv.folder'
                  (join '/'
                    (append
                      (slice 0 (add index 1) parts) ''
                    )
                  )
              }}
            >
              {{breadcrumb}}
            </a>
          </li>
      {{/if}}
    {{/each}}
{{/let}}

{{/if}}
      </ol>
    </BlockSlot>
    <BlockSlot @name="header">
        <h1>
  {{#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}}
      <Notice
        @type="warning"
        data-test-session-warning
      as |notice|>
        <notice.Body>
          <p>
            <strong>Warning.</strong> This KV has a lock session. You can edit KV's with lock sessions, but we recommend doing so with care, or not doing so at all. It may negatively impact the active node it's associated with. See below for more details on the Lock Session and see <a href="{{env 'CONSUL_DOCS_URL'}}/internals/sessions.html" target="_blank" rel="noopener noreferrer">our documentation</a> for more information.
          </p>
        </notice.Body>
      </Notice>
{{/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"}}
      />
  {{#if session}}
      {{!FIXME}}
      <Consul::LockSession::Form
        @item={{session}}
        @dc={{route.params.dc}}
        @nspace={{route.params.nspace}}
        @partition={{route.params.partition}}
        @onsubmit={{action (noop) undefined}}
      />
  {{/if}}

{{/if}}
{'fraction_non_alphanumeric': 0.16307541625857003, 'fraction_numerical': 0.002571008814887365, 'mean_word_length': 2.1455525606469004, 'pattern_counts': {'":': 0, '<': 81, '<?xml version=': 0, '>': 81, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2396988', 'n_tokens_mistral': 2564, 'n_tokens_neox': 2526, 'n_words': 651}