| |
@@ -475,8 +475,8 @@
|
| |
{% endmacro %}
|
| |
|
| |
|
| |
- {% macro render_monitor_table(copr, monitor, oses, archs, simple=True) %}
|
| |
- <table class="table table-striped table-bordered">
|
| |
+ {% macro render_monitor_table(copr, pagination, oses, archs, simple=True) %}
|
| |
+ <table class="table table-striped table-bordered dataTable">
|
| |
<thead>
|
| |
<tr>
|
| |
<th rowspan="2">Package</th>
|
| |
@@ -492,56 +492,41 @@
|
| |
</thead>
|
| |
<tbody>
|
| |
<tr>
|
| |
- {# The following code is optimized to pass (potentially large) monitor data just once. #}
|
| |
- {# It expects results to be sorted by package.name and then mock_chroot.name. #}
|
| |
+ {# This table should be sorted by package name #}
|
| |
{% set current_row = [None] %}
|
| |
{% set copr_active_chroots_sorted = copr.active_chroots_sorted %}
|
| |
{% set copr_active_chroots_sorted_length = copr_active_chroots_sorted|length %}
|
| |
{#% set copr_active_chroots_sorted_index = copr_active_chroots_sorted_length %#} {# we need to set this var from an inner scope, which is unsupported, hence the following list-as-a-counter hacks: #}
|
| |
{% set copr_active_chroots_sorted_index = [1]*copr_active_chroots_sorted_length %}
|
| |
|
| |
- {% for row in monitor %}
|
| |
- {% if row.package_name != current_row[0] %}
|
| |
- {% for _ in range(copr_active_chroots_sorted_index|length, copr_active_chroots_sorted_length) %} {# "do" tag would help but just a tiny bit (so no enabling) #}
|
| |
- <td>-</td>
|
| |
- {% endfor %}
|
| |
- </tr><tr>
|
| |
+ </tr>
|
| |
|
| |
+ {% for package in pagination.items %}
|
| |
+ <tr>
|
| |
<td style="white-space:nowrap">
|
| |
- <b><a href="{{ copr_url('coprs_ns.copr_package', copr, package_name=row.package_name) }}">
|
| |
- {{ row.package_name }}
|
| |
+ <b><a href="{{ copr_url('coprs_ns.copr_package', copr, package_name=package.name) }}">
|
| |
+ {{ package.name }}
|
| |
</a></b>
|
| |
</td>
|
| |
- {% set _ = current_row.pop() %}
|
| |
- {% set _ = current_row.append(row.package_name) %}
|
| |
- {#% set copr_active_chroots_sorted_index = 0 %#}
|
| |
- {% for _ in range(copr_active_chroots_sorted_index|length) %}{% if copr_active_chroots_sorted_index.remove(1) %}{% endif %}{% endfor %}
|
| |
- {% endif %}
|
| |
-
|
| |
- {% for index in range(copr_active_chroots_sorted_index|length, copr_active_chroots_sorted_length) %}
|
| |
- {% if row.mock_chroot_id == copr_active_chroots_sorted[index].id %}
|
| |
- {% for _ in range(copr_active_chroots_sorted_index|length, index) %}
|
| |
- <td>-</td>
|
| |
- {% endfor %}
|
| |
- <td>
|
| |
- <a href="{{ copr_url("coprs_ns.copr_build", copr, build_id=row.build_id) }}">
|
| |
- {% if simple %}
|
| |
- {{ build_state_text(row.build_chroot_status|state_from_num) }}
|
| |
- {% else %}
|
| |
- <small> {{ row.build_id }} </small> <br>
|
| |
- {{ build_state_text(row.build_chroot_status|state_from_num) }}<br>
|
| |
- <small class="text-muted"> {{ row.build_pkg_version }} </small>
|
| |
- {% endif %}
|
| |
- </a>
|
| |
- </td>
|
| |
- {#% set copr_active_chroots_sorted_index = index + 1 %#}
|
| |
- {% for _ in range(copr_active_chroots_sorted_index|length, index+1) %}
|
| |
- {% if copr_active_chroots_sorted_index.append(1) %}{% endif %}
|
| |
- {% endfor %}
|
| |
- {% set index = copr_active_chroots_sorted_length %}
|
| |
- {% endif %}
|
| |
- {% endfor %}
|
| |
|
| |
+ {% for buildchroot in package.latest_build_chroots %}
|
| |
+ <td>
|
| |
+ {% if buildchroot %}
|
| |
+ <a href="{{ copr_url("coprs_ns.copr_build", copr, build_id=buildchroot.build_id) }}">
|
| |
+ {% if simple %}
|
| |
+ {{ build_state_text(buildchroot.status|state_from_num) }}
|
| |
+ {% else %}
|
| |
+ <small> {{ buildchroot.build_id }} </small> <br>
|
| |
+ {{ build_state_text(buildchroot.status|state_from_num) }}<br>
|
| |
+ <small class="text-muted"> {{ buildchroot.build.pkg_version }} </small>
|
| |
+ {% endif %}
|
| |
+ </a>
|
| |
+ {% else %}
|
| |
+ -
|
| |
+ {% endif %}
|
| |
+ </td>
|
| |
+ {% endfor %}
|
| |
+ </tr>
|
| |
{% endfor %}
|
| |
|
| |
{% for _ in range(copr_active_chroots_sorted_index|length, copr_active_chroots_sorted_length) %} {# "do" tag would help but just a tiny bit (so no enabling) #}
|
| |
@@ -550,6 +535,10 @@
|
| |
</tr>
|
| |
</tbody>
|
| |
</table>
|
| |
+
|
| |
+ {% if pagination.serverside_pagination %}
|
| |
+ {{ pagination_form(pagination) }}
|
| |
+ {% endif %}
|
| |
{% endmacro %}
|
| |
|
| |
{% macro render_bootstrap_options(form, build=False) %}
|
| |
@@ -866,3 +855,39 @@
|
| |
</td>
|
| |
</tr>
|
| |
{% endmacro %}
|
| |
+
|
| |
+
|
| |
+ {% macro pagination_form(pagination) %}
|
| |
+ <form class="content-view-pf-pagination table-view-pf-pagination clearfix"
|
| |
+ id="pagination" method="post" action="{{ current_url() }}">
|
| |
+ <div class="form-group">
|
| |
+ <span>
|
| |
+ <span class="pagination-pf-items-current">
|
| |
+ {{ pagination.per_page*(pagination.page -1) + 1}} -
|
| |
+ {{ pagination.per_page*(pagination.page) }}
|
| |
+ </span>
|
| |
+ of
|
| |
+ <span class="pagination-pf-items-total">{{ pagination.total }}</span></span>
|
| |
+ <ul class="pagination pagination-pf-back">
|
| |
+ <li {% if not pagination.has_prev %}class="disabled"{% endif %}><a href="{{ current_url(page=1) }}" title="First Page"><span class="i fa fa-angle-double-left"></span></a></li>
|
| |
+ <li {% if not pagination.has_prev %}class="disabled"{% endif %}><a href="{{ current_url(page=pagination.page - 1) }}" title="Previous Page"><span class="i fa fa-angle-left"></span></a></li>
|
| |
+ </ul>
|
| |
+ <label for="pagination1-page" class="sr-only">Current Page</label>
|
| |
+ <input class="pagination-pf-page" name="go_to_page" type="text" value="{{ pagination.page }}" id="go_to_page" style="width: 3.5em;" />
|
| |
+ <span>of <span class="pagination-pf-pages">{{ pagination.pages }}</span></span>
|
| |
+ <ul class="pagination pagination-pf-forward">
|
| |
+ <li {% if not pagination.has_next %}class="disabled"{% endif %}><a href="{{ current_url(page=pagination.page + 1) }}" title="Next Page"><span class="i fa fa-angle-right"></span></a></li>
|
| |
+ <li {% if not pagination.has_next %}class="disabled"{% endif %}><a href="{{ current_url(page=pagination.pages) }}" title="Last Page"><span class="i fa fa-angle-double-right"></span></a></li>
|
| |
+ </ul>
|
| |
+ </div>
|
| |
+ </form>
|
| |
+
|
| |
+ {% endmacro %}
|
| |
+
|
| |
+ {% macro serverside_pagination_warning() %}
|
| |
+ <p> Warning!
|
| |
+ This is a large project with many packages and/or builds - we can not hold all
|
| |
+ the requested data on one page (as we usually do), please use the pagination
|
| |
+ buttons below the table.
|
| |
+ </p>
|
| |
+ {% endmacro %}
|
| |