Beispiel #1
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));
        }
        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));
        }