<commit_before><section class="header clearfix">
  <h1 class="pull-left">
    {{t 'servicePage.header' type=service.displayType name=service.displayName}}
  </h1>
  {{#if service.canHaveContainers}}
    <div class="pull-left mt-5">
      {{info-multi-stats model=service largeTargetId="largeStats"}}
    </div>
  {{/if}}
  <div class="right-buttons">
    {{badge-state model=service}}
    {{action-menu model=service showPrimary=false classNames="ml-10 pull-right" size="sm"}}
  </div>
</section>

<div id="largeStats">
</div>

{{#if model.description}}
  {{banner-message color='bg-secondary mb-0 mt-10' message=model.description}}
{{/if}}

{{!todo copy pasta}}
<section>
  <div class="row banner bg-info basics">

    {{#if service.launchConfig.memoryReservation}}
      <div class="inline-block">
        <label class="acc-label p-0">{{t 'containersPage.containerPage.infoMultiStats.memoryReservation.labelText'}}</label>
        {{service.memoryReservationBlurb}}
      </div>
    {{/if}}

    {{#if service.launchConfig.milliCpuReservation}}
      <div class="inline-block">
        <label class="acc-label p-0">{{t 'containersPage.containerPage.infoMultiStats.milliCpuReservation.labelText'}}</label>
        {{service.launchConfig.milliCpuReservation}}
      </div>
    {{/if}}

    {{#if service.fqdn}}
      <div class="inline-block">
        <label class="acc-label p-0">{{t 'servicePage.multistat.fqdn'}}</label>
        <a href="http://{{service.fqdn}}">{{service.fqdn}}</a> {{copy-to-clipboard clipboardText=service.fqdn size="small"}}
      </div>
      <hr>
    {{/if}}

    <div class="inline-block">
      <label class="acc-label p-0" style="vertical-align: middle;">{{t 'servicePage.multistat.scale'}}</label>
      {{#if service.canScale}}
        <span class="pr-5" style="vertical-align: middle;">
          {{service.displayScale}}
        </span>
        <div class="btn-group btn-group-xs p-0" style="vertical-align: middle;">
          <button class="btn btn-xs bg-primary" {{action "scaleDown" target=service}} disabled={{not service.canScaleDown}}><i class="icon icon-minus icon-fw"/></button>
          <button style="margin-left:2px;" class="btn btn-xs bg-primary" {{action "scaleUp" target=service}} disabled={{not service.canScaleUp}}><i class="icon icon-plus icon-fw"/></button>
        </div>
      {{else}}
        {{t 'generic.na'}}
      {{/if}}
    </div>

    {{#if service.hasImage}}
      <div class="inline-block">
        <label class="acc-label p-0">{{t 'servicePage.multistat.image'}}</label>
        {{service.launchConfig.displayImage}} {{copy-to-clipboard clipboardText=service.launchConfig.displayImage size="small"}}
      </div>
    {{/if}}
  </div>
</section>

<section>
  {{#accordion-list as |al expandFn| }}
    {{#if (eq service.kind 'externalService')}}
      {{!-- since external services are the only ones that have externalIp/hostname it didnt make sense to give extIps its own route like other services  --}}
      <hr/>
      <section>
        <div>
          {{#if service.externalIpAddresses}}
            <label class="text-muted ml-15">{{t 'servicePage.external.externalIp'}}</label>
            <ul class="list-unstyled list-inline with-room">
              {{#each service.externalIpAddresses as |ip|}}
                <li>
                  <i class="icon icon-external-link"></i> {{ip}}
                </li>
              {{/each}}
            </ul>
          {{else}}
            <label class="text-muted">{{t 'servicePage.external.externalHostname'}} </label> {{service.hostname}}
          {{/if}}
        </div>
      </section>
      <hr/>
    {{/if}}

    {{#if service.canHaveContainers}}
      {{#accordion-list-item
           title=(t 'servicePage.containersTab.title')
           detail=(t 'servicePage.containersTab.detail')
           status=(t 'servicePage.containersTab.status' count=service.instances.length)
           statusClass=(if service.instances.length 'bg-success' 'text-muted')
           expandOnInit=true
           expandAll=al.expandAll
           expand=(action expandFn)
           componentName='container-table'
           as | parent |
      }}
        {{component parent.intent
            body=service.instances
            bulkActions=true
            search=true
            searchText=searchText
            showHost=true
        }}
      {{/accordion-list-item}}
    {{/if}}

    {{#if service.lbConfig}}
      {{#accordion-list-item
           title=(t 'formBalancerRules.label')
           detail=(t 'formBalancerRules.detail')
           status=(t 'formBalancerRules.status' count=(if rules.length rules.length 0))
           statusClass=(if rules.length 'bg-success' 'text-muted')
           expandAll=al.expandAll
           expand=(action expandFn)
           componentName='sortable-table'
           as | parent |
      }}
        {{form-balancer-listeners
            service=service
            errors=ruleErrors
            editing=false
        }}
      {{/accordion-list-item}}

      {{#if service.isBalancer}}
        {{#accordion-list-item
             title=(t 'servicePage.certsTab.title')
             detail=(t 'servicePage.certsTab.detail')
             status=(t 'servicePage.certsTab.status' count=(if model.service.lbConfig.certificateIds.length model.service.lbConfig.certificateIds.length 0))
             statusClass=(if model.service.lbConfig.certificateIds.length 'bg-success' 'text-muted')
             expandAll=al.expandAll
             expand=(action expandFn)
        }}
          <div class="row">
            <div class="box col span-6">
              <label class="acc-label">{{t 'servicePage.certsTab.default'}}:</label>
              {{#if model.service.lbConfig.defaultCertificateId}}
                <a href="{{href-to "certificates.detail" model.service.lbConfig.defaultCertificateId}}">{{model.service.lbConfig.defaultCertificate.displayName}}</a>
              {{else}}
                <div class="text-muted">{{t 'generic.none'}}</div>
              {{/if}}
            </div>
            <div class="box col span-6">
              <label class="acc-label">{{t 'servicePage.certsTab.additional'}}:</label>
              {{#if model.service.lbConfig.certificateIds.length}}
                <ul class="list-unstyled">
                  {{#each model.service.lbConfig.certificates as |cert|}}
                    <li>
                      <a href="{{href-to "certificates.detail" cert.id}}">{{cert.displayName}}</a>
                    </li>
                  {{/each}}
                </ul>
              {{else}}
                <div class="text-muted">{{t 'generic.none'}}</div>
              {{/if}}
            </div>
          </div>
        {{/accordion-list-item}}
      {{/if}}
    {{/if}}


    {{#if (and service.isReal (not service.isBalancer))}}
      {{container/form-command
          tagName=''
          instance=service
          isService=true
          initialLabels=service.launchConfig.labels
          editing=false
          expandAll=al.expandAll
          expandFn=expandFn
      }}
    {{/if}}

    {{#if (not service.isBalancer)}}
      {{form-env-var
          model=model.service.displayEnvironmentVars
          expandAll=al.expandAll
          expandFn=expandFn
      }}
    {{/if}}

    {{form-healthcheck
        healthCheck=model.service
        editing=false
        expandAll=al.expandAll
        expandFn=expandFn
        classNames="accordion"
    }}

    {{container/form-scheduling<commit_msg>Fix missing launch config for service details<commit_after><section class="header clearfix">
  <h1 class="pull-left">
    {{t 'servicePage.header' type=service.displayType name=service.displayName}}
  </h1>
  {{#if service.canHaveContainers}}
    <div class="pull-left mt-5">
      {{info-multi-stats model=service largeTargetId="largeStats"}}
    </div>
  {{/if}}
  <div class="right-buttons">
    {{badge-state model=service}}
    {{action-menu model=service showPrimary=false classNames="ml-10 pull-right" size="sm"}}
  </div>
</section>

<div id="largeStats">
</div>

{{#if model.description}}
  {{banner-message color='bg-secondary mb-0 mt-10' message=model.description}}
{{/if}}

{{!todo copy pasta}}
<section>
  <div class="row banner bg-info basics">

    {{#if service.launchConfig.memoryReservation}}
      <div class="inline-block">
        <label class="acc-label p-0">{{t 'containersPage.containerPage.infoMultiStats.memoryReservation.labelText'}}</label>
        {{service.memoryReservationBlurb}}
      </div>
    {{/if}}

    {{#if service.launchConfig.milliCpuReservation}}
      <div class="inline-block">
        <label class="acc-label p-0">{{t 'containersPage.containerPage.infoMultiStats.milliCpuReservation.labelText'}}</label>
        {{service.launchConfig.milliCpuReservation}}
      </div>
    {{/if}}

    {{#if service.fqdn}}
      <div class="inline-block">
        <label class="acc-label p-0">{{t 'servicePage.multistat.fqdn'}}</label>
        <a href="http://{{service.fqdn}}">{{service.fqdn}}</a> {{copy-to-clipboard clipboardText=service.fqdn size="small"}}
      </div>
      <hr>
    {{/if}}

    <div class="inline-block">
      <label class="acc-label p-0" style="vertical-align: middle;">{{t 'servicePage.multistat.scale'}}</label>
      {{#if service.canScale}}
        <span class="pr-5" style="vertical-align: middle;">
          {{service.displayScale}}
        </span>
        <div class="btn-group btn-group-xs p-0" style="vertical-align: middle;">
          <button class="btn btn-xs bg-primary" {{action "scaleDown" target=service}} disabled={{not service.canScaleDown}}><i class="icon icon-minus icon-fw"/></button>
          <button style="margin-left:2px;" class="btn btn-xs bg-primary" {{action "scaleUp" target=service}} disabled={{not service.canScaleUp}}><i class="icon icon-plus icon-fw"/></button>
        </div>
      {{else}}
        {{t 'generic.na'}}
      {{/if}}
    </div>

    {{#if service.hasImage}}
      <div class="inline-block">
        <label class="acc-label p-0">{{t 'servicePage.multistat.image'}}</label>
        {{service.launchConfig.displayImage}} {{copy-to-clipboard clipboardText=service.launchConfig.displayImage size="small"}}
      </div>
    {{/if}}
  </div>
</section>

<section>
  {{#accordion-list as |al expandFn| }}
    {{#if (eq service.kind 'externalService')}}
      {{!-- since external services are the only ones that have externalIp/hostname it didnt make sense to give extIps its own route like other services  --}}
      <hr/>
      <section>
        <div>
          {{#if service.externalIpAddresses}}
            <label class="text-muted ml-15">{{t 'servicePage.external.externalIp'}}</label>
            <ul class="list-unstyled list-inline with-room">
              {{#each service.externalIpAddresses as |ip|}}
                <li>
                  <i class="icon icon-external-link"></i> {{ip}}
                </li>
              {{/each}}
            </ul>
          {{else}}
            <label class="text-muted">{{t 'servicePage.external.externalHostname'}} </label> {{service.hostname}}
          {{/if}}
        </div>
      </section>
      <hr/>
    {{/if}}

    {{#if service.canHaveContainers}}
      {{#accordion-list-item
           title=(t 'servicePage.containersTab.title')
           detail=(t 'servicePage.containersTab.detail')
           status=(t 'servicePage.containersTab.status' count=service.instances.length)
           statusClass=(if service.instances.length 'bg-success' 'text-muted')
           expandOnInit=true
           expandAll=al.expandAll
           expand=(action expandFn)
           componentName='container-table'
           as | parent |
      }}
        {{component parent.intent
            body=service.instances
            bulkActions=true
            search=true
            searchText=searchText
            showHost=true
        }}
      {{/accordion-list-item}}
    {{/if}}

    {{#if service.lbConfig}}
      {{#accordion-list-item
           title=(t 'formBalancerRules.label')
           detail=(t 'formBalancerRules.detail')
           status=(t 'formBalancerRules.status' count=(if rules.length rules.length 0))
           statusClass=(if rules.length 'bg-success' 'text-muted')
           expandAll=al.expandAll
           expand=(action expandFn)
           componentName='sortable-table'
           as | parent |
      }}
        {{form-balancer-listeners
            service=service
            errors=ruleErrors
            editing=false
        }}
      {{/accordion-list-item}}

      {{#if service.isBalancer}}
        {{#accordion-list-item
             title=(t 'servicePage.certsTab.title')
             detail=(t 'servicePage.certsTab.detail')
             status=(t 'servicePage.certsTab.status' count=(if model.service.lbConfig.certificateIds.length model.service.lbConfig.certificateIds.length 0))
             statusClass=(if model.service.lbConfig.certificateIds.length 'bg-success' 'text-muted')
             expandAll=al.expandAll
             expand=(action expandFn)
        }}
          <div class="row">
            <div class="box col span-6">
              <label class="acc-label">{{t 'servicePage.certsTab.default'}}:</label>
              {{#if model.service.lbConfig.defaultCertificateId}}
                <a href="{{href-to "certificates.detail" model.service.lbConfig.defaultCertificateId}}">{{model.service.lbConfig.defaultCertificate.displayName}}</a>
              {{else}}
                <div class="text-muted">{{t 'generic.none'}}</div>
              {{/if}}
            </div>
            <div class="box col span-6">
              <label class="acc-label">{{t 'servicePage.certsTab.additional'}}:</label>
              {{#if model.service.lbConfig.certificateIds.length}}
                <ul class="list-unstyled">
                  {{#each model.service.lbConfig.certificates as |cert|}}
                    <li>
                      <a href="{{href-to "certificates.detail" cert.id}}">{{cert.displayName}}</a>
                    </li>
                  {{/each}}
                </ul>
              {{else}}
                <div class="text-muted">{{t 'generic.none'}}</div>
              {{/if}}
            </div>
          </div>
        {{/accordion-list-item}}
      {{/if}}
    {{/if}}


    {{#if (and service.isReal (not service.isBalancer))}}
      {{container/form-command
          tagName=''
          instance=service.launchConfig
          isService=true
          initialLabels=service.launchConfig.labels
          editing=false
          expandAll=al.expandAll
          expandFn=expandFn
      }}
    {{/if}}

    {{#if (not service.isBalancer)}}
      {{form-env-var
          model=model.service.displayEnvironmentVars
          expandAll=al.expandAll
          expandFn=expandFn
      }}
    {{/if}}

    {{form-healthcheck
        healthCheck=model.service
        editing=false
        expandAll=al.expandAll
        expandFn=expandFn
        classNames="accordion"
    }}

    {{container/form-scheduling
{'fraction_non_alphanumeric': 0.15904400505958324, 'fraction_numerical': 0.002929232407962186, 'mean_word_length': 2.3205128205128207, 'pattern_counts': {'":': 0, '<': 175, '<?xml version=': 0, '>': 175, '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': '2231404', 'n_tokens_mistral': 4541, 'n_tokens_neox': 4427, 'n_words': 781}