{% extends "v3/base.html" %}
{% block title %}{{ " | ".join(genome_dict["aliases"]) }}{% endblock %}
{% block head %}
    {{ super() }}
    <link rel="stylesheet" type="text/css" href="https://netdna.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
    <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
    <script src="https://code.jquery.com/jquery-3.3.1.js" type="text/javascript"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
    <script src="https://netdna.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
    <link href="https://unpkg.com/bootstrap-table@1.15.4/dist/bootstrap-table.min.css" rel="stylesheet">
    <script src="https://unpkg.com/bootstrap-table@1.15.4/dist/bootstrap-table.min.js"></script>
    <link href="{{ url_for('static', path='/style.css') }}" rel="stylesheet">
		<script>
        $.noConflict();
        jQuery(function ($) {
          $('[data-toggle="tooltip"]').tooltip();
          $('#asset-table').on('all.bs.table', function (e, name, args) {
            $('[data-toggle="tooltip"]').tooltip();
          });
        });
		</script>
{% endblock %}
{% block content %}
{% macro safe_show_asset_attr(x) %}
    {% if x is none or not x|length %}
        NA
    {% else %}
        {{ x }}
    {% endif %}
{% endmacro %}
<div class="container">
    <div class="row">
        <div class="col-12">
            <h3>Aliases: <b>{{ ", ".join(genome_dict["aliases"]) }}</b></h3>
            <h4>Digest: <code>{{ genome }}</code></h4>
            <p>Description: <i>{{ safe_show_asset_attr(genome_dict["genome_description"]) }}</i></p>
        </div>
    </div>
</div>
<hr class="featurette-divider">
<div class="container">
    <div class="row">
        <div class="col-12">
            <div id="toolbar">
                <h4 style="margin-bottom:0;">Assets table</h4>
            </div>
            <table class="table table-hover table-sm" data-toolbar="#toolbar" data-toggle="table" data-search="true" data-sort-stable="true">
                <thead class="thead-light">
                    <tr>
                        {% for column in columns %}
                            <th class="text-nowrap" data-align="center" data-sortable="true">{{ column }}</th>
                        {% endfor %}
                    </tr>
                </thead>
                <tbody>
                    {% for asset_name, asset_data in genome_dict.assets.items() | sort %}
                        {% for tag_name, tag_data in asset_data.tags.items() | sort %}
                            {% if tag_name != "default_tag" %}
                                <tr>
                                    <td>
                                        <a href="/v3/assets/archive/{{ genome }}/{{ asset_name }}?tag={{ tag_name }}" class="btn btn-outline-dark btn-sm mr-0" role="button" data-toggle="tooltip" title="Archive">
                                            <i class="fa fa-download" aria-hidden="true"></i>
                                        </a>
                                        <a href="/v3/assets/attrs/{{ genome }}/{{ asset_name }}?tag={{ tag_name }}" class="btn btn-outline-dark btn-sm ml-0" role="button" data-toggle="tooltip" title="Attributes">
                                            <i class="fa fa-tags" aria-hidden="true"></i>
                                        </a>
                                        <a href="/v3/assets/recipe/{{ genome }}/{{ asset_name }}?tag={{ tag_name }}" class="btn btn-outline-dark btn-sm ml-0" role="button" data-toggle="tooltip" title="Build recipe">
                                            <i class="fa fa-file-code-o" aria-hidden="true"></i>
                                        </a>
                                    </td>
                                    <td><a href="/v3/assets/splash/{{ genome }}/{{ asset_name }}?tag={{ tag_name }}" data-toggle="tooltip" title="Asset splash page"><b>{{ asset_name }}</b>:{{ tag_name }}</a></td>
                                    <td class="text-wrap"><span style="max-width:150px;">{{ safe_show_asset_attr(asset_data["asset_description"]) }}</span></td>
                                    <td>{{ safe_show_asset_attr(tag_data["asset_size"]) }}/{{ safe_show_asset_attr(tag_data["archive_size"]) }}</td>
                                    <td><code>{{ safe_show_asset_attr(tag_data["archive_digest"]) }}</code></td>
                                </tr>
                            {% endif %}
                        {% endfor %}
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock %}