{% load split %}
    <div class="card-header" style="padding-bottom: 0;">
	  	<div class="row"  style="position: relative;">
	  		<div  class="col-md-2">
				<div style="display: inline-block;">
					<span style="font-size: 28px; font-weight: bold; white-space: nowrap; line-height: 1;">{{ job.id }}</span>
                    &nbsp
                    {% with job.quit_status_text|split:"_" as qs %}
						{% if qs.0 == "completed" %}
							<i class="fa fa-check text-success quit_status-icon" title="{{ job.quit_status_text }} [RC={{ job.quit_status }}]"></i>
						{% elif qs.0 == "interrupted" %}
							<i class="fa fa-hand-paper-o text-danger quit_status-icon" title="{{ job.quit_status_text }} [RC={{ job.quit_status }}]"></i>
						{% elif qs.0 == "autostop" %}
							<i class="fa fa-exclamation-circle text-danger quit_status-icon" title="{{ job.quit_status_text }} [RC={{ job.quit_status }}]"></i>
						{% elif qs.0 == "killed" %}
							<i class="fa fa-meh-o quit_status-icon" style="color: #333;" title="{{ job.quit_status_text }} [RC={{ job.quit_status }}]"></i>
						{% else %}
							<i class="fa fa-question text-muted quit_status-icon" title="{{ job.quit_status_text }} [RC={{ job.quit_status }}]"></i>
						{% endif %}
					{% endwith %}
                <br>

				</div>
                <div style="padding:5px 0;">
                    <b class="{% if net_errors == 0 %} tag tag-success {% else %} tag tag-danger {% endif %}">NET</b>
                    &nbsp;
					{% if http_codes.2 %}<b class="tag tag-success" title="http">2xx</b>{% endif %}
					{% if http_codes.3 %}<b class="tag tag-info" title="http">3xx</b>{% endif %}
					{% if http_codes.4 %}<b class="tag tag-warning" title="http">4xx</b>{% endif %}
					{% if http_codes.5 %}<b class="tag tag-danger" title="http">5xx</b>{% endif %}
				</div>
			</div>
			<div class="col-md-2">
				<span>{{ job.data_started|date:"d M 'y H:i:s" }} ({{ job.duration_formatted }})</span>
                <br>
				<span class="b-lunapark-offline-meta__imbalance b-editable" id="imb" data-action="edit-imbalance">
                {% if imbalance %}
					<span class="b-offlinepage-imbalance">
					{% if imbalance.hum_processed %}
						<b><span id="b-lunapark-offline-meta__imbalance_value">{{imbalance.hum_imbalance}}</span> RPS</b> ({%if imbalance.user%}{{imbalance.user}}{%else%}автостоп{%endif%})
					{% else %}
						<b><span id="b-lunapark-offline-meta__imbalance_value">{{imbalance.rob_imbalance}}</span> RPS</b> (робот)
					{% endif %}
					</span>
				{% else %}
						Разладка не найдена
				{% endif %}
				</span>
				<span class="fa fa-pencil text-warning" id="imb_pencil" style="display: none"></span>
				<div class="b_editimbalance_block" style="display: none; width: 12em;">
					<table width="100%">
						<tr>
							<td width="100%">
								<input type="text" id="b_editimbalance_block__firename__" class="form-control b_textinput b_textinput__10">
							</td>
							<td>
							<div id="b_editimbalance_block__okey__" class="b_name_edit_block">
								<span class="fa fa-check text-success" style="font-size: 12px; cursor:pointer;"></span>
							</div></td>
							<td>
							<div id="b_editimbalance_block__cancel__" class="b_name_edit_block">
								<span class="fa fa-ban text-danger" style="font-size: 12px; cursor:pointer;"></span>
							</div></td>
							<td>
							<div id="b_editimbalance_block__ajax__" class="b_name_edit_block" style="display:none;">
								<i class="krutilka fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>
							</div></td>
						</tr>
					</table>
				</div>
			</div>
			<div class="col-md-4">
				<dl>
					<dd style="font-weight: bold; white-space: normal;">
						<span class="b-lunapark-offline-meta__title b-editable" id="name" data-action="edit-name">{% if job.name %}{{ job.name }}{% else %}<span style="color: gray;">Имя стрельбы</span>{% endif %}</span>
						<span class="fa fa-pencil text-warning" id="name_pencil" style="display: none"></span>
						<div class="b_editname_block" style="display: none;">
							<table>
								<tr>
									<td>
										<input type="text" id="b_editname_block__firename__" class="form-control b_textinput b_textinput__10">
									</td>
									<td>
									<div id="b_editname_block__okey__" class="b_name_edit_block">
										<span class="fa fa-check text-success" style="font-size: 12px; cursor:pointer;"></span>
									</div></td>
									<td>
									<div id="b_editname_block__cancel__" class="b_name_edit_block">
										<span class="fa fa-ban text-danger" style="font-size: 12px; cursor:pointer;"></span>
									</div></td>
									<td>
									<div id="b_editname_block__ajax__" class="b_name_edit_block" style="display:none;">
										<i class="krutilka fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>
									</div></td>
								</tr>
							</table>
						</div>
                    </dd>
                    <dd style="white-space: normal; max-height: 108px; overflow: auto;">
                        <a href="//datalens.yandex-team.ru/clod4tpb3lek6-load-report?tab=Er&job_id={{ job.id }}&task_id={{ job.task }}"> datalens report</a>
                    </dd>
					<dd style="white-space: normal; max-height: 108px; overflow: auto;">
						<span class="b-lunapark-offline-meta__description b-editable" id="dsc" data-action="edit-dsc" style="font-size: 80%; white-space: pre-line">{% if job.dsc %}{{ job.dsc }}{% else %}<span style="color: gray;">Описание</span>{% endif %}</span>
						<span class="fa fa-pencil text-warning" id="dsc_pencil" style="display: none"></span>
						<div class="b_editcomment_block" style="display: none;">
							<table>
								<tr>
									<td>
										<textarea id="b_editname_block__firecomment__" class="form-control b_textinput b_textinput__10 b_textinput__"></textarea></td>
									<td>
									<div id="b_editcomment_block__okey__" class="b_name_edit_block2">
										<span class="fa fa-check text-success" style="font-size: 12px; cursor:pointer;"></span>
									</div>
									<div id="b_editcomment_block__cancel__" class="b_name_edit_block2">
										<span class="fa fa-ban text-danger" style="font-size: 12px; cursor:pointer;"></span>
									</div>
									<div id="b_editcomment_block__ajax__" class="b_name_edit_block2" style="display:none;">
										<i class="krutilka fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>
									</div></td>
								</tr>
                                <tr>
                                    <td>
                                        <div class="col-md-8">
                                            <a href="'https://datalens.yandex-team.ru/clod4tpb3lek6-load-report?tab=Er&job_id={{ job.id }}"> datalens report</a>
                                        </div>
                                    </td>
                                </tr>
							</table>
						</div>
					</dd>
				</dl>
			</div>
			<div class="col-md-4">
				<div style="float:right;">
					{% if is_in_compare %}
						<i style="margin-right: 8px;" class="fa fa-bar-chart b-lunapark-offlinepage__action text-success" data-action="compare" data-actiondetail="remove" title="Убрать из сравнения" aria-hidden="true"></i>
					{% else %}
						<i style="margin-right: 8px;" class="fa fa-bar-chart b-lunapark-offlinepage__action text-muted" data-action="compare" data-actiondetail="add" title="К сравнению" aria-hidden="true"></i>
					{% endif %}
					<i class="fa fa-star b-lunapark-offlinepage__action {% if job.flag %}text-warning{% else %}text-muted{% endif %}" aria-hidden="true" data-action="star" data-task="{{ job.task }}" title="Favorite"></i>
					<i class="fa fa-repeat b-lunapark-offlinepage__action text-info" data-action="repeat" data-job="{{ job.n }}" title="Повторить" aria-hidden="true"></i>
					<i class="fa fa-pencil b-lunapark-offlinepage__action text-warning" data-action="edit" title="Редактировать" aria-hidden="true"></i>
					<i class="fa fa-trash b-lunapark-offlinepage__action text-danger" data-action="remove" title="Удалить" data-task="{{ job.task }}" aria-hidden="true"></i>
				    	&nbsp;
                    <a href="//staff.yandex-team.ru/{{ job.person }}" style="display: inline;margin-left: 11px;" class="auto-person-card" title="{{ job.person }}"><img class="img-circle" src="//center.yandex-team.ru/user/avatar/{{job.person}}/140/square" height="70" width="70"/></a>
				</div>
			</div>
		</div>
		<div style="float:right; position: relative; bottom: 10px; margin-bottom: -20px;">
			<a class="job-meta__more clickable no-link-deco text-info" data-toggle="collapse" href="#collapseJobMeta">
				<span class="fa fa-caret-down" id="metaCollapseCaret" style="margin-top: 35px;font-size: 14px;"></span>
			</a>
		</div>
        <div class="collapse" id="collapseJobMeta">
            <div style="font-size: 10pt;">
                <hr style="border: none; border-top: 1px solid #EEE; margin: 1em 0.5em;">
                <div class="row">
                    <div class="col-md-3" style="font-weight: 500;">
                        Танк/мишень:
                    </div>
                    <div class="col-md-8">
                        {{ job.tank_reduced }} &rarr; {{ job.srv_reduced }}:{{ job.srv_port }}
                    </div>
                    <div class="col-md-1"></div>
                </div>
                <div class="row">
                    <div class="col-md-3" style="font-weight: 500;">
                        UserAgent танка:
                    </div>
                    <div class="col-md-8">
                        {{ user_agent }}
                    </div>
                    <div class="col-md-1"></div>
                </div>
                <div class="row">
                    <div class="col-md-3" style="font-weight: 500;">
                        Патроны:
                    </div>
                    <div class="col-md-8">
                        {{ job.ammo_path }} (loop={{ job.loop_cnt }})
                    </div>
                    <div class="col-md-1"></div>
                </div>
                {% if multitag %}
                    <div class="row">
                        <div class="col-md-3" style="font-weight: 500;">
                            Мультитэги:
                        </div>
                        <div class="col-md-8">
                            Да &nbsp;
                        </div>
                    </div>
                    <div class="col-md-1"></div>
                {% endif %}
                <div class="row">
                    <div class="col-md-3" style="font-weight: 500;">
                        Схема нагрузки:
                    </div>
                    <div class="col-md-8">
                        {{ schema }} &nbsp;
                    </div>
                    <div class="col-md-1"></div>
                </div>
                <div class="row">
                    <div class="col-md-3" style="font-weight: 500;">
                        Версия:
                    </div>
                    <div class="col-md-8">
                        {{ job.ver }} &nbsp;
                    </div>
                    <div class="col-md-1"></div>
                </div>
                    {% if job.component %}
                    <div class="row">
                        <div class="col-md-3" style="font-weight: 500;">
                            Регрессия:
                        </div>
                        <div class="col-md-8">
                            <a href="/regress/{{ task.project }}/{{ component.n }}"> {{ component.name }}</a>
                        </div>
                        <div class="col-md-1"></div>
                    </div>
                    {% endif %}
                    {% if regression_comments %}
                    <div class="row">
                        <div class="col-md-3" style="font-weight: 500;">
                            Комментарии из регрессии:
                        </div>
                        <div class="col-md-8">
                            {% for rc in regression_comments %}
                                <span>{{ rc.text }} -- {{ rc.author }} ({{ rc.created_at }})</span>
                                <br>
                            {% endfor %}
                        </div>
                        <div class="col-md-1"></div>
                    </div>
                    {% endif %}
                <div class="row">
                    <div class="col-md-3" style="font-weight: 500;">
                        Инстансов phantom:
                    </div>
                    <div class="col-md-8">
                        {{ job.instances }}
                    </div>
                    <div class="col-md-1"></div>
                </div>
                <div class="row">
                    <div class="col-md-3" style="font-weight: 500;">
                        Команда запуска:
                    </div>
                    <div class="col-md-8">
                        {{ job.command_line }}
                    </div>
                    <div class="col-md-1"></div>
                </div>
                {% if jenkinsbuild %}
                    <div class="row">
                        <div class="col-md-3" style="font-weight: 500;">
                            Jenkins build:
                        </div>
                        <div class="col-md-8">
                            <a href="{{ jenkinsbuild }}" title="{{ jenkinsbuild }}">Jenkins Build</a>
                        </div>
                    </div>
                {% endif %}
                {% if jenkinsrebuild %}
                    <div class="row">
                        <div class="col-md-3" style="font-weight: 500;">
                            Jenkins build:
                        </div>
                        <div class="col-md-8">
                            <a href="{{ jenkinsrebuild }}" title="{{ jenkinsrebuild }}">Jenkins Rebuild</a>
                        </div>
                        <div class="col-md-1"></div>
                    </div>
                {% endif %}
                {% if jenkinsjob %}
                    <div class="row">
                        <div class="col-md-3" style="font-weight: 500;">
                            Задача в Jenkins:
                        </div>
                        <div class="col-md-8">
                            <a href="{{ jenkinsjob }}" title="{{ jenkinsjob }}">Jenkins Job</a>
                        </div>
                        <div class="col-md-1"></div>
                    </div>
                {% endif %}
                <div class="row">
                    <div class="col-md-3" style="font-weight: 500;">
                        Снимок опций танка:
                    </div>
                    <div class="col-md-8">
                        <a target="_blank" href="/api/job/{{ job.n }}/configinfo.txt">configinfo.txt</a>
                    </div>
                    <div class="col-md-1"></div>
                </div>
                {% if configinitial %}
                    <div class="row">
                        <div class="col-md-3" style="font-weight: 500;">
                            Исходный конфиг:
                        </div>
                        <div class="col-md-8">
                            <a target="_blank" href="/api/job/{{ job.n }}/configinitial.txt">configinitial.txt</a>
                        </div>
                        <div class="col-md-1"></div>
                    </div>
                {% endif %}
                {% if has_monitoring %}
                    <div class="row">
                        <div class="col-md-3" style="font-weight: 500;">
                            Конфиг мониторинга:
                        </div>
                        <div class="col-md-8">
                            <a target="_blank" href="/api/job/{{ job.n }}/jobmonitoringconfig.txt">monitoring_config.txt</a>
                        </div>
                        <div class="col-md-1"></div>
                    </div>
                {% endif %}
                {% if artifacts %}
                        <div class="row">
                            <div class="col-md-3" style="font-weight: 500;">
                                Артефакты стрельбы:
                            </div>
                            <div class="col-md-8">
                            &nbsp;
                            </div>
                            <div class="col-md-1"></div>
                        </div>
                {% endif %}
                {% for art in artifacts %}
                    <div class="row">
                        <div class="col-md-3" style="font-weight: 500;">
                        &nbsp;
                        </div>
                        <div class="col-md-8">
                            <a target="_blank" href="{{ art.1 }}" class="b_link">{{ art.0 }}</a>&ensp;<a target="_blank" href="{{ art.1 }}&download=1" class="b_link"><span class="fa fa-download text-info"></span></a>
                        </div>
                        <div class="col-md-1"></div>
                    </div>
                {% endfor %}
                <br>
            </div>
        </div>
        <script nonce='{{ common.CSP_SCRIPT_NONCE }}'>
            var $collapsible = $('#collapseJobMeta'),
                $caret = $('#metaCollapseCaret');

            $collapsible.on('hidden.bs.collapse', function () {
              $caret.addClass('fa-caret-down');
              $caret.removeClass('fa-caret-up');
            });
            $collapsible.on('shown.bs.collapse', function () {
              $caret.removeClass('fa-caret-down');
              $caret.addClass('fa-caret-up');
            });
        </script>
        <ul style="margin-top: 10px;" class="nav nav-tabs card-header-tabs pull-xs-left job-tabpanel__tabs" id="job-tabpanel__tabs">
        </ul>
	</div>

<!-- Modal -->
<div class="modal fade" id="thankModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title"><span class="person">{{ job.person }}</span>, спасибо тебе за..</h4>
      </div>
      <div class="modal-body">
        <form method="POST" action="/person/{{ job.person }}/thank/" id="thankForm">
	        {% csrf_token %}
	        <input placeholder="Текст спасибы" size=13 class="form-control" type="text" name="text">
	        <br>
			<input class="btn btn-brand" type="button" id="submitThank" value="Сказать" style="margin-right: 5px;">
			<i id="thKrutilka" style="display: none;" class="krutilka fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>
			<span id="success" class='text-success' style="opacity: 0;"><i class="fa fa-check"></i>&nbsp;OK</span>
			<span id="fail" class='text-danger' style="opacity: 0;"><i class="fa fa-close"></i>&nbsp;FAILED</span>
        </form>
      </div>
    </div>
  </div>
</div>

<link href="/media/css/offlinepage.css?version=43.4" type="text/css" rel="stylesheet" />
<script nonce='{{ common.CSP_SCRIPT_NONCE }}' type='text/javascript' src='/media/js/offlinepage/meta.js?version=43.4'></script>
