mirror of https://github.com/MISP/MISP
chg: [distribution-graph] Optimise loading
parent
37acdc21fa
commit
6e2c15ff60
|
@ -4330,8 +4330,8 @@ class EventsController extends AppController
|
|||
$grapher = new DistributionGraphTool();
|
||||
|
||||
$this->loadModel('Server');
|
||||
$servers = $this->Server->find('list', array(
|
||||
'fields' => array('name'),
|
||||
$servers = $this->Server->find('column', array(
|
||||
'fields' => array('Server.name'),
|
||||
));
|
||||
$grapher->construct($this->Event, $servers, $this->Auth->user(), $extended);
|
||||
$json = $grapher->get_distributions_graph($id);
|
||||
|
|
|
@ -87,16 +87,15 @@ class DistributionGraphTool
|
|||
// community
|
||||
$orgConditions = $this->__organisationModel->createConditions($this->__user);
|
||||
$orgConditions['local'] = true;
|
||||
$orgs = $this->__organisationModel->find('list', array(
|
||||
'fields' => ['id', 'name'],
|
||||
$orgConditions['id !='] = $this->__user['Organisation']['id'];
|
||||
$orgs = $this->__organisationModel->find('column', array(
|
||||
'fields' => ['name'],
|
||||
'conditions' => $orgConditions,
|
||||
));
|
||||
$thisOrg = $this->__user['Organisation']['name'];
|
||||
$this->__addAdditionalDistributionInfo(1, $thisOrg); // add current community
|
||||
foreach ($orgs as $orgId => $orgName) {
|
||||
if ($thisOrg != $orgName) {
|
||||
$this->__addAdditionalDistributionInfo(1, $orgName);
|
||||
}
|
||||
foreach ($orgs as $orgName) {
|
||||
$this->__addAdditionalDistributionInfo(1, $orgName);
|
||||
}
|
||||
|
||||
// org only
|
||||
|
|
|
@ -4,7 +4,6 @@ var event_distribution = $eventDistriGraph.data('event-distribution');
|
|||
var event_distribution_text = $eventDistriGraph.data('event-distribution-text');
|
||||
var extended_text = $eventDistriGraph.data('extended') == 1 ? true : false;
|
||||
var spanOffset_orig = 15; // due to padding
|
||||
var payload = {};
|
||||
var distribution_chart;
|
||||
var distributionData;
|
||||
|
||||
|
@ -387,13 +386,9 @@ function construct_piechart(data) {
|
|||
|
||||
function fetchDistributionData(callback) {
|
||||
$.ajax({
|
||||
url: baseurl + "/events/"+"getDistributionGraph"+"/"+scope_id+"/event.json",
|
||||
dataType: 'json',
|
||||
type: 'post',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify( payload ),
|
||||
processData: false,
|
||||
beforeSend: function (XMLHttpRequest) {
|
||||
url: baseurl + "/events/getDistributionGraph/"+scope_id+"/event.json",
|
||||
type: 'get',
|
||||
beforeSend: function () {
|
||||
$(".loadingPopover").show();
|
||||
},
|
||||
success: function( data, textStatus, jQxhr ){
|
||||
|
|
Loading…
Reference in New Issue