mirror of https://github.com/MISP/MISP
fix: [UI] Pagination for event reports in event view
parent
4261ec9fd9
commit
657253ea72
|
@ -35,13 +35,15 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
$paginationData = !empty($data['paginatorOptions']) ? $data['paginatorOptions'] : [];
|
||||
if ($ajax && isset($containerId)) {
|
||||
$paginationData['data-paginator'] = "#{$containerId}_content";
|
||||
}
|
||||
$this->Paginator->options($paginationData);
|
||||
|
||||
$skipPagination = isset($data['skip_pagination']) ? $data['skip_pagination'] : 0;
|
||||
if (!$skipPagination) {
|
||||
$paginationData = !empty($data['paginatorOptions']) ? $data['paginatorOptions'] : array();
|
||||
if ($ajax && isset($containerId)) {
|
||||
$paginationData['data-paginator'] = "#{$containerId}_content";
|
||||
}
|
||||
$this->Paginator->options($paginationData);
|
||||
$paginatonLinks = $this->element('/genericElements/IndexTable/pagination_links');
|
||||
echo $paginatonLinks;
|
||||
}
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
<?php endif; ?>
|
||||
<?php
|
||||
echo $this->element('/genericElements/IndexTable/index_table', array(
|
||||
'paginatorOptions' => array(
|
||||
'update' => '#eventreport_index_div',
|
||||
),
|
||||
'containerId' => 'eventreport',
|
||||
'data' => array(
|
||||
'data' => $reports,
|
||||
'top_bar' => array(
|
||||
|
@ -165,7 +163,7 @@
|
|||
|
||||
$('#eventReportSelectors a.btn').click(function(e) {
|
||||
e.preventDefault()
|
||||
$("#eventreport_index_div").empty()
|
||||
$("#eventreport_content").empty()
|
||||
.append(
|
||||
$('<div></div>')
|
||||
.css({'text-align': 'center', 'font-size': 'large', 'margin': '5px 0'})
|
||||
|
@ -173,7 +171,7 @@
|
|||
)
|
||||
var url = $(this).attr('href')
|
||||
$.get(url, function(data) {
|
||||
$("#eventreport_index_div").html(data);
|
||||
$("#eventreport_content").html(data);
|
||||
});
|
||||
});
|
||||
})
|
||||
|
@ -183,7 +181,7 @@
|
|||
$.ajax({
|
||||
dataType: "html",
|
||||
beforeSend: function() {
|
||||
$("#eventreport_index_div").empty()
|
||||
$("#eventreport_content").empty()
|
||||
.append(
|
||||
$('<div></div>')
|
||||
.css({'text-align': 'center', 'font-size': 'large', 'margin': '5px 0'})
|
||||
|
@ -191,10 +189,10 @@
|
|||
)
|
||||
},
|
||||
success:function (data) {
|
||||
$("#eventreport_index_div").html(data);
|
||||
$("#eventreport_content").html(data);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
$("#eventreport_index_div").empty().text('<?= __('Failed to load Event report table')?>')
|
||||
$("#eventreport_content").empty().text('<?= __('Failed to load Event report table')?>')
|
||||
showMessage('fail', textStatus + ": " + errorThrown);
|
||||
},
|
||||
url:url
|
||||
|
|
|
@ -527,7 +527,7 @@
|
|||
</div>
|
||||
<div id="eventreport_div" style="display: none;">
|
||||
<span class="report-title-section"><?php echo __('Event Reports');?></span>
|
||||
<div id="eventreport_index_div"></div>
|
||||
<div id="eventreport_content"></div>
|
||||
</div>
|
||||
<div id="clusterrelation_div" class="info_container_eventgraph_network" style="display: none;" data-fullscreen="false">
|
||||
</div>
|
||||
|
@ -554,8 +554,8 @@ $(function () {
|
|||
});
|
||||
|
||||
$.get("<?php echo $baseurl; ?>/eventReports/index/event_id:<?= h($event['Event']['id']); ?>/index_for_event:1<?= $extended ? '/extended_event:1' : ''?>", function(data) {
|
||||
$("#eventreport_index_div").html(data);
|
||||
if ($('#eventreport_index_div table tbody > tr').length) { // open if contain a report
|
||||
$("#eventreport_content").html(data);
|
||||
if ($('#eventreport_content table tbody > tr').length) { // open if contain a report
|
||||
$('#eventreport_toggle').click()
|
||||
}
|
||||
});
|
||||
|
|
|
@ -96,14 +96,12 @@
|
|||
<div class="row-fuild">
|
||||
<div id="relations_container"></div>
|
||||
</div>
|
||||
<div class="">
|
||||
<div id="elements_div"></div>
|
||||
</div>
|
||||
<div id="elements_content"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$.get("<?= $baseurl ?>/galaxy_elements/index/<?php echo $cluster['GalaxyCluster']['id']; ?>", function(data) {
|
||||
$("#elements_div").html(data);
|
||||
$("#elements_content").html(data);
|
||||
});
|
||||
$.get("<?= $baseurl ?>/galaxy_clusters/viewGalaxyMatrix/<?php echo $cluster['GalaxyCluster']['id']; ?>", function(data) {
|
||||
$("#matrix_container").html(data);
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
$indexOptions = array(
|
||||
'containerId' => 'elements',
|
||||
'data' => array(
|
||||
'paginatorOptions' => array(
|
||||
'update' => '#elements_div',
|
||||
),
|
||||
'data' => $elements,
|
||||
'top_bar' => array(
|
||||
'children' => array(
|
||||
|
@ -16,7 +14,7 @@ $indexOptions = array(
|
|||
'onClickParams' => [
|
||||
h($clusterId) . '/context:all',
|
||||
$baseurl . '/galaxy_elements/index',
|
||||
'#elements_div'
|
||||
'#elements_content'
|
||||
],
|
||||
),
|
||||
array(
|
||||
|
@ -26,7 +24,7 @@ $indexOptions = array(
|
|||
'onClickParams' => [
|
||||
h($clusterId) . '/context:JSONView',
|
||||
$baseurl . '/galaxy_elements/index',
|
||||
'#elements_div'
|
||||
'#elements_content'
|
||||
],
|
||||
),
|
||||
)
|
||||
|
@ -87,8 +85,6 @@ echo $this->element('/genericElements/IndexTable/index_table', $indexOptions);
|
|||
if ($context == 'JSONView') {
|
||||
echo sprintf('<div id="elementJSONDiv" class="well well-small">%s</div>', json_encode($JSONElements));
|
||||
}
|
||||
|
||||
echo $this->Js->writeBuffer();
|
||||
?>
|
||||
|
||||
<script>
|
||||
|
@ -96,4 +92,4 @@ echo $this->Js->writeBuffer();
|
|||
if ($jsondiv.length > 0) {
|
||||
$jsondiv.html(syntaxHighlightJson($jsondiv.text(), 8));
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue