public static HtmlString GetQueryString(SQLInstance.TopSearchOptions options)
        {
            var sb = StringBuilderCache.Get();

            if (options.MinExecs != Default.MinExecs)
            {
                sb.Append("&").Append(nameof(options.MinExecs)).Append("=").Append(options.MinExecs.Value);
            }
            if (options.MinExecsPerMin != Default.MinExecsPerMin)
            {
                sb.Append("&").Append(nameof(options.MinExecsPerMin)).Append("=").Append(options.MinExecsPerMin.Value);
            }
            if (options.Search != Default.Search)
            {
                sb.Append("&").Append(nameof(options.Search)).Append("=").Append(options.Search.UrlEncode());
            }
            if (options.Database != Default.Database)
            {
                sb.Append("&").Append(nameof(options.Database)).Append("=").Append(options.Database.Value);
            }
            if (options.LastRunSeconds != Default.LastRunSeconds)
            {
                sb.Append("&").Append(nameof(options.LastRunSeconds)).Append("=").Append(options.LastRunSeconds.Value);
            }

            return(sb.ToStringRecycle().AsHtml());
        }
Example #2
0
        public static IHtmlString ToQueryString(this SQLInstance.TopSearchOptions options, bool leadingAmp = false)
        {
            var sb = new StringBuilder();

            if (options.MinExecs.HasValue)
            {
                sb.Append("MinExecs=").Append(options.MinExecs).Append("&");
            }
            if (options.MinExecsPerMin.HasValue)
            {
                sb.Append("MinExecsPerMin=").Append(options.MinExecsPerMin).Append("&");
            }
            if (options.Search.HasValue())
            {
                sb.Append("Search=").Append(HttpUtility.UrlEncode(options.Search)).Append("&");
            }
            if (options.Database.HasValue)
            {
                sb.Append("Database=").Append(options.Database.Value).Append("&");
            }
            if (options.LastRunSeconds.HasValue)
            {
                sb.Append("LastRunSeconds=").Append(options.LastRunSeconds.Value).Append("&");
            }

            if (sb.Length > 0)
            {
                if (leadingAmp)
                {
                    sb.Insert(0, "&");
                }
                return(sb.ToString(0, sb.Length - 1).AsHtml());
            }
            return("".AsHtml());
        }
Example #3
0
        private OperationsTopModel GetOperationsModel(string node, SQLInstance.TopSearchOptions options)
        {
            var i = Module.GetInstance(node);

            options.SetDefaults();

            return(new OperationsTopModel
            {
                View = SQLViews.Top,
                CurrentInstance = i,
                TopSearchOptions = options
            });
        }
Example #4
0
        public ActionResult Top(string node, SQLInstance.TopSearchOptions options)
        {
            var vd = GetOperationsModel(node, options);
            var i  = vd.CurrentInstance;

            if (i != null)
            {
                var cache = i.GetTopOperations(options);
                vd.TopOperations = cache.Data;
                vd.ErrorMessage  = cache.ErrorMessage;
            }

            return(View("Operations.Top", vd));
        }
Example #5
0
        public ActionResult Top(string node, SQLInstance.TopSearchOptions options, bool?detailed = false)
        {
            options.SetDefaults();

            var vd = new DashboardModel
            {
                View             = DashboardModel.Views.Top,
                Detailed         = detailed.GetValueOrDefault(),
                CurrentInstance  = SQLInstance.Get(node),
                TopSearchOptions = options
            };

            return(View("Dashboard", vd));
        }
Example #6
0
        public ActionResult Top(string node, SQLInstance.TopSearchOptions options, bool?detailed = false)
        {
            var i = SQLInstance.Get(node);

            options.SetDefaults();


            var vd = new OperationsTopModel
            {
                View             = SQLViews.Top,
                Detailed         = detailed.GetValueOrDefault(),
                CurrentInstance  = i,
                TopSearchOptions = options
            };

            if (i != null)
            {
                var cache = i.GetTopOperations(options);
                vd.TopOperations = cache.SafeData(true);
                vd.ErrorMessage  = cache.ErrorMessage;
            }

            return(View("Operations.Top", vd));
        }
Example #7
0
 public ActionResult TopFilters(string node, SQLInstance.TopSearchOptions options) =>
 View("Operations.Top.Filters", GetOperationsModel(node, options));
Example #8
0
        public ActionResult TopFilters(string node, SQLInstance.TopSearchOptions options)
        {
            var vd = GetOperationsModel(node, options);

            return(View("Operations.Top.Filters", vd));
        }