<rd-header>
  <rd-header-title title-text="Container console"></rd-header-title>
  <rd-header-content>
    <a ui-sref="docker.containers">Containers</a> &gt; <a ui-sref="docker.containers.container({id: container.Id})">{{ container.Name | trimcontainername }}</a> &gt; Console
  </rd-header-content>
</rd-header>

<div class="row" ng-init="autoconnectAttachView()" ng-show="loaded">
  <div class="col-lg-12 col-md-12 col-xs-12">
    <rd-widget>
      <rd-widget-header icon="fa-terminal" title-text="Attach"></rd-widget-header>
      <rd-widget-body>
        <div class="small text-warning" ng-if="!container.Config.OpenStdin">
          <p>
            <i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
            The interactive-flag is not set. You might not be able to use the console properly.
          </p>
        </div>

        <div class="small text-warning" ng-if="!container.Config.Tty">
          <p>
            <i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
            The TTY-flag is not set. You might not be able to use the console properly.
          </p>
        </div>

        <div class="small text-danger" ng-hide="container.State.Running">
          <p>
            <i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
            The container is not running.
          </p>
        </div>

        <button
          type="button"
          class="btn btn-primary"
          ng-disabled="state === states.connecting || !container.State.Running"
          ng-click="state == states.disconnected ? connectAttach() : disconnect()"
        >
          <span ng-show="state === states.disconnected">Attach to Container</span>
          <span ng-show="state === states.connected">Detach</span>
          <span ng-show="state === states.connecting">Attaching...</span>
        </button>
      </rd-widget-body>
    </rd-widget>
  </div>
</div>

<div class="row">
  <div class="col-lg-12 col-md-12 col-xs-12">
    <div id="terminal-container" class="terminal-container"></div>
  </div>
</div>
