blob: c48a3ee3b270f1c1899f87cdce4f5dd5662fc43e [file] [log] [blame]
Andrew Geisslerba5e3f32018-05-24 10:58:00 -07001window.angular && (function(angular) {
2 'use strict';
Iftekharul Islam8b4828a2017-04-19 14:37:55 -05003
Andrew Geisslerba5e3f32018-05-24 10:58:00 -07004 angular
5 .module('app.common.directives')
6 .directive('logEvent', ['APIUtils', function(APIUtils) {
7 return {
8 'restrict': 'E',
9 'template': require('./log-event.html'),
10 'scope': {
11 'event': '=',
12 'tmz': '=',
13 'multiSelected': '='
14 },
15 'controller': ['$rootScope', '$scope', 'dataService', '$location', '$timeout', function($rootScope, $scope, dataService, $location, $timeout) {
16 $scope.dataService = dataService;
17 $scope.copySuccess = function(event) {
18 event.copied = true;
19 $timeout(function() {
20 event.copied = false;
21 }, 5000);
22 };
23 $scope.copyFailed = function(err) {
24 console.error('Error!', err);
25 };
26 $scope.resolveEvent = function(event) {
27 APIUtils.resolveLogs([{
28 Id: event.Id
29 }]).then(function() {
30 event.Resolved = 1;
31 });
32 };
Iftekharul Islamf2d74642017-07-10 16:42:14 -050033
Andrew Geisslerba5e3f32018-05-24 10:58:00 -070034 $scope.accept = function() {
35 $scope.event.selected = true;
36 $timeout(function() {
37 $scope.$parent.accept();
38 }, 10);
39 };
40 }]
41 };
42 }]);
Iftekharul Islam8b4828a2017-04-19 14:37:55 -050043})(window.angular);