{{#if providers.length}}
  {{#unless provider.enabled}}
    <section>
      <div class="row nav nav-boxes checked-active">
        <a href="#" alt="github" class="col span-2 nav-box-item driver {{if isGithub "active" ""}}" {{action "changeOauthType" "github"}}>
          <div class="auth-driver github-for-pipeline"></div>
          <p>{{t "generic.github"}}</p>
        </a>
        <a href="#" alt="gitlab" class="col span-2 nav-box-item driver {{if isGitlab "active" ""}}" {{action "changeOauthType" "gitlab"}}>
          <div class="auth-driver gitlab"></div>
          <p>{{t "generic.gitlab"}}</p>
        </a>
        <a href="#" alt="bitbucket" class="col span-2 nav-box-item driver {{if isBitbucket "active" ""}}" {{action "changeOauthType" "bitbucketcloud"}}>
          <div class="auth-driver bitbucket"></div>
          <p>{{t "generic.bitbucket"}}</p>
        </a>
      </div>
    </section>
  {{/unless}}

  {{#if provider.enabled}}
    <section class="header clearfix">
      <h1 class="pull-left">
        {{t "authPage.header"}}
      </h1>
    </section>

    <section>
      <div class="row nav nav-boxes checked-active">
        <a href="#" alt={{selectedOauthType}} class="col span-2 nav-box-item driver active">
          {{#if isGithub}}
            <div class="auth-driver github-for-pipeline"></div>
            <p>{{t "generic.github"}}</p>
          {{/if}}
          {{#if isGitlab}}
            <div class="auth-driver gitlab"></div>
            <p>{{t "generic.gitlab"}}</p>
          {{/if}}
          {{#if isBitbucket}}
            <div class="auth-driver bitbucket"></div>
            <p>{{t "generic.bitbucket"}}</p>
          {{/if}}
        </a>
      </div>
    </section>

    <section class="box mt-30">
      <h3>{{t "authPage.setting.executor.label"}}</h3>
      <hr/>
      <div class="vertical-middle">
        <label class="acc-label vertical-middle p-0">
          {{t "authPage.setting.executor.scale"}}
        </label>
        <span class="pr-5">
          {{scale.value}}
        </span>
        <div class="btn-group btn-group-xs p-0">
          <button class="btn btn-xs bg-primary" {{action "scaleDown"}}>
            <i class="icon icon-minus icon-fw"/>
          </button>
          <button style="margin-left: -1px;" class="btn btn-xs bg-primary" {{action "scaleUp"}}>
            <i class="icon icon-plus icon-fw"/>
          </button>
        </div>
      </div>
    </section>

    <section class="box mt-30">
      <h3>
        {{t "authPage.setting.limit.label"}}
      </h3>
      <hr/>
      <div class="row">
        <div class="col span-6">
          <label class="acc-label">
            {{t "formSecurity.memoryReservation.label"}}
          </label>
          <div class="input-group">
            {{input-integer
              min="4"
              step="1"
              value=memoryRequest
              classNames="form-control"
              placeholder=(t "formSecurity.memoryReservation.placeholder")
            }}
            <div class="input-group-addon bg-default">
              {{t "generic.mibibyte"}}
            </div>
          </div>

          <label class="acc-label mt-20">
            {{t "formSecurity.memoryLimit.label"}}
          </label>
          <div class="input-group">
            {{input-integer
              min="4"
              step="1"
              value=memoryLimit
              classNames="form-control"
              placeholder=(t "formSecurity.memoryReservation.placeholder")
            }}
            <div class="input-group-addon bg-default">
              {{t "generic.mibibyte"}}
            </div>
          </div>
        </div>

        <div class="col span-6">
          <label class="acc-label">
            {{t "formSecurity.milliCpuReservation.label"}}
          </label>
          <span class="with-input">
            <div class="input-group">
              {{input-integer
                min="0"
                step="100"
                value=cpuRequest
                classNames="form-control"
                placeholder=(t "formSecurity.milliCpuReservation.placeholder")
              }}
              <div class="input-group-addon bg-default">
                {{t "formSecurity.milliCpuReservation.unit"}}
              </div>
            </div>
          </span>

          <label class="acc-label mt-20">
            {{t "formSecurity.cpuLimit.label"}}
          </label>
          <span class="with-input">
            <div class="input-group">
              {{input-integer
                min="0"
                step="100"
                value=cpuLimit
                classNames="form-control"
                placeholder=(t "formSecurity.milliCpuReservation.placeholder")
              }}
              <div class="input-group-addon bg-default">
                {{t "formSecurity.milliCpuReservation.unit"}}
              </div>
            </div>
          </span>
        </div>
      </div>
      <div class="row ml-10 mt-10">
        {{save-cancel
          createLabel="authPage.setting.limit.saveActionLabel"
          save=(action "saveLimit")
          cancelDisabled=true
        }}
      </div>
    </section>

    <section class="box mt-30">
      <h3>
        {{t "authPage.setting.cacerts.label"}}
      </h3>
      <hr/>
      {{#if showCert}}
        {{schema/input-multiline
          value=cacerts.value
          placeholder=(t "newCertificate.cert.placeholder")
        }}
        <div class="row ml-10 mt-10">
          {{save-cancel
            createLabel="authPage.setting.cacerts.saveActionLabel"
            save=(action "saveCert")
            cancel=(action "hideCert")
          }}
        </div>
      {{else}}
        <div class="row ml-10 mt-10">
          {{save-cancel
            createLabel="authPage.setting.cacerts.show"
            save=(action "showCert")
            cancelDisabled=true
          }}
        </div>
      {{/if}}
    </section>

    <section class="box mt-30">
      <h3>
        {{t "authPage.authenticated.header.text"}}
      </h3>
      <hr/>
      {{#if provider.hostname}}
        <div>
          <b>{{t "authPage.authenticated.header.enterpriseHostName"}} </b>
          <a href="{{if provider.tls "https" "http"}}://{{provider.hostname}}" target="_blank" rel="nofollow noreferrer">{{provider.hostname}}</a>
        </div>
      {{/if}}

      {{#if isBitbucketCloud}}
        <div>
          <b>{{t "authPage.authenticated.header.enterpriseHostName"}} </b>
          <a href="https://bitbucket.org" target="_blank" rel="nofollow noreferrer">bitbucket.org</a>
        </div>
      {{/if}}

      {{#if provider.clientId}}
        <div>
          <b>{{t (if isBitbucket "authPage.authenticated.header.key.text" "authPage.authenticated.header.clientId.text")}} </b>
          <span class="text-muted">{{provider.clientId}}</span>
        </div>
      {{/if}}
      <div class="row mt-30 text-center">
        {{#if confirmDisable}}
          {{#if disabling}}
            <button class="btn bg-disabled" disabled="disabled">
              <i class="icon icon-spinner icon-spin"></i> {{t "generic.saving"}}
            </button>
          {{else}}
            <button class="btn bg-primary" {{action "disable"}}>
              <i class="icon icon-alert"></i> {{t "pipelinesSetting.sureToDisableOAuth"}}
            </button>
          {{/if}}
        {{else}}
          <button class="btn bg-primary" {{action "promptDisable"}}>
            <i class="icon icon-umbrella"></i> {{t "pipelinesSetting.disableOAuth"}}
          </button>
        {{/if}}
      </div>
    </section>
  {{/if}}

  {{#unless provider.enabled}}
    {{component providerComponent
      switch=(action "changeOauthType")
      provider=provider
      oauthModel=oauthModel
      githubAuthConfig=githubAuthConfig}}
  {{/unless}}
{{else}}
  <BannerMessage
    @color="bg-info"
    @message={{t "pipelinesSetting.info.noPermission"}}
  />
{{/if}}
