public IActionResult GetMetricEntries([FromRoute] int id, [FromQuery] int limit = 60)
        {
            if (_metricsManager.GetMetric(id) == null)
            {
                return NotFound(new
                {
                    message = "A metric with this ID does not exist."
                });
            }

            var metricEntries = _metricsManager.GetEntries(id, limit);
            return Ok(metricEntries);
        }
Example #2
0
        public ActionResult GetMetric()
        {
            var parameters = AjaxModel.GetAjaxParameters(HttpContext);
            var metricID   = RDL.Convert.StrToInt(parameters["metricID"].ToString(), 0);
            var row        = parameters["row"] as System.Collections.ArrayList;
            var mng        = new MetricsManager();
            var dt         = new DataTable();
            var res        = mng.GetMetric(metricID, row, out dt);

            return(Json(new
            {
                result = true,
                Table = new {
                    columns = dt.Columns.Cast <DataColumn>().Select(x => x.ColumnName),
                    rows = dt.Rows.Cast <DataRow>().Select(x => new { fields = x.ItemArray })
                },
                Parameters = res.as_mt_metrics1.Select(x => new { x.title, x.parName, x.id }).ToList()
            }));
        }