mirror of https://github.com/MISP/MISP
new: [galaxyCluster:index] Added badge showing number of custom clusters
parent
8b2cea7cdc
commit
a890ff1021
|
@ -162,6 +162,13 @@ class GalaxyClustersController extends AppController
|
|||
$clusters[$k]['csv'] = $csv[$k];
|
||||
}
|
||||
}
|
||||
$customClusterCount = $this->GalaxyCluster->fetchGalaxyClusters($this->Auth->user(), [
|
||||
'count' => true,
|
||||
'conditions' => [
|
||||
'AND' => [$searchConditions, $aclConditions],
|
||||
'GalaxyCluster.default' => 0,
|
||||
]
|
||||
]);
|
||||
$this->loadModel('Attribute');
|
||||
$distributionLevels = $this->Attribute->distributionLevels;
|
||||
unset($distributionLevels[5]);
|
||||
|
@ -169,6 +176,7 @@ class GalaxyClustersController extends AppController
|
|||
$this->set('csv', $csv);
|
||||
$this->set('list', $clusters);
|
||||
$this->set('galaxy_id', $galaxyId);
|
||||
$this->set('custom_cluster_count', $customClusterCount);
|
||||
}
|
||||
if ($this->request->is('ajax')) {
|
||||
$this->layout = 'ajax';
|
||||
|
|
|
@ -975,6 +975,9 @@ class GalaxyCluster extends AppModel
|
|||
$clusters = array();
|
||||
if (isset($options['first']) && $options['first']) {
|
||||
$clusters = $this->find('first', $params);
|
||||
} else if (isset($options['count']) && $options['count']) {
|
||||
$clusterCount = $this->find('count', $params);
|
||||
return $clusterCount;
|
||||
} else {
|
||||
$clusters = $this->find('all', $params);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
}
|
||||
$dataFields = implode(' ', $dataFields);
|
||||
echo sprintf(
|
||||
'<a class="btn btn-small %s %s" %s href="%s" %s %s %s %s %s>%s%s%s</a>',
|
||||
'<a class="btn btn-small %s %s" %s href="%s" %s %s %s %s %s>%s%s%s %s</a>',
|
||||
empty($data['class']) ? '' : h($data['class']),
|
||||
empty($data['active']) ? 'btn-inverse' : 'btn-primary', // Change the default class for highlighted/active toggles here
|
||||
empty($data['id']) ? '' : 'id="' . h($data['id']) . '"',
|
||||
|
@ -50,7 +50,8 @@
|
|||
$data['fa-icon']
|
||||
), // this has to be sanitised beforehand!
|
||||
empty($data['html']) ? '' : $data['html'], // this has to be sanitised beforehand!
|
||||
empty($data['text']) ? '' : h($data['text'])
|
||||
empty($data['text']) ? '' : h($data['text']),
|
||||
empty($data['badge']) ? '' : sprintf('<span class="badge badge-%s">%s</span>', empty($data['badge']['type']) ? 'info' : $data['badge']['type'], h($data['badge']['text']))
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
'active' => $context === 'custom',
|
||||
'url' => sprintf('%s/galaxies/view/%s/context:custom', $baseurl, $galaxy_id),
|
||||
'text' => __('Custom'),
|
||||
'badge' => [
|
||||
'type' => 'info',
|
||||
'text' => $custom_cluster_count
|
||||
]
|
||||
),
|
||||
array(
|
||||
'active' => $context === 'org',
|
||||
|
|
Loading…
Reference in New Issue