예제 #1
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            CurrentStore     = ExceptionsModule.GetStore(Request.Params["store"]);
            CurrentGroup     = Request.Params["group"];
            CurrentLog       = Request.Params["log"] ?? Request.Params["app"]; // old link compat
            CurrentId        = Request.Params["id"].HasValue() && Guid.TryParse(Request.Params["id"], out var guid) ? guid : (Guid?)null;
            CurrentSimilarId = Request.Params["similar"].HasValue() && Guid.TryParse(Request.Params["similar"], out var similarGuid) ? similarGuid : (Guid?)null;
            Enum.TryParse(Request.Params["sort"], out CurrentSort);

            if (CurrentLog.HasValue())
            {
                var storeApps = CurrentStore.Applications.Data;
                var a         = storeApps?.Find(app => app.Name == CurrentLog) ?? storeApps?.Find(app => app.ShortName == CurrentLog);
                if (a != null)
                {
                    // Correct the log name to a found one, this enables short names to work.
                    CurrentLog = a.Name;
                    // Make pre-group links work correctly
                    if (CurrentGroup.IsNullOrEmpty())
                    {
                        // Old links, that didn't know about groups
                        var g = ApplicationGroups.Find(gr => gr[a.Name] != null);
                        if (g != null)
                        {
                            CurrentGroup = g.Name;
                        }
                    }
                }
            }

            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetNoStore();
            base.OnActionExecuting(filterContext);
        }
예제 #2
0
 public HomeController(
     IOptions <OpserverSettings> _settings,
     IEnumerable <StatusModule> modules,
     DashboardModule dashboard,
     SQLModule sql,
     RedisModule redis,
     ElasticModule elastic,
     ExceptionsModule exceptions,
     HAProxyModule haproxy
     ) : base(_settings)
 {
     Modules    = modules;
     Dashboard  = dashboard;
     Sql        = sql;
     Redis      = redis;
     Elastic    = elastic;
     Exceptions = exceptions;
     HAProxy    = haproxy;
 }