mirror of https://github.com/MISP/MISP
new: [galaxies] adding galaxies no longer needs a full refresh of the page
- use the new ajax function to get the galaxy information returnedpull/3989/head
parent
c99f54328b
commit
1280d20d5a
|
@ -163,7 +163,7 @@
|
|||
);
|
||||
}
|
||||
?>
|
||||
<td class="short">
|
||||
<td class="short" id="attribute_<?php echo h($object['id']); ?>_galaxy">
|
||||
<?php
|
||||
echo $this->element('galaxyQuickViewMini', array(
|
||||
'mayModify' => $mayModify,
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
<?php
|
||||
$mayModify = (($isAclModify && $event['Event']['user_id'] == $me['id'] && $event['Event']['orgc_id'] == $me['org_id']) || ($isAclModifyOrg && $event['Event']['orgc_id'] == $me['org_id']));
|
||||
echo $this->element('ajaxTags', array('event' => $event, 'tags' => $tags, 'tagAccess' => ($isSiteAdmin || $mayModify || $me['org_id'] == $event['Event']['org_id'])));
|
||||
$mayModify = (
|
||||
($isAclModify && $event['Event']['user_id'] == $me['id'] && $event['Event']['orgc_id'] == $me['org_id']) ||
|
||||
($isAclModifyOrg && $event['Event']['orgc_id'] == $me['org_id'])
|
||||
);
|
||||
echo $this->element('ajaxTags', array(
|
||||
'event' => $event,
|
||||
'tags' => $tags,
|
||||
'tagAccess' => ($isSiteAdmin || $mayModify)
|
||||
));
|
||||
?>
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
});
|
||||
|
||||
$('.clusterSelectChoice').click(function() {
|
||||
quickSubmitGalaxyForm($(this).data('target-type') + '/' + $(this).data('target-id'), $(this).data('cluster-id'));
|
||||
quickSubmitGalaxyForm($(this).data('target-id'), $(this).data('cluster-id'), $(this).data('target-type'));
|
||||
});
|
||||
$('#clusterFilterField').keyup(function() {
|
||||
var filterString = $("#clusterFilterField").val().toLowerCase();
|
||||
|
|
|
@ -888,6 +888,21 @@ function loadEventTags(id) {
|
|||
});
|
||||
}
|
||||
|
||||
function loadGalaxies(id, scope) {
|
||||
$.ajax({
|
||||
dataType:"html",
|
||||
cache: false,
|
||||
success:function (data, textStatus) {
|
||||
if (scope == 'event') {
|
||||
$("#galaxies_div").html(data);
|
||||
} else if ($scope == 'attribute') {
|
||||
$("#attribute_" + id + "_galaxy").html(data);
|
||||
}
|
||||
},
|
||||
url:"/galaxies/showGalaxies/" + id + "/" + scope,
|
||||
});
|
||||
}
|
||||
|
||||
function loadTagCollectionTags(id) {
|
||||
$.ajax({
|
||||
dataType:"html",
|
||||
|
@ -3276,9 +3291,29 @@ function addGalaxyListener(id) {
|
|||
getPopup(target_type + '/' + target_id, 'galaxies', 'selectGalaxyNamespace');
|
||||
}
|
||||
|
||||
function quickSubmitGalaxyForm(event_id, cluster_id) {
|
||||
function quickSubmitGalaxyForm(scope, cluster_id, event_id) {
|
||||
$('#GalaxyTargetId').val(cluster_id);
|
||||
$('#GalaxySelectClusterForm').submit();
|
||||
$.ajax({
|
||||
data: $('#GalaxySelectClusterForm').closest("form").serialize(),
|
||||
beforeSend: function (XMLHttpRequest) {
|
||||
$(".loading").show();
|
||||
},
|
||||
success:function (data, textStatus) {
|
||||
loadGalaxies(event_id, scope);
|
||||
handleGenericAjaxResponse(data);
|
||||
},
|
||||
error:function() {
|
||||
showMessage('fail', 'Could not add cluster.');
|
||||
loadGalaxies(event_id, scope);
|
||||
},
|
||||
complete:function() {
|
||||
$("#popover_form").fadeOut();
|
||||
$("#gray_out").fadeOut();
|
||||
$(".loading").hide();
|
||||
},
|
||||
type:"post",
|
||||
url: "/galaxies/attachCluster/" + event_id + "/" + scope
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue