{% extends "base.html" %}

{% set active_tab = 'driverlog' %}
{% block title %}Vendor Drivers{% endblock %}

{% block head %}
    <script type="text/javascript">
        var base_url = "http://stackalytics.com/driverlog/";

        $(document).ready(function () {
            initSelectors(base_url);
            showSummary(base_url);
        });
    </script>
{% endblock %}


{% block body %}

<div class="page">
    <div class="banner">Information on drivers is in beta and may contain some inaccuracies. If you see an error, <br/> please help us make the service better by
        <a href="https://wiki.openstack.org/wiki/DriverLog#How_To:_Add_a_new_driver_to_DriverLog" target="_blank">filing a bug or an update request</a></div>
<div class="aheader">
        <div style="float: right; margin-top: 10px; margin-right: 20px;">
            <a href="https://wiki.openstack.org/wiki/DriverLog#How_To:_Add_a_new_driver_to_DriverLog" target="_blank">Add / Edit Driver</a>
        </div>
        <div id="analytics_header">
            <div style="float: left;">
                <span id="logo"><a href="{{ url_for('overview') }}"><img src="{{ url_for('static', filename='images/stackalytics_logo.png') }}" alt="Stackalytics" style="width: 100%; max-width: 190px;"></a></span>
            </div>
            <div class="stackamenu" style="margin-left: 240px">
                <ul id="menu-stackamenu">
                    <li class="menu-item"><a href="/"><span class="icon-pie"></span>Code Contribution</a></li>
                    <li class="menu-item current-menu-item"><a href="/report/driverlog"><span class="icon-cogs"></span>Vendor Drivers <sup><small>&beta;</small></sup></a></li>
                    <li class="menu-item"><a href="/report/members"><span class="icon-users"></span>Member Directory</a></li>
                </ul>
            </div>
        </div>

    <div class="drops">

        <div class="drop">
            <label for="release" title="OpenStack Release">Release</label>
            <input type="hidden" id="release" style="width:240px" data-placeholder="Any release"/>
        </div>

        <div class="drop">
            <label for="project_id" title="OpenStack Project">Project</label>
            <input type="hidden" id="project_id" style="width:240px"  data-placeholder="Any project"/>
        </div>

        <div class="drop">
            <label for="vendor" title="Vendor">Vendor</label>
            <input type="hidden" id="vendor" style="width:240px"  data-placeholder="Any vendor"/>
        </div>

    </div>

    <div style="margin-top: 2em;">
        <table id="data_table" class="display">
            <thead>
            <tr>
                <th>Project</th>
                <th>Vendor</th>
                <th>Driver</th>
                <th>In Trunk?</th>
                <th>CI exists?</th>
                <th>Maintainer</th>
            </tr>
            </thead>
        </table>
    </div>

    <div id="driver_info_dialog" title="Driver Details">
        <div id="driver_info_container"></div>
    </div>

    <script id="driver_info_template" type="text/x-jquery-tmpl">
    {% raw %}
        <h2>${name}</h2>
        <div><span class="label">Vendor:</span> <span class="value">${vendor}</span></div>
        <div><span class="label">Project:</span> <span class="value">${project_id}</span></div>
        <div><span class="label">Description:</span> <span class="value">${description}</span></div>
        <div><span class="label">Docs:</span> <span class="value"><a href="${wiki}" target="_blank">${wiki}</a></span></div>

        <h3>Available in Releases</h3>
        <table id="driver_info_releases_table" class="display"><thead><tr><th>Release</th><th>Tests&nbsp;Passed</th><th>Details</th></tr></thead>
        <tbody>
        {%each( release_id, value ) releases %}
            <tr>
                <td><span class="label capitalize">${release_id}</span></td>
                <td>
                    {%if value.ci_tested %}
                        {%if value.ci_result %}
                            <span style="color: green">&#x2714;</span>
                        {%else%}
                            <span style="color: red">&#x2716;</span>
                        {%/if%}
                    {%else%}
                        <span style="color: gray">&#x2753;</span>
                    {%/if%}
                </td>
                <td>
                    {%if value.ci_tested %}
                        <div class="line label">Verified <span class="timeago" title="${timestamp}">${timestamp}</span></div>
                        <div class="line">Latest review: <a href="${review_url}" target="_blank">${review_url}</a></div>
                        <div class="line message">${comment}</div>
                    {%else%}
                        <div class="line label">Not verified by CI</div>
                    {%/if%}
                </td>
            </tr>
        {%/each%}
        </tbody>
        </table>

        <h3>Maintainers</h3>

        {%each( index, user ) maintainers %}
            <div style="float: left;">
                {%if user.email %}
                    <div style="float: left;" class="gravatar" title="${user.email}"></div>
                {%elif user.launchpad_id %}
                    <div style="float: left;" class="gravatar" title="${user.launchpad_id}"></div>
                {%else%}
                    <div style="float: left;" class="gravatar" title="${user.name}"></div>
                {%/if%}
                <div style="margin-left: 80px; margin-right: 30px;">
                    <h4>${user.name}</h4>
                    {%if user.launchpad_id %}
                        <div><span class="label">Launchpad:</span> <a href="https://launchpad.net/~${user.launchpad_id}" target="_blank">${user.launchpad_id}</a></div>
                    {%/if%}
                    {%if user.email %}
                        <div><span class="label">Email:</span> ${user.email}</div>
                    {%/if%}
                    {%if user.irc %}
                        <div><span class="label">IRC:</span> ${user.irc}</div>
                    {%/if%}
                </div>
            </div>
        {%/each%}

    {% endraw %}
    </script>

</div>
</div>

{% endblock %}
