Пример #1
0
        public ActionResult ExceptionsSimilar(string app, Guid id, ExceptionSorts?sort = null, bool truncate = true, bool byTime = false)
        {
            // Defaults
            sort = sort ?? ExceptionSorts.TimeDesc;

            var e = ExceptionStores.GetError(app, id);

            if (e == null)
            {
                return(View("Exceptions.Detail", null));
            }

            var errors = ExceptionStores.GetSimilarErrors(e, byTime, sort: sort.Value);
            var vd     = new ExceptionsModel
            {
                Sort                    = sort.Value,
                Exception               = e,
                SelectedLog             = app,
                ShowingWindow           = byTime,
                Applications            = ExceptionStores.Applications,
                ClearLinkForVisibleOnly = true,
                Errors                  = errors
            };

            return(View("Exceptions.Similar", vd));
        }
Пример #2
0
        public ActionResult ExceptionsSearch(string q, string log, ExceptionSorts?sort = null, bool showDeleted = false)
        {
            // Defaults
            sort = sort ?? ExceptionSorts.TimeDesc;

            // empty searches go back to the main log
            if (q.IsNullOrEmpty())
            {
                return(RedirectToAction("Exceptions", new { log }));
            }

            var errors = ExceptionStores.FindErrors(q, log, includeDeleted: showDeleted, max: 2000, sort: sort.Value);

            if (!errors.Any() && !showDeleted)
            {
                // If we didn't find any current errors, go ahead and search deleted as well
                return(RedirectToAction("ExceptionsSearch", new { q, log, showDeleted = true }));
            }

            var vd = new ExceptionsModel
            {
                Sort                    = sort.Value,
                Search                  = q,
                SelectedLog             = log,
                ShowDeleted             = showDeleted,
                Applications            = ExceptionStores.Applications,
                ClearLinkForVisibleOnly = true,
                Errors                  = errors
            };

            return(View("Exceptions.Search", vd));
        }
Пример #3
0
        public ExceptionsModel GetExceptionsModel(string log, ExceptionSorts sort, int?count = null, Guid?prevLast = null, int?loadAsync = null)
        {
            var errors = ExceptionStores.GetAllErrors(log, sort: sort);

            var startIndex = 0;

            if (prevLast.HasValue)
            {
                startIndex = errors.FindIndex(e => e.GUID == prevLast.Value);
                if (startIndex > 0 && startIndex < errors.Count)
                {
                    startIndex++;
                }
            }
            errors = errors.Skip(startIndex).Take(count ?? 500).ToList();
            var vd = new ExceptionsModel
            {
                Sort          = sort,
                SelectedLog   = log,
                LoadAsyncSize = loadAsync.GetValueOrDefault(),
                Applications  = ExceptionStores.Applications,
                Errors        = errors.ToList()
            };

            return(vd);
        }
Пример #4
0
        public ActionResult ExceptionDetailJson(string app, Guid id)
        {
            var e = ExceptionStores.GetError(app, id);

            return(e != null
                       ? Json(new
            {
                e.GUID,
                e.ErrorHash,
                e.ApplicationName,
                e.Type,
                e.Source,
                e.Message,
                e.Detail,
                e.MachineName,
                e.SQL,
                e.Host,
                e.Url,
                e.HTTPMethod,
                e.IPAddress,
                e.DuplicateCount,
                CreationDate = e.CreationDate.ToEpochTime(),
            })
                       : JsonNotFound());
        }
Пример #5
0
        public async Task <ActionResult> JiraAction(string log, Guid id, int actionid, bool redirect = false)
        {
            var e          = ExceptionStores.GetError(log, id);
            var user       = Current.User;
            var action     = JiraSettings.Actions.FirstOrDefault(i => i.Id == actionid);
            var jiraClient = new JiraClient(JiraSettings);
            var result     = await jiraClient.CreateIssue(action, e, user == null?String.Empty : user.AccountName);

            if (String.IsNullOrWhiteSpace(result.Key))
            {
                return(Json(new
                {
                    success = false,
                    message = "Can not create issue"
                }));
            }
            else
            {
                return(Json(new
                {
                    success = true,
                    issueKey = result.Key,
                    browseUrl = result.BrowseUrl
                }));
            }
        }
Пример #6
0
        public ActionResult ExceptionsSearch(string q, string log, bool showDeleted = false)
        {
            // empty searches go back to the main log
            if (q.IsNullOrEmpty())
            {
                return(RedirectToAction("Exceptions", new { log }));
            }

            var errors = ExceptionStores.FindErrors(q, log, includeDeleted: showDeleted, max: 2000);

            if (!errors.Any() && !showDeleted)
            {
                // If we didn't find any current errors, go ahead and search deleted as well
                return(RedirectToAction("ExceptionsSearch", new { q, log, showDeleted = true }));
            }

            var vd = new ExceptionsModel
            {
                Search         = q,
                SelectedLog    = log,
                ShowDeleted    = showDeleted,
                TruncateErrors = true,
                Applications   = ExceptionStores.Applications,
                Errors         = errors
            };

            return(View("Exceptions.Search", vd));
        }
Пример #7
0
        public ActionResult ExceptionsDeleteSimilar(string log, Guid id)
        {
            var e = ExceptionStores.GetError(log, id);

            ExceptionStores.Action(e.ApplicationName, s => s.DeleteSimilarErrors(e));

            return(Json(new { url = Url.Action("Exceptions", new { log }) }));
        }
Пример #8
0
        public ActionResult ExceptionsDelete(string log, Guid id, bool redirect = false)
        {
            // we don't care about success...if it's *already* deleted, that's fine
            // if we throw an exception trying to delete, that's another matter
            ExceptionStores.Action(log, s => s.DeleteError(id));

            return(redirect ? Json(new { url = Url.Action("Exceptions", new { log }) }) : ExceptionCounts());
        }
Пример #9
0
        public ActionResult ExceptionsDeleteList(string log, Guid[] ids, bool returnCounts = false)
        {
            if (ids == null || ids.Length == 0)
            {
                return(Json(true));
            }
            ExceptionStores.Action(log, s => s.DeleteErrors(log, ids.ToList()));

            return(returnCounts ? ExceptionCounts() : Json(new { url = Url.Action("Exceptions", new { log }) }));
        }
Пример #10
0
        public ActionResult Exceptions(string log, bool truncate = true)
        {
            var errors = ExceptionStores.GetAllErrors(log, log.HasValue() ? 1000 : 200);
            var vd     = new ExceptionsModel
            {
                SelectedLog    = log,
                TruncateErrors = truncate,
                Applications   = ExceptionStores.Applications,
                Errors         = errors
            };

            return(View(vd));
        }
Пример #11
0
        public ActionResult ExceptionsSimilar(string app, Guid id, bool truncate = true, bool byTime = false)
        {
            var e = ExceptionStores.GetError(app, id);

            if (e == null)
            {
                return(View("Exceptions.Detail", null));
            }

            var errors = ExceptionStores.GetSimilarErrors(e, byTime);
            var vd     = new ExceptionsModel
            {
                Exception      = e,
                SelectedLog    = app,
                TruncateErrors = truncate,
                ShowingWindow  = byTime,
                Applications   = ExceptionStores.Applications,
                Errors         = errors
            };

            return(View("Exceptions.Similar", vd));
        }
Пример #12
0
        public ActionResult ExceptionsDeleteAll(string log)
        {
            ExceptionStores.Action(log, s => s.DeleteAllErrors(log));

            return(Json(new { url = Url.Action("Exceptions") }));
        }
Пример #13
0
        public ActionResult ExceptionsProtect(string log, Guid id)
        {
            var success = ExceptionStores.Action(log, s => s.ProtectError(id));

            return(success ? ExceptionCounts() : JsonError("Unable to protect, error was not found in the log"));
        }
Пример #14
0
        public ActionResult ExceptionPreview(string app, Guid id)
        {
            var e = ExceptionStores.GetError(app, id);

            return(View("Exceptions.Preview", e));
        }
Пример #15
0
        public ActionResult ExceptionDetail(string app, Guid id)
        {
            var e = ExceptionStores.GetError(app, id);

            return(View("Exceptions.Detail", e));
        }
Пример #16
0
        public async Task <ActionResult> ExceptionPreview(string app, Guid id)
        {
            var e = await ExceptionStores.GetError(app, id);

            return(View("Exceptions.Preview", e));
        }