From 482adaabc0b3832df418751fdede98d214bd0d99 Mon Sep 17 00:00:00 2001 From: Nabil Adouani Date: Thu, 3 Jun 2021 18:02:23 +0200 Subject: [PATCH] #2055 Make alert tags and description editable --- .../controllers/alert/AlertEventCtrl.js | 16 +++++++++- frontend/app/views/directives/flow/alert.html | 23 ++++++++++----- .../views/directives/updatable-tag-list.html | 8 +++-- .../views/partials/alert/event.dialog.html | 29 ++++++++++++++++--- 4 files changed, 60 insertions(+), 16 deletions(-) diff --git a/frontend/app/scripts/controllers/alert/AlertEventCtrl.js b/frontend/app/scripts/controllers/alert/AlertEventCtrl.js index 0f89cddab1..ff541d6bd3 100644 --- a/frontend/app/scripts/controllers/alert/AlertEventCtrl.js +++ b/frontend/app/scripts/controllers/alert/AlertEventCtrl.js @@ -1,7 +1,7 @@ (function () { 'use strict'; angular.module('theHiveControllers') - .controller('AlertEventCtrl', function ($scope, $rootScope, $state, $uibModal, $uibModalInstance, ModalUtilsSrv, AuthenticationSrv, CustomFieldsSrv, CaseResolutionStatus, AlertingSrv, NotificationSrv, UiSettingsSrv, clipboard, event, templates, readonly) { + .controller('AlertEventCtrl', function ($scope, $rootScope, $state, $uibModal, $uibModalInstance, ModalUtilsSrv, TagSrv, AuthenticationSrv, CustomFieldsSrv, CaseResolutionStatus, AlertingSrv, NotificationSrv, UiSettingsSrv, clipboard, event, templates, readonly) { var self = this; var eventId = event._id; @@ -35,6 +35,20 @@ return 'customFields.' + fieldDef.reference + '.' + fieldDef.type; }; + self.getTags = function (selection) { + var tags = []; + + angular.forEach(selection, function (tag) { + tags.push(tag.text); + }); + + return tags; + }; + + self.getAlertTags = function (query) { + return TagSrv.autoComplete(query); + }; + self.load = function () { AlertingSrv.get(eventId).then(function (data) { self.event = data; diff --git a/frontend/app/views/directives/flow/alert.html b/frontend/app/views/directives/flow/alert.html index c6cb860356..ea566076fd 100644 --- a/frontend/app/views/directives/flow/alert.html +++ b/frontend/app/views/directives/flow/alert.html @@ -1,4 +1,4 @@ -
+
Alert updates @@ -7,23 +7,27 @@
- +
- + +
- + +
-
- +
+
{{k}}: {{v.length}} @@ -39,6 +43,9 @@
{{k}}: {{v}}
+
+ description: {{v | limitTo: 250}} +
{{k}}: diff --git a/frontend/app/views/directives/updatable-tag-list.html b/frontend/app/views/directives/updatable-tag-list.html index 71d16cc082..0432453379 100644 --- a/frontend/app/views/directives/updatable-tag-list.html +++ b/frontend/app/views/directives/updatable-tag-list.html @@ -12,9 +12,11 @@
- - + + +
diff --git a/frontend/app/views/partials/alert/event.dialog.html b/frontend/app/views/partials/alert/event.dialog.html index 64c2171363..27512e2e07 100644 --- a/frontend/app/views/partials/alert/event.dialog.html +++ b/frontend/app/views/partials/alert/event.dialog.html @@ -41,23 +41,44 @@

{{dialog.event.source}}

-
+ + +
+

+ Basic Information +

+
+
Tags
+
+ +
+
+ +
+
-
+

Description

-
+
+ +
+ +
-
+

Additional fields