//
        // GET: /stats

        public virtual async Task <ActionResult> Index()
        {
            if (_statisticsService == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            bool[] availablity = await Task.WhenAll(
                _statisticsService.LoadDownloadPackages(),
                _statisticsService.LoadDownloadPackageVersions(),
                _statisticsService.LoadNuGetClientVersion(),
                _statisticsService.LoadLast6Months());

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageAvailable       = availablity[0],
                DownloadPackagesSummary          = _statisticsService.DownloadPackagesSummary,
                IsDownloadPackageDetailAvailable = availablity[1],
                DownloadPackageVersionsSummary   = _statisticsService.DownloadPackageVersionsSummary,
                IsNuGetClientVersionAvailable    = availablity[2],
                NuGetClientVersion     = _statisticsService.NuGetClientVersion,
                IsLast6MonthsAvailable = availablity[3],
                Last6Months            = _statisticsService.Last6Months,
            };

            model.ClientCulture = DetermineClientLocale();

            model.Update();

            model.UseD3 = UseD3();

            return(View(model));
        }
        //
        // GET: /stats/packageversions

        public virtual async Task <ActionResult> PackageVersions()
        {
            if (_statisticsService == NullStatisticsService.Instance)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            await _statisticsService.Refresh();

            var allPackagesUpdateTime       = _statisticsService.PackageVersionDownloadsResult.LastUpdatedUtc;
            var communityPackagesUpdateTime = _statisticsService.CommunityPackageVersionDownloadsResult.LastUpdatedUtc;

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageVersionsAvailable = _statisticsService.PackageVersionDownloadsResult.IsLoaded,
                DownloadPackageVersionsAll         = _statisticsService.PackageVersionDownloads,

                IsDownloadCommunityPackageVersionsAvailable = _statisticsService.CommunityPackageVersionDownloadsResult.IsLoaded,
                DownloadCommunityPackageVersionsAll         = _statisticsService.CommunityPackageVersionDownloads,

                LastUpdatedUtc = (allPackagesUpdateTime > communityPackagesUpdateTime)
                                    ? allPackagesUpdateTime
                                    : communityPackagesUpdateTime,
            };

            return(View(model));
        }
        //
        // GET: /stats

        public virtual async Task <ActionResult> Index()
        {
            if (_statisticsService == NullStatisticsService.Instance)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            await _statisticsService.Refresh();

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageAvailable = _statisticsService.CommunityPackageDownloadsResult.IsLoaded,
                DownloadPackagesSummary    = _statisticsService.CommunityPackageDownloadsSummary,

                IsDownloadPackageVersionsAvailable = _statisticsService.CommunityPackageVersionDownloadsResult.IsLoaded,
                DownloadPackageVersionsSummary     = _statisticsService.CommunityPackageVersionDownloadsSummary,

                IsNuGetClientVersionAvailable = _statisticsService.NuGetClientVersionResult.IsLoaded,
                NuGetClientVersion            = _statisticsService.NuGetClientVersion,

                IsLast6WeeksAvailable = _statisticsService.Last6WeeksResult.IsLoaded,
                Last6Weeks            = _statisticsService.Last6Weeks,

                LastUpdatedUtc = _statisticsService.LastUpdatedUtc,
            };

            model.Update();

            model.UseD3 = UseD3();

            return(View(model));
        }
示例#4
0
        //
        // GET: /stats/package/{id}/{version}

        public virtual async Task <ActionResult> PackageDownloadsDetail(string id, string version, string[] groupby)
        {
            if (_statisticsService == NullStatisticsService.Instance)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            StatisticsPackagesReport report = null;

            try
            {
                report = await _statisticsService.GetPackageVersionDownloadsByClient(id, version);

                ProcessReport(report, groupby, PackageDownloadsDetailDimensions, null);
            }
            catch (StatisticsReportNotFoundException)
            {
                // no report found
            }

            if (report != null)
            {
                report.Id = MakeReportId(groupby);
            }

            var model = new StatisticsPackagesViewModel();

            model.SetPackageVersionDownloadsByClient(id, version, report);

            model.UseD3 = UseD3();

            return(View(model));
        }
示例#5
0
        //
        // GET: /stats/package/{id}/{version}

        public virtual async Task <ActionResult> PackageDownloadsDetail(string id, string version, string[] groupby)
        {
            if (_statisticsService == NullStatisticsService.Instance)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            var dimensions = new[] {
                Constants.StatisticsDimensions.ClientName,
                Constants.StatisticsDimensions.ClientVersion,
                Constants.StatisticsDimensions.Operation
            };

            StatisticsPackagesReport report = await _statisticsService.GetPackageVersionDownloadsByClient(id, version);

            ProcessReport(report, groupby, dimensions, null);

            if (report != null)
            {
                report.Id = MakeReportId(groupby);
            }

            var model = new StatisticsPackagesViewModel();

            model.SetPackageVersionDownloadsByClient(id, version, report);

            model.UseD3 = UseD3();

            return(View(model));
        }
        //
        // GET: /stats/package/{id}/{version}

        public virtual async Task <ActionResult> PackageDownloadsDetail(string id, string version, string[] groupby)
        {
            if (_statisticsService == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            StatisticsPackagesReport report = await _statisticsService.GetPackageVersionDownloadsByClient(id, version);

            ProcessReport(report, groupby, new string[] { "ClientName", "ClientVersion", "Operation" });

            var model = new StatisticsPackagesViewModel();

            model.SetPackageVersionDownloadsByClient(id, version, report);

            return(View(model));
        }
        //
        // GET: /stats/packageversions

        public virtual async Task <ActionResult> PackageVersions()
        {
            if (_statisticsService == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            bool isAvailable = await _statisticsService.LoadDownloadPackageVersions();

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageDetailAvailable = isAvailable,
                DownloadPackageVersionsAll       = _statisticsService.DownloadPackageVersionsAll
            };

            return(View(model));
        }
        //
        // GET: /stats/packages/{id}/{version}

        public virtual async Task <ActionResult> PackageDownloadsDetail(string id, string version, string[] groupby)
        {
            if (_statisticsService == NullStatisticsService.Instance)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            var report = await GetPackageDownloadsDetailReport(id, version, groupby);

            var model = new StatisticsPackagesViewModel();

            model.SetPackageVersionDownloadsByClient(id, version);

            model.UseD3 = UseD3();

            return(View(model));
        }
        //
        // GET: /stats/packages

        public virtual async Task <ActionResult> Packages()
        {
            if (_statisticsService == NullStatisticsService.Instance)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            var result = await _statisticsService.LoadDownloadPackages();

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageAvailable = result.Loaded,
                DownloadPackagesAll        = _statisticsService.DownloadPackagesAll,
                LastUpdatedUtc             = result.LastUpdatedUtc
            };

            return(View(model));
        }
示例#10
0
        //
        // GET: /stats/packages

        public virtual async Task <ActionResult> Packages()
        {
            if (_statisticsService == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            bool isAvailable = await _statisticsService.LoadDownloadPackages();

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageAvailable = isAvailable,
                DownloadPackagesAll        = _statisticsService.DownloadPackagesAll,
                ClientCulture = DetermineClientLocale()
            };

            return(View(model));
        }
        //
        // GET: /stats

        public virtual async Task <ActionResult> Index()
        {
            if (_statisticsService == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            bool[] availablity = await Task.WhenAll(_statisticsService.LoadDownloadPackages(), _statisticsService.LoadDownloadPackageVersions());

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageAvailable       = availablity[0],
                DownloadPackagesSummary          = _statisticsService.DownloadPackagesSummary,
                IsDownloadPackageDetailAvailable = availablity[1],
                DownloadPackageVersionsSummary   = _statisticsService.DownloadPackageVersionsSummary
            };

            return(View(model));
        }
示例#12
0
        //
        // GET: /stats/package/{id}

        public virtual async Task <ActionResult> PackageDownloadsByVersion(string id, string[] groupby)
        {
            if (_statisticsService == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            StatisticsPackagesReport report = await _statisticsService.GetPackageDownloadsByVersion(id);

            ProcessReport(report, groupby, new string[] { "Version", "ClientName", "ClientVersion", "Operation" }, id, DetermineClientLocale());

            report.Id = MakeReportId(groupby);

            StatisticsPackagesViewModel model = new StatisticsPackagesViewModel();

            model.SetPackageDownloadsByVersion(id, report);

            return(View(model));
        }
        //
        // GET: /stats/packageversions

        public virtual async Task <ActionResult> PackageVersions()
        {
            if (_statisticsService == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            var result = await _statisticsService.LoadDownloadPackageVersions();

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageDetailAvailable = result.Loaded,
                DownloadPackageVersionsAll       = _statisticsService.DownloadPackageVersionsAll,
                ClientCulture  = DetermineClientLocale(),
                LastUpdatedUtc = result.LastUpdatedUtc
            };

            return(View(model));
        }
示例#14
0
        //
        // GET: /stats

        public virtual async Task <ActionResult> Index()
        {
            if (_statisticsService == NullStatisticsService.Instance)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            var availablity = await Task.WhenAll(
                _statisticsService.LoadDownloadPackages(),
                _statisticsService.LoadDownloadPackageVersions(),
                _statisticsService.LoadNuGetClientVersion(),
                _statisticsService.LoadLast6Months());

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageAvailable       = availablity[0].Loaded,
                DownloadPackagesSummary          = _statisticsService.DownloadPackagesSummary,
                IsDownloadPackageDetailAvailable = availablity[1].Loaded,
                DownloadPackageVersionsSummary   = _statisticsService.DownloadPackageVersionsSummary,
                IsNuGetClientVersionAvailable    = availablity[2].Loaded,
                NuGetClientVersion     = _statisticsService.NuGetClientVersion,
                IsLast6MonthsAvailable = availablity[3].Loaded,
                Last6Months            = _statisticsService.Last6Months,
                LastUpdatedUtc         = availablity
                                         .Where(r => r.LastUpdatedUtc.HasValue)
                                         .OrderByDescending(r => r.LastUpdatedUtc.Value)
                                         .Select(r => r.LastUpdatedUtc)
                                         .FirstOrDefault()
            };

            model.ClientCulture = DetermineClientLocale();

            model.Update();

            model.UseD3 = UseD3();

            return(View(model));
        }
示例#15
0
        //
        // GET: /stats/package/{id}/{version}

        public virtual async Task <ActionResult> PackageDownloadsDetail(string id, string version, string[] groupby)
        {
            if (_statisticsService == NullStatisticsService.Instance)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            StatisticsPackagesReport report = await _statisticsService.GetPackageVersionDownloadsByClient(id, version);

            ProcessReport(report, groupby, new string[] { "ClientName", "ClientVersion", "Operation" }, null, DetermineClientLocale());

            if (report != null)
            {
                report.Id = MakeReportId(groupby);
            }

            var model = new StatisticsPackagesViewModel();

            model.SetPackageVersionDownloadsByClient(id, version, report);

            model.UseD3 = UseD3();

            return(View(model));
        }
        //
        // GET: /stats

        public virtual async Task<ActionResult> Index()
        {
            if (_statisticsService == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.NotFound);
            }

            var availablity = await Task.WhenAll(
                _statisticsService.LoadDownloadPackages(), 
                _statisticsService.LoadDownloadPackageVersions(),
                _statisticsService.LoadNuGetClientVersion(),
                _statisticsService.LoadLast6Months());

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageAvailable = availablity[0].Loaded,
                DownloadPackagesSummary = _statisticsService.DownloadPackagesSummary,
                IsDownloadPackageDetailAvailable = availablity[1].Loaded,
                DownloadPackageVersionsSummary = _statisticsService.DownloadPackageVersionsSummary,
                IsNuGetClientVersionAvailable = availablity[2].Loaded,
                NuGetClientVersion = _statisticsService.NuGetClientVersion,
                IsLast6MonthsAvailable = availablity[3].Loaded,
                Last6Months = _statisticsService.Last6Months,
                LastUpdatedUtc = availablity
                    .Where(r => r.LastUpdatedUtc.HasValue)
                    .OrderByDescending(r => r.LastUpdatedUtc.Value)
                    .Select(r => r.LastUpdatedUtc)
                    .FirstOrDefault()
            };

            model.ClientCulture = DetermineClientLocale();

            model.Update();

            model.UseD3 = UseD3();

            return View(model);
        }
        //
        // GET: /stats/package/{id}/{version}

        public virtual async Task<ActionResult> PackageDownloadsDetail(string id, string version, string[] groupby)
        {
            if (_statisticsService == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.NotFound);
            }

            StatisticsPackagesReport report = await _statisticsService.GetPackageVersionDownloadsByClient(id, version);

            ProcessReport(report, groupby, new string[] { "ClientName", "ClientVersion", "Operation" }, null, DetermineClientLocale());

            if (report != null)
            {
                report.Id = MakeReportId(groupby);
            }

            var model = new StatisticsPackagesViewModel();

            model.SetPackageVersionDownloadsByClient(id, version, report);

            model.UseD3 = UseD3();

            return View(model);
        }
        //
        // GET: /stats/packageversions

        public virtual async Task<ActionResult> PackageVersions()
        {
            if (_statisticsService == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.NotFound);
            }

            var result = await _statisticsService.LoadDownloadPackageVersions();

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageDetailAvailable = result.Loaded,
                DownloadPackageVersionsAll = _statisticsService.DownloadPackageVersionsAll,
                ClientCulture = DetermineClientLocale(),
                LastUpdatedUtc = result.LastUpdatedUtc
            };

            return View(model);
        }
        //
        // GET: /stats/packages

        public virtual async Task<ActionResult> Packages()
        {
            if (_statisticsService == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.NotFound);
            }

            bool isAvailable = await _statisticsService.LoadDownloadPackages();

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageAvailable = isAvailable,
                DownloadPackagesAll = _statisticsService.DownloadPackagesAll
            };

            return View(model);
        }
        //
        // GET: /stats

        public virtual async Task<ActionResult> Index()
        {
            if (_statisticsService == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.NotFound);
            }

            bool[] availablity = await Task.WhenAll(_statisticsService.LoadDownloadPackages(), _statisticsService.LoadDownloadPackageVersions());

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageAvailable = availablity[0],
                DownloadPackagesSummary = _statisticsService.DownloadPackagesSummary,
                IsDownloadPackageDetailAvailable = availablity[1],
                DownloadPackageVersionsSummary = _statisticsService.DownloadPackageVersionsSummary
            };

            return View(model);
        }
        //
        // GET: /stats/package/{id}

        public virtual async Task<ActionResult> PackageDownloadsByVersion(string id)
        {
            if (_statisticsService == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.NotFound);
            }

            bool isAvailable = await _statisticsService.LoadPackageDownloadsByVersion(id);

            var model = new StatisticsPackagesViewModel();

            model.SetPackageDownloadsByVersion(id, isAvailable, _statisticsService.PackageDownloadsByVersion);

            return View(model);
        }
        //
        // GET: /stats

        public virtual async Task<ActionResult> Index()
        {
            if (_statisticsService == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.NotFound);
            }

            bool[] availablity = await Task.WhenAll(
                _statisticsService.LoadDownloadPackages(), 
                _statisticsService.LoadDownloadPackageVersions(),
                _statisticsService.LoadNuGetClientVersion(),
                _statisticsService.LoadLast6Months());

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageAvailable = availablity[0],
                DownloadPackagesSummary = _statisticsService.DownloadPackagesSummary,
                IsDownloadPackageDetailAvailable = availablity[1],
                DownloadPackageVersionsSummary = _statisticsService.DownloadPackageVersionsSummary,
                IsNuGetClientVersionAvailable = availablity[2],
                NuGetClientVersion = _statisticsService.NuGetClientVersion,
                IsLast6MonthsAvailable = availablity[3],
                Last6Months = _statisticsService.Last6Months,
            };

            model.ClientCulture = DetermineClientLocale();

            model.Update();

            model.UseD3 = UseD3();

            return View(model);
        }
        //
        // GET: /stats/package/{id}/{version}

        public virtual async Task<ActionResult> PackageDownloadsDetail(string id, string version, string[] groupby)
        {
            if (_statisticsService == NullStatisticsService.Instance)
            {
                return new HttpStatusCodeResult(HttpStatusCode.NotFound);
            }

            StatisticsPackagesReport report = null;
            try
            {
                report = await _statisticsService.GetPackageVersionDownloadsByClient(id, version);

                ProcessReport(report, groupby, PackageDownloadsDetailDimensions, null);
            }
            catch (StatisticsReportNotFoundException)
            {
                // no report found
            }

            if (report != null)
            {
                report.Id = MakeReportId(groupby);
            }

            var model = new StatisticsPackagesViewModel();

            model.SetPackageVersionDownloadsByClient(id, version, report);

            model.UseD3 = UseD3();

            return View(model);
        }
        //
        // GET: /stats/package/{id}

        public virtual async Task<ActionResult> PackageDownloadsByVersion(string id, string[] groupby)
        {
            if (_statisticsService == NullStatisticsService.Instance)
            {
                return new HttpStatusCodeResult(HttpStatusCode.NotFound);
            }

            StatisticsPackagesReport report = await _statisticsService.GetPackageDownloadsByVersion(id);

            ProcessReport(report, groupby, new string[] { "Version", "ClientName", "ClientVersion", "Operation" }, id);

            if (report != null)
            {
                report.Id = MakeReportId(groupby);
            }

            StatisticsPackagesViewModel model = new StatisticsPackagesViewModel();

            model.SetPackageDownloadsByVersion(id, report);

            model.UseD3 = UseD3();

            return View(model);
        }
        //
        // GET: /stats/packages

        public virtual async Task<ActionResult> Packages()
        {
            if (_statisticsService == NullStatisticsService.Instance)
            {
                return new HttpStatusCodeResult(HttpStatusCode.NotFound);
            }

            var result = await _statisticsService.LoadDownloadPackages();

            var model = new StatisticsPackagesViewModel
            {
                IsDownloadPackageAvailable = result.Loaded,
                DownloadPackagesAll = _statisticsService.DownloadPackagesAll,
                LastUpdatedUtc = result.LastUpdatedUtc
            };

            return View(model);
        }