예제 #1
0
        public async Task <string> SetLighthouseReports()
        {
            IEnumerable <Url> urls = await LighthouseRepository.GetUrls(_config);

            foreach (Url url in urls)
            {
                await _LighthouseBLL.runLightHouseAndSetReport(url);
            }
            return("Lighthouse has been run for the Urls retrieved from the database");
        }
예제 #2
0
        /// <summary>Run a Lighthouse performance audit and set the report and perf metrics in the database.
        /// <para>Does not run reports in parallel</para>
        /// </summary>
        public async Task runLightHouseAndSetReport(Url url)
        {
            dynamic lhr = await runLightHouse(_nodeServices, url.Name);

            Report report = createReport(lhr, url);
            IEnumerable <PerfMetric> perfMetrics = createPerfMetrics(lhr);
            int reportId = await LighthouseRepository.SetReport(_config, report);

            foreach (PerfMetric perfMetric in perfMetrics)
            {
                await LighthouseRepository.SetPerfMetric(_config, reportId, perfMetric);
            }
        }
예제 #3
0
        public async Task <IEnumerable <Url> > GetUrls()
        {
            IEnumerable <Url> urls = await LighthouseRepository.GetUrls(_config);

            return(urls);
        }
예제 #4
0
        public async Task <IEnumerable <PerfMetric> > GetPerfMetricsByReportId(int reportId)
        {
            var perfMetrics = await LighthouseRepository.GetPerfMetricsByReportId(_config, reportId);

            return(perfMetrics);
        }
예제 #5
0
        public async Task <IEnumerable <Report> > GetReports(int id)
        {
            var reports = await LighthouseRepository.GetReportsByUrlId(_config, id);

            return(reports);
        }