Skip to content

Commit

Permalink
Fixed scheduled job run history pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremycr committed Dec 18, 2024
1 parent d9b1a66 commit 28f76b2
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 74 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Version 4.2.0

* Added error count columns to job tables
* Fixed scheduled job run history pagination

# Version 4.1.2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@
e.preventDefault();
const loading = document.getElementById('loading_ezdataflow_history_results');
const results = document.getElementById('ezdataflow_history_results').querySelector('.ibexa-table');
const pagination = document.getElementById('ezdataflow_history_results').querySelector('.pag');
loading.hidden = false;
results.innerHTML = '';
pagination.innerHTML = '';
fetch('{{ path('coderhapsodie.ezdataflow.history') }}?filter=' + this.value)
.then((r) => r.text())
.then((content) => {
const node = document.createElement('div');
node.innerHTML = content;
results.innerHTML = node.querySelector('#ezdataflow_history_results .ibexa-table').innerHTML;
pagination.innerHTML = node.querySelector('#ezdataflow_history_results .pag').innerHTML;
loading.hidden = true;
})
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,33 @@
.closest('ul').querySelectorAll('li.ibexa-tabs__tab');
const tabs = document.getElementById('ibexa-tab-coderhapsodie-ezdataflow-code-rhapsodie-ezdataflow-repeating')
.closest('.tab-content').querySelectorAll('.tab-pane');
// Manage ajax pagination
document.addEventListener('click', (e) => {
const link = e.target.closest('.ibexa-pagination a');
if (!link) {
return;
}
const block = link.closest('.ibexa-pagination').parentNode.parentNode;
const display = block.querySelector('.ibexa-table');
const pagination = block.querySelector('.pag');
const loader = document.querySelector('#' + block.dataset.loader);
e.preventDefault();
loader.hidden = false;
display.innerHTML = '';
pagination.innerHTML = '';
fetch(link.href)
.then((r) => r.text())
.then((content) => {
const node = document.createElement('div');
node.innerHTML = content;
display.innerHTML = node.querySelector('#' + block.id).querySelector('.ibexa-table').innerHTML;
pagination.innerHTML = node.querySelector('#' + block.id).querySelector('.pag').innerHTML;
loader.hidden = true;
})
;
});
});
</script>
{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</svg>
</div>

<div id="{{ id }}" class="history-details-aware">
<div id="{{ id }}" data-loader="loading_{{ id }}" class="history-details-aware">

{% set body_rows = [] %}

Expand Down Expand Up @@ -80,40 +80,15 @@
{% endblock %}
{% endembed %}

{% if pager.haveToPaginate %}
{% include '@ibexadesign/ui/pagination.html.twig' with {
'pager': pager,
'paginaton_params': {
'routeName': paginate_route,
'routeParams': paginate_params|default({})
}
} %}
{% endif %}
<div class="pag">
{% if pager.haveToPaginate %}
{% include '@ibexadesign/ui/pagination.html.twig' with {
'pager': pager,
'paginaton_params': {
'routeName': paginate_route,
'routeParams': paginate_params|default({})
}
} %}
{% endif %}
</div>
</div>

<script>
document.addEventListener('DOMContentLoaded', () => {
// Manage ajax pagination
const display = document.getElementById('{{ id }}');
display.addEventListener('click', (e) => {
const link = e.target.closest('.ibexa-pagination a');
if (!link) {
return;
}
const loader = document.getElementById('loading_{{ id }}');
e.preventDefault();
loader.hidden = false;
display.innerHTML = '';
fetch(link.href)
.then((r) => r.text())
.then((content) => {
const node = document.createElement('div');
node.innerHTML = content;
display.innerHTML = node.querySelector('#{{ id }}').innerHTML;
loader.hidden = true;
})
;
});
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</svg>
</div>

<div id="{{ id }}" class="history-details-aware">
<div id="{{ id }}" data-loader="loading_{{ id }}" class="history-details-aware">
{% set body_rows = [] %}

{% for item in pager.currentPageResults %}
Expand Down Expand Up @@ -113,40 +113,15 @@
{% endblock %}
{% endembed %}

{% if pager.haveToPaginate %}
{% include '@ibexadesign/ui/pagination.html.twig' with {
'pager': pager,
'paginaton_params': {
'routeName': paginate_route,
'routeParams': paginate_params|default({})
}
} %}
{% endif %}
<div class="pag">
{% if pager.haveToPaginate %}
{% include '@ibexadesign/ui/pagination.html.twig' with {
'pager': pager,
'paginaton_params': {
'routeName': paginate_route,
'routeParams': paginate_params|default({})
}
} %}
{% endif %}
</div>
</div>

<script>
document.addEventListener('DOMContentLoaded', () => {
// Manage ajax pagination
const display = document.getElementById('{{ id }}');
display.addEventListener('click', (e) => {
const link = e.target.closest('.ibexa-pagination a');
if (!link) {
return;
}
const loader = document.getElementById('loading_{{ id }}');
e.preventDefault();
loader.hidden = false;
display.innerHTML = '';
fetch(link.href)
.then((r) => r.text())
.then((content) => {
const node = document.createElement('div');
node.innerHTML = content;
display.innerHTML = node.querySelector('#{{ id }}').innerHTML;
loader.hidden = true;
})
;
});
});
</script>

0 comments on commit 28f76b2

Please sign in to comment.