mirror of https://github.com/MISP/MISP
chg: [galaxyClusterRelations:add] Added picker for relation type
parent
3fe41cd22d
commit
fb479d4b72
|
@ -174,6 +174,8 @@ class GalaxyClusterRelationsController extends AppController
|
|||
}
|
||||
}
|
||||
}
|
||||
$existingRelations = $this->GalaxyClusterRelation->getExistingRelationships();
|
||||
$this->set('existingRelations', $existingRelations);
|
||||
$this->set('distributionLevels', $distributionLevels);
|
||||
$this->set('initialDistribution', $initialDistribution);
|
||||
$this->set('sharingGroups', $sgs);
|
||||
|
|
|
@ -41,6 +41,10 @@
|
|||
'label' => __('Relationship Type'),
|
||||
'placeholder' => __('is-similar'),
|
||||
'type' => 'text',
|
||||
'picker' => array(
|
||||
'text' => __('Pick type'),
|
||||
'function' => 'pickerTypes',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'field' => 'tags',
|
||||
|
@ -67,6 +71,8 @@
|
|||
checkSharingGroup('GalaxyClusterRelation');
|
||||
});
|
||||
|
||||
existingRelationTypes = <?= json_encode(array_values($existingRelations)) ?> ;
|
||||
|
||||
$(document).ready(function() {
|
||||
checkSharingGroup('GalaxyClusterRelation');
|
||||
$('[data-toggle=\"json\"]').each(function() {
|
||||
|
@ -97,6 +103,25 @@
|
|||
var target_type = 'galaxyClusterRelation';
|
||||
popoverPopup(this, target_id + '/' + target_type, 'tags', 'selectTaxonomy')
|
||||
}
|
||||
function pickerTypes() {
|
||||
var $select = $('<select id="pickerTypeSelect"/>');
|
||||
existingRelationTypes.forEach(function(type) {
|
||||
$select.append($('<option/>').val(type).text(type))
|
||||
})
|
||||
var html = '<div>' + $select[0].outerHTML + '</div>';
|
||||
var that = this
|
||||
openPopover(this, html, false, 'right', function($popover) {
|
||||
$popover.find('select').chosen({
|
||||
width: '300px',
|
||||
}).on('change', function(evt, param) {
|
||||
addPickedTypes()
|
||||
$(that).popover('hide')
|
||||
});
|
||||
});
|
||||
}
|
||||
function addPickedTypes() {
|
||||
$('#GalaxyClusterRelationReferencedGalaxyClusterType').val($('#pickerTypeSelect').val());
|
||||
}
|
||||
function setSourceUUIDAfterSelect(selected, additionalData) {
|
||||
selectedUUID = additionalData.itemOptions[selected].uuid;
|
||||
$('#GalaxyClusterRelationGalaxyClusterUuid').val(selectedUUID);
|
||||
|
|
Loading…
Reference in New Issue