public ActionResult Connections(string node) { var i = SQLInstance.Get(node); var vd = new DashboardModel { View = SQLViews.Connections, CurrentInstance = i }; return(View(vd)); }
public ActionResult DatabaseTables(string node, string database) { var i = SQLInstance.Get(node); var vd = new DatabasesModel { Instance = i, Database = database }; return(View("Databases.Modal.Tables", vd)); }
public ActionResult Databases(string node) { var i = SQLInstance.Get(node); var vd = new DashboardModel { View = SQLViews.Databases, CurrentInstance = i, Refresh = 2 * 60 }; return(View(vd)); }
private OperationsTopModel GetOperationsModel(string node, SQLInstance.TopSearchOptions options) { var i = SQLInstance.Get(node); options.SetDefaults(); return(new OperationsTopModel { View = SQLViews.Top, CurrentInstance = i, TopSearchOptions = options }); }
public ActionResult Kill(string node, string database, int sid) { var activeSearchOptions = new SQLInstance.ActiveSearchOptions(); var i = SQLInstance.Get(node); var activeOps = i.GetActiveOperations(activeSearchOptions); var model = activeOps.Data.FirstOrDefault(x => x.SessionId == sid); ViewData["node"] = node; ViewData["sid"] = sid; return(View("Operations.Active.Kill", model)); }
public ActionResult SQLRemovePlan(string node, string handle) { var planHandle = HttpServerUtility.UrlTokenDecode(handle); var instance = SQLInstance.Get(node); if (instance == null) { return(JsonError("Could not find server " + node)); } var result = instance.RemovePlan(planHandle); return(result != 0 ? Json(true) : JsonError("There was an error removing the plan from cache")); }
public ActionResult Instance(string node) { var i = SQLInstance.Get(node); var vd = new InstanceModel { View = SQLViews.Instance, Refresh = node.HasValue() ? 10 : 5, CurrentInstance = i }; return(View("Instance", vd)); }
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)); }
public ActionResult TopDetail(string node, string handle, int?offset = null) { var planHandle = HttpServerUtility.UrlTokenDecode(handle); var i = SQLInstance.Get(node); var vd = new OperationsTopDetailModel { Instance = i, Op = i.GetTopOperation(planHandle, offset).Data }; return(View("Operations.Top.Detail", vd)); }
public ActionResult Instance(string node) { var i = SQLInstance.Get(node); var vd = new DashboardModel { View = SQLViews.Instance, StandaloneInstances = SQLInstance.AllStandalone, Refresh = node.HasValue() ? 10 : 5, CurrentInstance = i }; return(View("Instance", vd)); }
public async Task <ActionResult> Connections(string node) { var i = SQLInstance.Get(node); var vd = new DashboardModel { View = SQLViews.Connections, CurrentInstance = i, Cache = i?.Connections, Connections = i == null ? null : await i.Connections.GetData().ConfigureAwait(false) }; return(View(vd)); }
public ActionResult TopPlan(string node, string handle) { var planHandle = HttpServerUtility.UrlTokenDecode(handle); var i = SQLInstance.Get(node); var op = i.GetTopOperation(planHandle).Data; if (op == null) { return(ContentNotFound("Plan was not found.")); } var ms = new MemoryStream(Encoding.UTF8.GetBytes(op.QueryPlan)); return(File(ms, "text/xml", $"QueryPlan-{Math.Abs(handle.GetHashCode())}.sqlplan")); }
public ActionResult DatabaseDetail(string node, string database, string view, string objectName) { var i = SQLInstance.Get(node); var vd = new DatabasesModel { Instance = i, Database = database, ObjectName = objectName }; switch (view) { case "backups": vd.View = DatabasesModel.Views.Backups; return(View("Databases.Modal.Backups", vd)); case "restores": vd.View = DatabasesModel.Views.Restores; return(View("Databases.Modal.Restores", vd)); case "storage": vd.View = DatabasesModel.Views.Storage; return(View("Databases.Modal.Storage", vd)); case "tables": vd.View = DatabasesModel.Views.Tables; return(View("Databases.Modal.Tables", vd)); case "views": vd.View = DatabasesModel.Views.Views; return(View("Databases.Modal.Views", vd)); case "unusedindexes": vd.View = DatabasesModel.Views.UnusedIndexes; return(View("Databases.Modal.UnusedIndexes", vd)); case "missingindexes": vd.View = DatabasesModel.Views.MissingIndexes; return(View("Databases.Modal.MissingIndexes", vd)); case "storedprocedures": vd.View = DatabasesModel.Views.StoredProcedures; return(View("Databases.Modal.StoredProcedures", vd)); } return(View("Databases.Modal.Tables", vd)); }
public ActionResult Connections(string node, bool refresh = false) { var instance = SQLInstance.Get(node); if (refresh && instance != null) { instance.Connections.Purge(); } var vd = new DashboardModel { View = DashboardModel.Views.Connections, CurrentInstance = instance }; return(View("Dashboard", vd)); }
public ActionResult TopPlan(string node, string handle) { var planHandle = HttpServerUtility.UrlTokenDecode(handle); var i = SQLInstance.Get(node); var op = i.GetTopOperation(planHandle).Data; if (op == null) { return(ContentNotFound("Plan was not found.")); } var ms = new MemoryStream(Encoding.UTF8.GetBytes(op.QueryPlan)); var dt = DateTime.Now.ToString("yyyyMMddHHmm"); return(File(ms, "text/xml", $"QueryPlan-{dt}-{op.CompiledOnDatabase}-{op.StoredProcedure}.sqlplan")); }
public ActionResult SQLCPUSpark(string node) { var instance = SQLInstance.Get(node); if (instance == null) { return(ContentNotFound($"SQLNode not found with name = '{node}'")); } var start = DateTime.UtcNow.AddHours(-1); var points = instance.ResourceHistory.Data?.Where(p => p.EventTime >= start).ToList(); if (points == null || points.Count == 0) { return(EmptySparkSVG()); } return(SparkSVG(points, 100, p => p.ProcessUtilization, start)); }
public ActionResult TopDetail(string node, string handle, int?offset = null) { var planHandle = HttpServerUtility.UrlTokenDecode(handle); var instance = SQLInstance.Get(node); if (instance == null) { return(ContentNotFound("Server " + node + " not found.")); } var vd = new OpsTopDetailModel { Instance = instance, Op = instance.GetTopOperation(planHandle, offset).Data }; return(View("Operations.Top.Detail", vd)); }
public ActionResult Instance(string node, bool ajax = false) { var instance = SQLInstance.Get(node); if (instance == null && ajax) { return(ContentNotFound("Instance " + node + " was not found.")); } var vd = new DashboardModel { StandaloneInstances = SQLInstance.AllStandalone, Refresh = node.HasValue() ? 10 : 5, View = DashboardModel.Views.Instance, CurrentInstance = instance }; return(View(ajax ? "Instance" : "Dashboard", vd)); }
public ActionResult DatabaseDetail(string node, string database, string view) { var vd = new DatabasesModel { Instance = SQLInstance.Get(node), Database = database }; switch (view) { case "tables": vd.View = DatabasesModel.Views.Tables; return(View("Databases.Modal.Tables", vd)); case "views": vd.View = DatabasesModel.Views.Views; return(View("Databases.Modal.Views", vd)); } return(View("Databases.Modal.Tables", vd)); }
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)); }
public ActionResult ToggleAgentJob(string node, Guid guid, bool enable) { var instance = SQLInstance.Get(node); return(Json(instance.ToggleJob(guid, enable))); }
public async Task <ActionResult> KillSpid(string node, int spid) { var instance = SQLInstance.Get(node); return(Json(await instance.KillSpid(spid))); }
public async Task <ActionResult> StartAgentJob(string node, Guid guid) { var instance = SQLInstance.Get(node); return(Json(await instance.StartJobAsync(guid))); }
public async Task <ActionResult> ToggleAgentJob(string node, Guid guid, bool enable) { var instance = SQLInstance.Get(node); return(Json(await instance.ToggleJobAsync(guid, enable).ConfigureAwait(false))); }
public async Task <ActionResult> StopAgentJob(string node, Guid guid) { var instance = SQLInstance.Get(node); return(Json(await instance.StopJobAsync(guid).ConfigureAwait(false))); }
public ActionResult StopAgentJob(string node, Guid guid) { var instance = SQLInstance.Get(node); return(Json(instance.StopJob(guid))); }