<section class="header clearfix">
  <div class="right-buttons">
    <button disabled={{rbac-prevents resource="catalog" scope="global" permission="create"}} class="btn bg-primary btn-sm" {{action "add"}}>
      {{t 'catalogSettings.more.addActionLabel'}}
    </button>
  </div>

  <h1>{{t 'catalogSettings.header'}}</h1>
</section>

<div class="row row-same-height">
  <div class="col span-4">
    <h2>{{t 'catalogSettings.library.label'}}</h2>
    <div>
      {{#if library}}
        <div class="btn-group no-inline-space">
          <button class="btn btn-link btn-sm bg-default" {{action "disableLibrary"}} disabled={{togglingLibrary}}>{{#if togglingLibrary}}<i class="icon icon-spinner icon-spin"></i> {{/if}}{{t 'generic.disable'}}</button>
          <button class="btn btn-link btn-sm bg-success">{{t "generic.enabled"}}</button>
        </div>
      {{else}}
        <div class="btn-group no-inline-space">
          <button class="btn btn-link btn-sm bg-primary">{{t 'generic.disabled'}}</button>
          <button class="btn btn-link btn-sm bg-defualt" {{action "enableLibrary"}} disabled={{togglingLibrary}}>{{#if togglingLibrary}}<i class="icon icon-spinner icon-spin"></i> {{/if}}{{t 'generic.enable'}}</button>
        </div>
      {{/if}}
      {{#if customLibrary}}
        {{#banner-message color='bg-warning'}}
          {{t 'catalogSettings.errors.nameInExists' key='library' }}
        {{/banner-message}}
      {{/if}}
    </div>
    <p class="text-info">
      {{t 'catalogSettings.library.detail' appName=settings.appName}}
    </p>
    {{#if library.showTransitioningMessage}}
      <div class="{{library.stateColor}}"><p>{{uc-first library.transitioningMessage}}</p></div>
    {{/if}}
  </div>

  <div class="col span-4">
    <h2>{{t 'catalogSettings.helm.stable.label'}}</h2>
    <div>
      {{#if helmStable}}
        <div class="btn-group no-inline-space">
          <button class="btn btn-link btn-sm bg-default" {{action "disableHelmStable"}} disabled={{togglingHelmStable}}>{{#if togglingHelmStable}}<i class="icon icon-spinner icon-spin"></i> {{/if}}{{t 'generic.disable'}}</button>
          <button class="btn btn-link btn-sm bg-success">{{t "generic.enabled"}}</button>
        </div>
      {{else}}
        <div class="btn-group no-inline-space">
          <button class="btn btn-link btn-sm bg-primary">{{t 'generic.disabled'}}</button>
          <button class="btn btn-link btn-sm bg-defualt" {{action "enableHelmStable"}} disabled={{togglingHelmStable}}>{{#if togglingHelmStable}}<i class="icon icon-spinner icon-spin"></i> {{/if}}{{t 'generic.enable'}}</button>
        </div>
      {{/if}}
      {{#if customHelmStable}}
        {{#banner-message color='bg-warning'}}
          {{t 'catalogSettings.errors.nameInExists' key='helm' }}
        {{/banner-message}}
      {{/if}}
    </div>
    <p class="text-info">
      {{t 'catalogSettings.helm.stable.detail'}}
    </p>
    {{#if helmStable.showTransitioningMessage}}
      <div class="{{helmStable.stateColor}}"><p>{{uc-first helmStable.transitioningMessage}}</p></div>
    {{/if}}
  </div>

  <div class="col span-4">
    <h2>{{t 'catalogSettings.helm.incubator.label'}}</h2>
    <div>
      {{#if helmIncubator}}
        <div class="btn-group no-inline-space">
          <button class="btn btn-link btn-sm bg-default" {{action "disableHelmIncubator"}} disabled={{togglingHelmIncubator}}>{{#if togglingHelmIncubator}}<i class="icon icon-spinner icon-spin"></i> {{/if}}{{t 'generic.disable'}}</button>
          <button class="btn btn-link btn-sm bg-success">{{t "generic.enabled"}}</button>
        </div>
      {{else}}
        <div class="btn-group no-inline-space">
          <button class="btn btn-link btn-sm bg-primary">{{t 'generic.disabled'}}</button>
          <button class="btn btn-link btn-sm bg-defualt" {{action "enableHelmIncubator"}} disabled={{togglingHelmIncubator}}>{{#if togglingHelmIncubator}}<i class="icon icon-spinner icon-spin"></i> {{/if}}{{t 'generic.enable'}}</button>
        </div>
      {{/if}}
      {{#if customHelmIncubator}}
        {{#banner-message color='bg-warning'}}
          {{t 'catalogSettings.errors.nameInExists' key='helm-incubator' }}
        {{/banner-message}}
      {{/if}}
    </div>
    <p class="text-info">
      {{t 'catalogSettings.helm.incubator.detail'}}
    </p>
    {{#if helmIncubator.showTransitioningMessage}}
      <div class="{{helmIncubator.stateColor}}"><p>{{uc-first helmIncubator.transitioningMessage}}</p></div>
    {{/if}}
  </div>
</div>

{{custom-catalog
    catalogs=custom
}}