fix: [UI] Broken tag attaching

pull/7859/head
Jakub Onderka 2021-10-18 17:27:58 +02:00
parent 934fa326f9
commit 4f31876890
5 changed files with 26 additions and 24 deletions

View File

@ -252,7 +252,7 @@ jobs:
poetry add lxml
poetry run python ../tests/testlive_security.py -v
poetry run python ../tests/testlive_sync.py
poetry run python ../tests/testlive_comprehensive_local.py
poetry run python ../tests/testlive_comprehensive_local.py -v
poetry run python tests/test_mispevent.py
popd
cp PyMISP/tests/keys.py PyMISP/examples/events/

View File

@ -7,6 +7,7 @@ echo '<div class="index">';
echo $this->element('/genericElements/IndexTable/index_table', [
'data' => [
'title' => __('Attributes'),
'primary_id_path' => 'Attribute.id',
'data' => $attributes,
'fields' => [
[

View File

@ -6,8 +6,7 @@ $mayModify = ($isSiteAdmin || ($isAclModify && $event['user_id'] == $me['id'] &&
$objectId = intval($attribute['id']);
?>
<div id="Attribute_<?= $objectId ?>" class="attributeTagContainer">
<div class="attributeTagContainer">
<?php echo $this->element(
'ajaxTags',
array(
@ -21,7 +20,6 @@ $objectId = intval($attribute['id']);
)
); ?>
</div>
<?php
if (!empty($includeRelatedTags)) {
$element = '';

View File

@ -70,23 +70,25 @@
if (!empty($data['primary_id_path'])) {
$primary = Hash::extract($data_row, $data['primary_id_path'])[0];
}
$rows .= sprintf(
'<tr data-row-id="%s" %s %s>%s</tr>',
h($k),
empty($dblclickActionArray) ? '' : 'class="dblclickElement"',
empty($primary) ? '' : 'data-primary-id="' . $primary . '"',
$this->element(
'/genericElements/IndexTable/' . $row_element,
array(
'k' => $k,
'row' => $data_row,
'fields' => $data['fields'],
'options' => $options,
'actions' => $actions,
'primary' => $primary
)
)
);
$row = '<tr data-row-id="' . h($k) . '"';
if (!empty($dblclickActionArray)) {
$row .= ' class="dblclickElement"';
}
if (!empty($primary)) {
$row .= ' data-primary-id="' . $primary . '"';
}
$row .= '>';
$row .= $this->element('/genericElements/IndexTable/' . $row_element, [
'k' => $k,
'row' => $data_row,
'fields' => $data['fields'],
'options' => $options,
'actions' => $actions,
'primary' => $primary,
]);
$rows .= $row;
}
$tbody = '<tbody>' . $rows . '</tbody>';
echo sprintf(

View File

@ -1132,10 +1132,11 @@ function removeEventTag(event, tag) {
function loadAttributeTags(id) {
$.ajax({
dataType:"html",
dataType: "html",
cache: false,
success:function (data) {
$("#Attribute_"+id+".attributeTagContainer").html(data);
success: function (data) {
// different approach for event view and attribute view
$("#Attribute_" + id + "_tr .attributeTagContainer, [data-primary-id=" + id + "] .attributeTagContainer").html(data);
},
error: xhrFailCallback,
url: baseurl + "/tags/showAttributeTag/" + id