public async Task <ActionResult> Search(string q, string group, string log, ExceptionSorts?sort = null, bool showDeleted = false) { // Defaults sort = sort ?? ExceptionSorts.TimeDesc; FixNames(ref group, ref log); // empty searches go back to the main log if (q.IsNullOrEmpty()) { return(RedirectToAction(nameof(Exceptions), new { group, log })); } var errors = await FindErrorsAsync(q, group, log, max : 10000, includeDeleted : showDeleted, sort : sort.Value).ConfigureAwait(false); if (errors.Count == 0 && !showDeleted) { // If we didn't find any current errors, go ahead and search deleted as well return(RedirectToAction(nameof(Search), new { q, group, log, showDeleted = true })); } var vd = new ExceptionsModel { Sort = sort.Value, Search = q, SelectedGroup = group, SelectedLog = log, ShowDeleted = showDeleted, Groups = ApplicationGroups, ClearLinkForVisibleOnly = true, Errors = errors }; return(View("Exceptions.Search", vd)); }
public async Task <ActionResult> Similar(string group, string log, Guid id, ExceptionSorts?sort = null, bool byTime = false) { // Defaults sort = sort ?? ExceptionSorts.TimeDesc; FixNames(ref group, ref log); var e = await GetError(log, id).ConfigureAwait(false); if (e == null) { return(View("Exceptions.Detail", null)); } var errors = await GetSimilarErrorsAsync(e, byTime, sort : sort.Value).ConfigureAwait(false); var vd = new ExceptionsModel { Sort = sort.Value, Exception = e, SelectedGroup = group, SelectedLog = log, ShowingWindow = byTime, Groups = ApplicationGroups, ClearLinkForVisibleOnly = true, Errors = errors }; return(View("Exceptions.Similar", vd)); }
private static IEnumerable <Error> GetSorted(IEnumerable <Error> source, ExceptionSorts?sort = ExceptionSorts.TimeDesc) { switch (sort) { case ExceptionSorts.AppAsc: return(source.OrderBy(e => e.ApplicationName)); case ExceptionSorts.AppDesc: return(source.OrderByDescending(e => e.ApplicationName)); case ExceptionSorts.TypeAsc: return(source.OrderBy(e => e.Type.Split(StringSplits.Period_Plus).Last())); case ExceptionSorts.TypeDesc: return(source.OrderByDescending(e => e.Type.Split(StringSplits.Period_Plus).Last())); case ExceptionSorts.MessageAsc: return(source.OrderBy(e => e.Message)); case ExceptionSorts.MessageDesc: return(source.OrderByDescending(e => e.Message)); case ExceptionSorts.UrlAsc: return(source.OrderBy(e => e.UrlPath)); case ExceptionSorts.UrlDesc: return(source.OrderByDescending(e => e.UrlPath)); case ExceptionSorts.IPAddressAsc: return(source.OrderBy(e => e.IPAddress)); case ExceptionSorts.IPAddressDesc: return(source.OrderByDescending(e => e.IPAddress)); case ExceptionSorts.HostAsc: return(source.OrderBy(e => e.Host)); case ExceptionSorts.HostDesc: return(source.OrderByDescending(e => e.Host)); case ExceptionSorts.MachineNameAsc: return(source.OrderBy(e => e.MachineName)); case ExceptionSorts.MachineNameDesc: return(source.OrderByDescending(e => e.MachineName)); case ExceptionSorts.CountAsc: return(source.OrderBy(e => e.DuplicateCount.GetValueOrDefault(1))); case ExceptionSorts.CountDesc: return(source.OrderByDescending(e => e.DuplicateCount.GetValueOrDefault(1))); case ExceptionSorts.TimeAsc: return(source.OrderBy(e => e.CreationDate)); //case ExceptionSorts.TimeDesc: default: return(source.OrderByDescending(e => e.CreationDate)); } }
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)); }
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)); }
public async Task <ActionResult> Exceptions(string group, string log, ExceptionSorts?sort = null, int?count = null) { // Defaults count = count ?? 250; sort = sort ?? ExceptionSorts.TimeDesc; var vd = await GetExceptionsModel(group, log, sort.Value, count.Value, loadAsync : 500).ConfigureAwait(false); return(View(vd)); }
public ActionResult Exceptions(string log, ExceptionSorts?sort = null, int?count = null) { // Defaults count = count ?? 250; sort = sort ?? ExceptionSorts.TimeDesc; var vd = GetExceptionsModel(log, sort.Value, count.Value, loadAsync: 500); return(View(vd)); }