{% extends "admin/base_site.html" %}
{% load i18n static %}

{% block title %}{{ title }} | {% trans 'Dagster' %}{% endblock %}

{% block breadcrumbs %}
<div class="breadcrumbs">
    <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
    &rsaquo; <a href="{% url 'admin:app_list' 'django_dagster' %}">{% trans 'Dagster' %}</a>
    {% block dagster_breadcrumbs %}{% endblock %}
</div>
{% endblock %}

{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" href="{% static 'admin/css/forms.css' %}">
<link rel="stylesheet" href="{% static 'admin/css/changelists.css' %}">
<style>
    .status-badge {
        display: inline-block;
        padding: 2px 8px;
        border-radius: 3px;
        font-size: 11px;
        font-weight: bold;
        text-transform: uppercase;
    }
    .status-SUCCESS { background: #417505; color: white; }
    .status-FAILURE { background: #ae1c1c; color: white; }
    .status-CANCELED { background: #ae1c1c; color: white; }
    .status-STARTED, .status-STARTING { background: #2271b1; color: white; }
    .status-QUEUED, .status-NOT_STARTED, .status-MANAGED { background: #9e9e9e; color: white; }
    .status-CANCELING { background: #c47600; color: white; }
    pre.dagster-config {
        background: var(--darkened-bg);
        padding: 12px;
        border-radius: 4px;
        overflow-x: auto;
        max-height: 400px;
        font-size: 12px;
    }
    .event-level {
        display: inline-block;
        padding: 1px 6px;
        border-radius: 3px;
        font-size: 10px;
        font-weight: bold;
        text-transform: uppercase;
    }
    .event-level-ERROR, .event-level-CRITICAL { background: #ae1c1c; color: white; }
    .event-level-WARNING { background: #c47600; color: white; }
    .event-level-INFO { background: #9e9e9e; color: white; }
    .event-level-DEBUG { background: #ddd; color: #666; }
    .row-error td { background: #fff0f0; }
</style>
{% endblock %}

{% block content %}
<div id="content-main">
    {% if dagster_url %}
    <div class="module" style="padding:8px 12px;margin-bottom:15px;font-size:12px;color:var(--body-quiet-color);">
        {% trans 'Dagster instance:' %} <strong><a href="{{ dagster_url }}" target="_blank" rel="noopener" style="color:inherit;">{{ dagster_url }}</a></strong>
        {% if dagster_ui_jobs_url or dagster_ui_runs_url or dagster_ui_locations_url %}
        <span style="margin-left:12px;">
            {% if dagster_ui_jobs_url %}<a href="{{ dagster_ui_jobs_url }}" target="_blank" rel="noopener" style="margin-right:8px;">{% trans 'Jobs' %} &#x2197;</a>{% endif %}
            {% if dagster_ui_runs_url %}<a href="{{ dagster_ui_runs_url }}" target="_blank" rel="noopener" style="margin-right:8px;">{% trans 'Runs' %} &#x2197;</a>{% endif %}
            {% if dagster_ui_locations_url %}<a href="{{ dagster_ui_locations_url }}" target="_blank" rel="noopener">{% trans 'Code Locations' %} &#x2197;</a>{% endif %}
        </span>
        {% endif %}
    </div>
    {% endif %}
    {% block dagster_content %}{% endblock %}
</div>
{% endblock %}
