<div class="pod-header">
  <div class="resource-actions">
    <button type="button" class="btn-circle-menu"></button>
  </div>

  <div class="pod-state {{stateBackground}}"><span>{{model.displayState}}</span></div>
  <div class="pod-icon"><i class="icon icon-lg {{model.stateIcon}} {{model.stateColor}}"></i></div>
  <div class="pod-name">
    {{#if isMachine}}
      {{model.displayName}}
    {{else}}
      {{#link-to "host" model.id}}{{model.displayName}}{{/link-to}}
      {{#if model.showTransitioningMessage}}
        <div class="pod-message {{if model.isError 'text-danger' 'text-muted'}}">
          {{model.transitioningMessage}}
        </div>
      {{/if}}
    {{/if}}
  </div>
</div>

{{#if isMachine}}
  <div class="machine-info">
    {{#if isActive}}
      Almost there&hellip;<br/>
      <i class="icon icon-spinner icon-spin"></i> Waiting for agent connection
    {{else}}
      {{#if model.isError}}
        {{#if model.transitioningMessage}}
          <span class="text-danger">{{model.transitioningMessage}}</span>
        {{else}}
          <span class="text-danger">Error creating machine</span>
        {{/if}}
      {{else}}
        <div class="color:black;">Setting up machine&hellip;</div>
        {{model.transitioningMessage}}
      {{/if}}
    {{/if}}
  </div>
{{else}}
  <div class="pod-info clearfix">
    <div class="pod-info-line">
      <div class="pod-info-item"><i class="icon icon-link"></i> {{model.displayIp}}</div>
      {{#if model.osBlurb}}
        <div class="pod-info-item"><i class="icon icon-linux"></i> {{model.osBlurb}}</div>
      {{/if}}
      {{#if model.machine}}
        <div class="pod-info-item"><i class="icon icon-microwave"></i> {{model.machine.driver}}</div>
      {{/if}}
    </div>
    <div class="pod-info-line">
      {{#if model.cpuBlurb}}
        <div class="pod-info-item"><i class="icon icon-tachometer" style="position: relative; top: -1px;"></i> {{model.cpuBlurb}}</div>
      {{/if}}
      {{#if model.memoryBlurb}}
        <div class="pod-info-item"><i class="icon icon-microchip"></i> {{model.memoryBlurb}}</div>
      {{/if}}
      {{#if model.diskBlurb}}
        <div class="pod-info-item"><i class="icon icon-hdd"></i> {{model.diskBlurb}}</div>
      {{/if}}
    </div>
    {{#if userLabelArray.length}}
      <div class="pod-info-line" style="white-space: normal; padding-top: 5px;">
        {{#each userLabelArray as |label|}}
          <span class="label label-default clip" style="display: inline-block; max-width: 100%;">{{label.key}}{{#if label.value}}={{label.value}}{{/if}}</span>
        {{/each}}
      </div>
    {{/if}}
  </div>

  <div class="clearfix {{if (eq mode "dot") 'r-p5'}}">
    {{#if (eq mode "dot")}}
      {{#each arrangedInstances as |item|}}
        {{container-dot model=item}}
      {{/each}}
    {{else}}
      {{#if (eq mode "grouped")}}
        {{#each groupedInstances as |group|}}
          <h6 class="subpod-header">{{#if group.name}}Stack: {{group.name}}{{else}}Standalone Containers{{/if}}</h6>
          <div class="clearfix">
            {{#each group.instances as |item|}}
              {{container-subpod model=item.main stripProject=true children=item.children groupHasChildren=group.hasChildren}}
            {{/each}}
            {{#unless group.name}}
              {{#if showAdd}}
                {{add-subpod action="newContainer" label="Add Container" groupHasChildren=group.hasChildren}}
              {{/if}}
            {{/unless}}
          </div>
        {{else}}
          {{#if showAdd}}
            {{add-subpod action="newContainer" label="Add Container" groupHasChildren=group.hasChildren}}
          {{/if}}
        {{/each}}
      {{else}}
        {{#each arrangedInstances as |item|}}
          {{container-subpod model=item}}
        {{/each}}
        {{#if showAdd}}
          {{add-subpod action="newContainer" label="Add Container" groupHasChildren=group.hasChildren}}
        {{/if}}
      {{/if}}
    {{/if}}
  </div>
{{/if}}
