{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: MPL-2.0
~}}

<Trigger @onError={{action this.onError}} @do={{this.fetchJobDefinition}} as |trigger|>
  {{did-insert trigger.fns.do}}

  <div class="update-parameters">
    <h4 class="title is-4">Update Params</h4>
    <code>

      {{#if (and trigger.data.isSuccess (not trigger.data.isError))}}
        <ul>
          {{#each this.updateParamGroups as |group|}}
            <li>
              <span class="group">Group "{{group.name}}"</span>
              <ul>
                {{#each-in group.update as |k v|}}
                  <li>
                    <span class="key">{{k}}</span>
                    <span class="value">{{v}}</span>
                  </li>
                {{/each-in}}
              </ul>
            </li>
          {{/each}}
        </ul>
      {{/if}}

      {{#if trigger.data.isBusy}}
        <span class="notification">Loading Parameters</span>
      {{/if}}

      {{#if trigger.data.isError}}
        <span class="notification">Error loading parameters</span>
      {{/if}}

    </code>
  </div>
</Trigger>
