small fix to render category name in templates

This commit is contained in:
Davide Arcuri 2020-03-18 08:47:53 +01:00
parent a47a060763
commit 944afb608d
2 changed files with 6 additions and 5 deletions

View File

@ -62,9 +62,12 @@ class AbuseIPDBAnalyzer(Analyzer):
if 'reports' in response["data"]:
categories_strings = []
for item in response["data"]["reports"]:
item['categories_strings'] = []
for category in item["categories"]:
if self.extract_abuse_ipdb_category(category) not in categories_strings:
categories_strings.append(self.extract_abuse_ipdb_category(category))
category_as_str = self.extract_abuse_ipdb_category(category)
item['categories_strings'].append(category_as_str)
if category_as_str not in categories_strings:
categories_strings.append(category_as_str)
response['categories_strings'] = categories_strings
self.report({'values': response_list})

View File

@ -12,7 +12,6 @@
<th>Country</th>
<th>Whitelisted</th>
<th>Categories</th>
</tr>
</thead>
<tbody>
@ -24,9 +23,8 @@
<td>{{r.reporterCountryName}}</td>
<td>{{content.values[0].data.isWhitelisted}}</td>
<td>
<span ng-repeat="c in r.categories"><span class="label label-primary">{{c}}</span> </span>
<span ng-repeat="c in r.categories_strings"><span class="label label-primary">{{c}}</span> </span>
</td>
</tr>
</tbody>
</table>