{% load i18n %}

<h3>{% trans "Instance Console" %}</h3>
{% if console_url %}
<p class='alert alert-info'>
{% if console_type != 'SERIAL' %}
{% blocktrans %}If console is not responding to keyboard input: click the grey status bar below.{% endblocktrans %}
{% endif %}
<a href="{{ console_url }}"  style="text-decoration: underline">{% trans "Click here to show only console" %}</a><br />
    {% trans "To exit the fullscreen mode, click the browser's back button." %}</p>
<iframe id="console_embed" src="{{ console_url }}" style="width:100%;height:100%"></iframe>
<script type="text/javascript">
    var fix_height = function() {
        $('iframe#console_embed').css({ height: $(document).height() + 'px' });
    };
    // there are two code paths to this particular block; handle them both
    if (typeof($) != 'undefined') {
        $(document).ready(fix_height);
    } else {
        addHorizonLoadEvent(fix_height);
    }
</script>
{% else %}
  <script type="text/javascript">
    horizon.alert('error', '{% blocktrans %}Console is currently unavailable.{% endblocktrans %}');
  </script>
  <div class="well">{% blocktrans %}Unable to load console. Please reload page to try again.{% endblocktrans %}</div>
{% endif %}
