blob: 2a711645360ae8bb25a82fc6d69f031a337ca940 [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 Geisslerd27bb132018-05-24 11:07:27 -07004 angular.module('app.common.directives').directive('logEvent', [
5 'APIUtils',
6 function(APIUtils) {
Andrew Geisslerba5e3f32018-05-24 10:58:00 -07007 return {
8 'restrict': 'E',
9 'template': require('./log-event.html'),
Andrew Geisslerd27bb132018-05-24 11:07:27 -070010 'scope': {'event': '=', 'tmz': '=', 'multiSelected': '='},
11 'controller': [
12 '$rootScope', '$scope', 'dataService', '$location', '$timeout',
13 function($rootScope, $scope, dataService, $location, $timeout) {
14 $scope.dataService = dataService;
15 $scope.copySuccess = function(event) {
16 event.copied = true;
17 $timeout(function() {
18 event.copied = false;
19 }, 5000);
20 };
21 $scope.copyFailed = function(err) {
22 console.error('Error!', err);
23 };
24 $scope.resolveEvent = function(event) {
25 APIUtils.resolveLogs([{Id: event.Id}]).then(function() {
26 event.Resolved = 1;
27 });
28 };
Iftekharul Islamf2d74642017-07-10 16:42:14 -050029
Andrew Geisslerd27bb132018-05-24 11:07:27 -070030 $scope.accept = function() {
31 $scope.event.selected = true;
32 $timeout(function() {
33 $scope.$parent.accept();
34 }, 10);
35 };
36 }
37 ]
Andrew Geisslerba5e3f32018-05-24 10:58:00 -070038 };
Andrew Geisslerd27bb132018-05-24 11:07:27 -070039 }
40 ]);
Iftekharul Islam8b4828a2017-04-19 14:37:55 -050041})(window.angular);