<section class="header clearfix">
  <div class="pull-left">
    <h1 class="vertical-middle">
      {{t "containerPage.header" name=model.displayName}}
    </h1>
  </div>
  <div class="right-buttons">
    {{badge-state model=model}}
    {{action-menu model=model showPrimary=false classNames="ml-10 inline-block" size="sm"}}
  </div>
</section>

{{#if model.description}}
  {{banner-message color="bg-secondary mb-0 mt-10" message=(linkify model.description)}}
{{/if}}

{{#if model.showTransitioningMessage}}
  <div class="{{model.stateColor}}"><p>{{uc-first model.transitioningMessage}}</p></div>
{{/if}}

<div class="row banner bg-info basics">
  <div class="vertical-middle">
    <label class="acc-label vertical-middle p-0">{{t "servicePage.multistat.namespace"}}:</label>
    {{#if model.pod.namespaceId}}
      {{#copy-inline clipboardText=model.pod.namespaceId}}
        {{model.pod.namespaceId}}
      {{/copy-inline}}
    {{else}}
      {{t "generic.none"}}
    {{/if}}
  </div>
  <div class="vertical-middle">
    <label class="acc-label vertical-middle p-0">{{t "podPage.image"}}:</label>
    {{model.image}} {{copy-to-clipboard clipboardText=model.image size="small"}}
  </div>
  <div class="vertical-middle">
    <label class="acc-label vertical-middle p-0">{{t "containerPage.pod"}}:</label>            {{#if model.pod}}
      {{#link-to "pod" model.podId}}{{model.podId}}{{/link-to}}
    {{else if model.podId}}
      {{model.podId}}
    {{else}}
      {{t "generic.none"}}
    {{/if}}
  </div>
</div>

<div class="row banner bg-info basics">
  <div class="vertical-middle">
    <label class="acc-label vertical-middle p-0">{{t "containerPage.initContainer.label"}}:</label>
    {{#if model.initContainer}}
      {{t "generic.yes"}}
    {{else}}
      {{t "generic.no"}}
    {{/if}}
  </div>
  <div class="vertical-middle">
    <label class="acc-label vertical-middle p-0">{{t "generic.restarts"}}:</label>
    {{model.restarts}}
  </div>
  <div class="vertical-middle">
    <label class="acc-label vertical-middle p-0">{{t "generic.created"}}:</label>
    {{date-calendar model.pod.created}}
  </div>
</div>

{{#accordion-list as |al expandFn|}}
  {{#if scope.currentCluster.isMonitoringReady}}
    {{#metrics-summary
       expandAll=al.expandAll
       expandFn=expandFn
       grafanaUrl=model.grafanaUrl
       title=(t "metricsAction.sections.container")
    }}
      {{container-metrics podId=model.pod.id resourceId=model.name}}
    {{/metrics-summary}}
  {{/if}}

  {{#accordion-list-item
     title=(t "containerPage.portsTab.header")
     detail=(t "containerPage.portsTab.detail")
     expandAll=al.expandAll
     expand=(action expandFn)
  }}
    {{container/form-ports
      initialPorts=model.ports
      editing=false
    }}
  {{/accordion-list-item}}

  {{container/form-volumes
    launchConfig=model
    workload=model.pod
    namespace=model.pod.namespace
    loggingEnabled=true
    editing=false
    expandAll=al.expandAll
    expandFn=expandFn
  }}

  {{#accordion-list-item
     title=(t "containerPage.envTab.header")
     detail=(t "containerPage.envTab.detail")
     expandAll=al.expandAll
     expand=(action expandFn)
  }}
    {{form-env-var
      model=displayEnvironmentVars
    }}
  {{/accordion-list-item}}

  {{container/form-command
    instance=model
    service=model.pod
    editing=false
    expandAll=al.expandAll
    expandFn=expandFn
  }}

  {{#accordion-list-item
     title=(t "formHealthCheck.title")
     detail=(t "formHealthCheck.detail")
     expandAll=al.expandAll
     expand=(action expandFn)
  }}
    <div class="row">
      <div class="col span-6 mt-0 mb-0">
        <label class="acc-label">{{t "formHealthCheck.readiness"}}</label>
      </div>
      <div class="col span-6 mt-0 mb-0">
        {{#if model.livenessProbe}}
          <label class="acc-label">{{t "formHealthCheck.liveness"}}</label>
        {{/if}}
      </div>
    </div>
    <div class="row">
      <div class="col {{if model.livenessProbe "span-6" "span-12"}}">
        {{form-healthcheck
          initialCheck=model.readinessProbe
          editing=false
        }}
      </div>
      {{#if model.livenessProbe}}
        <div class="col span-6">
          {{form-healthcheck
            initialCheck=model.livenessProbe
            editing=false
            isLiveness=true
          }}
        </div>
      {{/if}}
    </div>
  {{/accordion-list-item}}

  {{container/form-security
    instance=model
    service=model.pod
    editing=false
    expandAll=al.expandAll
    expandFn=expandFn
  }}
{{/accordion-list}}