diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.avg.efficiency.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.avg.efficiency.js index 2dd03821bc2db80732753bd7a6f956f4190b2a61..2c3f22e1cc5dcc2d32be3459a4c4b9b68587fcb5 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.avg.efficiency.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.avg.efficiency.js @@ -16,13 +16,21 @@ class CycleReportAvgEfficiency extends Component { } componentDidMount() { - this.setState({reportData: this.getTableData()}); + const reportData = this.getTableData(); + this.setState({reportData: reportData}); + if (this.props.setExportData) { + this.props.setExportData('AverageEfficiency', this.getTableData(true)) + } } componentDidUpdate(prevProps, prevState) { - if (prevProps.data !== this.props.data) { - this.setState({reportData: this.getTableData()}); - } + if (prevProps.data !== this.props.data) { + const reportData = this.getTableData(); + this.setState({reportData: reportData}); + if (this.props.setExportData) { + this.props.setExportData('AverageEfficiency', this.getTableData(true)) + } + } } /** diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.data.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.data.js index 26bceaa67307aa639ca43b4777eb1cf2b45d4909..b5ad9012dc715a59734bfc715e1177c8fee7f86d 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.data.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.data.js @@ -19,6 +19,9 @@ class CycleCategoryWiseData extends Component{ getBarData() { let reportData = this.getReportData(false); + if (this.props.setExportData) { + this.props.setExportData('DataIngestedPerCateegory', reportData); + } return { labels: _.map(reportData, 'cycle'), datasets:[ diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.observations.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.observations.js index e145efa7c8851a2483f650037d9928fe5ba84c39..de8ef60aa4d9afc16c6219a007aca922dccc1efa 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.observations.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.observations.js @@ -113,6 +113,9 @@ class CycleCategoryObservations extends Component{ failed: MathUtility.getAverage(_.map(reportData, 'failed')), idle: MathUtility.getAverage(_.map(reportData, 'idle')) }); + if (this.props.setExportData) { + this.props.setExportData('CategoryObservation', reportData); + } } return reportData; } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.cycle.completion.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.cycle.completion.js index 4efc06f20f7c5d820963f196ffa330b29214b74d..a83b2b7c0cc0617e1717627eeb9018ca8cec995c 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.cycle.completion.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.cycle.completion.js @@ -17,11 +17,17 @@ class CycleCompletionLevel extends Component { componentDidMount() { this.setState({reportData: this.getTableData()}); + if (this.props.setExportData) { + this.props.setExportData('CompletionLevel', this.getTableData(true)); + } } componentDidUpdate(prevProps, prevState) { if (prevProps.data !== this.props.data) { this.setState({reportData: this.getTableData()}); + if (this.props.setExportData) { + this.props.setExportData('CompletionLevel', this.getTableData(true)); + } } } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.failure.rate.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.failure.rate.js index 329d616aa8c50ce2660ba6fcd889576cc0c6bee7..2b37e918b521e396e2c8d52aa3a19f62e26367c5 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.failure.rate.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.failure.rate.js @@ -119,6 +119,9 @@ class CycleFailureRate extends Component { }); }); reportData.monthTableData = reportData.chartData; + if (this.props.setExportData) { + this.props.setExportData('Failures', reportData.monthTableData); + } return reportData; } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.ilt_local.usage.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.ilt_local.usage.js index cb6555d1a6ec3fbe98a52e2ada7cf821f722009f..f1f4da0eeb572b4fc1e85371429130a81af7b73a 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.ilt_local.usage.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.ilt_local.usage.js @@ -125,7 +125,9 @@ class CyclesILTLocalUsage extends Component{ ilt_mode_dutch: null }) - + if (this.props.setExportData) { + this.props.setExportData('ILT_LocalUsage', reportData); + } this.setState({reportData: reportData}); } @@ -138,7 +140,6 @@ class CyclesILTLocalUsage extends Component{ <Bar data={this.getBarData()} options={this.getBarOptions()} width="50%" height="20" /> </div> <div className="ilt-time-details" id={`cycle-ilt-details`}> - <label> </label> <DataTable value={reportData} resizableColumns columnResizeMode="expand" className="card" style={{paddingLeft: '0em', textAlign: 'center'}}> <Column field="cycle" header="Cycle Code"></Column> <Column field="observing" header="ILT-mode observing"></Column> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.intro.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.intro.js index 6fa77b7fa751650aba374b88eda8441d27484265..80f2519c4e9b939bd77745740fdb3b62f103f9dd 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.intro.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.intro.js @@ -83,15 +83,15 @@ class CycleReportIntro extends Component { <div style={{paddingLeft: "10px"}}> <p>The following info is detailed in this report:</p> <ul> - <li><a href="#telescope_time" >The telescope time distribution</a>, which shows the different categories of observations for the selected observing cycles</li> - <li><a href="#avg_efficiency" >The average efficiency</a> matched with the expected or targeted or bench-marked average efficiency value for the cycle</li> - <li><a href="#completion_level" >The completion level</a>, which shows the fraction of successful observations performed per the total number of observations earmarked for the cycle in question</li> - <li><a href="#category_observations" >Observation hours per category</a>, which shows per single cycle the observing time fraction of successful Prio-A telescope hours, successful Prio-B telescope hours, System unavailability, Failed, System idle</li> - <li><a href="#weekly_efficiency" >The weekly efficiency</a>, which shows per single cycle fractions of observing hours of successful observations per week</li> - <li><a href="#site_ingest_data" >Ingested data overview per site and category</a>, which shows per single cycle fractions of data products ingested per site and type (i.e. raw, (pre-)processed, interferometric, beamformed, tbb)</li> - <li><a href="#projects_summary" >Projects summary overview</a>, which shows a tabular overview of the telescope resources (successful(/failed) telescope hours, processing hours, storage space at the LTA site(s)) used by the projects in that cycle</li> - <li><a href="#ilt_local_usage" >The ILT vs stand alone mode usage</a>, which shows the amount of hours spent in ILT-mode observing (i.e. the telescope is using the full array), ILT-mode idle / test (i.e. the full array is available but not performing production observations), Local-mode (i.e. the telescope array consist of Dutch station), ILT-mode (in total), ILT_mode_Dutch_array_observing (i.e. the the full array is available but performing production observations requiring only Dutch stations)</li> - <li><a href="#failures" >The rate of failures</a>, which shows the rate of failures as a function of time</li> + <li><a href="#TelescopeTime" >The telescope time distribution</a>, which shows the different categories of observations for the selected observing cycles</li> + <li><a href="#AverageEfficiency" >The average efficiency</a> matched with the expected or targeted or bench-marked average efficiency value for the cycle</li> + <li><a href="#CompletionLevel" >The completion level</a>, which shows the fraction of successful observations performed per the total number of observations earmarked for the cycle in question</li> + <li><a href="#CategoryObservation" >Observation hours per category</a>, which shows per single cycle the observing time fraction of successful Prio-A telescope hours, successful Prio-B telescope hours, System unavailability, Failed, System idle</li> + <li><a href="#WeeklyEfficiency" >The weekly efficiency</a>, which shows per single cycle fractions of observing hours of successful observations per week</li> + <li><a href="#DataIngestedPerSite" >Ingested data overview per site and category</a>, which shows per single cycle fractions of data products ingested per site and type (i.e. raw, (pre-)processed, interferometric, beamformed, tbb)</li> + <li><a href="#ProjectSummary" >Projects summary overview</a>, which shows a tabular overview of the telescope resources (successful(/failed) telescope hours, processing hours, storage space at the LTA site(s)) used by the projects in that cycle</li> + <li><a href="#ILT_LocalUsage" >The ILT vs stand alone mode usage</a>, which shows the amount of hours spent in ILT-mode observing (i.e. the telescope is using the full array), ILT-mode idle / test (i.e. the full array is available but not performing production observations), Local-mode (i.e. the telescope array consist of Dutch station), ILT-mode (in total), ILT_mode_Dutch_array_observing (i.e. the the full array is available but performing production observations requiring only Dutch stations)</li> + <li><a href="#Failures" >The rate of failures</a>, which shows the rate of failures as a function of time</li> </ul> </div> </div> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.main.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.main.js index 1adc93e681c4cebc91eeaedac4aeb365b38c8f1f..c98cc0c8ab594f4fd984d65ca700397c43093c54 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.main.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.main.js @@ -10,6 +10,7 @@ import ReactToPrint from "react-to-print"; import { AutoComplete } from 'primereact/autocomplete'; import { Calendar } from 'primereact/calendar'; import { Button } from 'primereact/button'; +import { ProgressBar } from 'primereact/progressbar'; import { AppLoader } from '../../../layout/components/AppLoader'; import CycleService from '../../../services/cycle.service'; import ReportService from '../../../services/report.service'; @@ -25,37 +26,18 @@ import CycleProjectSummary from './report.project.summary'; import CyclesILTLocalUsage from './report.ilt_local.usage'; import CycleFailureRate from './report.failure.rate'; -// Constants for SU details table column property name to be used for identifying the properties in the -// report data and title for displaying in reports and while exporting them. -const SU_DETAILS_COLUMNS = [{name: "su_name", headerTitle: "SU Name & Link in TMSS", propertyName: "name"}, - {name: "su_status", headerTitle: "SU Status Failed / Success ", propertyName: "status"}, - {name: "su_execDate", headerTitle: "SU Execution Date", propertyName: "exec_date"}, - {name: "observTime", headerTitle: "Time Observed (hr)", propertyName: "observingTime"}, - {name: "observTimeInc", headerTitle: "Time Observed Incremental (hr)", propertyName: "observingTimeInc"}, - {name: "observTimeLeft", headerTitle: "Time left for Observing (hr)", propertyName: "observingTimeLeft"}, - {name: "observTimeIncPercent", headerTitle: "Completed Observing Time(%)", propertyName: "observingTimeIncPercent"}, - {name: "processTime", headerTitle: "Time Processed (hr)", propertyName: "processTime"}, - {name: "processTimeInc", headerTitle: "Time Processed Incremental (hr)", propertyName: "processTimeInc"}, - {name: "processTimeLeft", headerTitle: "Time left for Processing (hr)", propertyName: "processTimeLeft"}, - {name: "processTimeIncPercent", headerTitle: "Completed Processing Time(%)", propertyName: "processTimeIncPercent"}, - {name: "ingestDate", headerTitle: "LTA Ingest Date", propertyName: "ingestDate"}, - {name: "ingestDataSize", headerTitle: "Ingested Data Size(TB)", propertyName: "ingestDataSize"}, - {name: "ingestDataIncPercent", headerTitle: "Used LTA Allocation (Incremental) (%)", propertyName: "ingestDataIncPercent"}, - {name: "observationSASId", headerTitle: "SAS ID (Observations)", propertyName: "observationSASId"}, - {name: "pipelinseSASId", headerTitle: "SAS ID (Pipelines)", propertyName: "pipelinseSASId"}, - ] - -const REPORT_VARIABLE_MAP = {"TelescopeTime" : "telescope_time_distribution", - "AverageEfficiency": "average_efficiency", - "CompletionLevel": "completion_level", - "CategoryObservation": "observation_hours_per_category", - "WeeklyEfficiency": "weekly_efficiency", - "DataIngestedPerSite": "data_ingested_per_site_and_category", - "DataIngestedPerCategory": "data_ingested_per_site_and_category", - "ProjectSummary": "projects_summary", - "ILT_LocalUsage": "usage_mode", - "Failures": "failures" - } +const REPORT_VARIABLE_MAP = {"Intro" : "report_intro", + "TelescopeTime" : "telescope_time_distribution", + "AverageEfficiency": "average_efficiency", + "CompletionLevel": "completion_level", + "CategoryObservation": "observation_hours_per_category", + "WeeklyEfficiency": "weekly_efficiency", + "DataIngestedPerSite": "data_ingested_per_site_and_category", + "DataIngestedPerCategory": "data_ingested_per_site_and_category", + "ProjectSummary": "projects_summary", + "ILT_LocalUsage": "usage_mode", + "Failures": "failures" + } /** * Main component for Cycle Report @@ -72,7 +54,7 @@ class CycleReportMain extends Component { this.searchCycles = this.searchCycles.bind(this); this.selectCycles = this.selectCycles.bind(this); this.setReportCycles = this.setReportCycles.bind(this); - this.setReportData = this.setReportData.bind(this); + this.setExportData = this.setExportData.bind(this); this.downloadCSV = this.downloadCSV.bind(this); this.downloadPDF = this.downloadPDF.bind(this); this.clearAll = this.clearAll.bind(this); @@ -134,67 +116,49 @@ class CycleReportMain extends Component { * Function to generate the PDF of the report. */ async downloadPDF() { + this.setState({isDownloading: true}); let reportDivs = document.getElementsByClassName('report-div'); // Get the div heights of each page of the report let divHeights = _.map(reportDivs, 'clientHeight'); // Create a PDF document with landscape orientation, 1st report div width and the max height of all report divs in pixels - const pdf = new jsPDF('l', 'px', [ (reportDivs[0].clientWidth+50), (_.max(divHeights)+50)]); + const pdf = new jsPDF('l', 'px', [ (reportDivs[0].clientWidth+50), (reportDivs[0].clientHeight+50)]); let pageIndex = 0; // Draw each report in canvas and create image of the canvas before saving the pdf - for (const project of this.state.reportCycles) { + for (const reportName of _.keys(REPORT_VARIABLE_MAP)) { // Create page for each project if (pageIndex > 0) { - pdf.addPage(); + const reportDiv = reportDivs[pageIndex+1]; + pdf.addPage([reportDiv.clientWidth+50, reportDiv.clientHeight+50], pageIndex===5?'p':'l'); } - const projectCanvas = await html2canvas(document.getElementById(`${project.name}-report-div`)); + const projectCanvas = await html2canvas(document.getElementById(`${reportName}`)); pdf.addImage(projectCanvas.toDataURL('image/jpeg'), 'JPEG', 50, 50); pageIndex++; } // To open the generated PDF in new window // pdf.output('dataurlnewwindow'); const reportPeriod = `${moment(this.state.reportPeriod[0]).format("DDMMMYYYY")}-${moment(this.state.reportPeriod[1]).format("DDMMMYYYY")}`; - pdf.save(`Project_${reportPeriod}.pdf`); + pdf.save(`Cycle_${reportPeriod}.pdf`); + this.setState({isDownloading: false}); } /** * Function to download the report data in CSV format */ downloadCSV() { - let csvConfig = {}; - let csvList= []; //Data list to export - let colHeaders = []; //Column header to export. Both no of headers and data values should be same. - let isColHeaderSet = false; //Flag to identify if colHeader is added - // For every project of the selected project get report data - for(const projectName of _.keys(this.cyclesReportData)) { - // Get the whole report data set from ProjectReport component - const projectReport = this.cyclesReportData[projectName]; - // Get Project Data - const reportData = projectReport.reportData; - // Get Project Resources Data - const projectResources = projectReport.projectResources; - // Add project and SU data to the csv list - projectReport.suStatsList.map((data, index) => { + // For every sub-report of the main report get report data + for(const reportName of _.keys(this.cyclesReportData)) { + let csvConfig = {}; + let csvList= []; //Data list to export + let colHeaders = []; //Column header to export. Both no of headers and data values should be same. + let isColHeaderSet = false; //Flag to identify if colHeader is added + // Get the whole report data set from MainReport component + const subReportData = this.cyclesReportData[reportName]; + subReportData.map((data, index) => { let csvData = {}; const colKeys = _.keys(data); - /* Add Project Details to the first row of the project SU data */ - if (!isColHeaderSet) { - colHeaders.push("Project"); - colHeaders.push("Contact Project Friend"); - colHeaders.push("Awarded Observing Time(hours)"); - colHeaders.push("Awarded Processing Time(hours)"); - colHeaders.push("Awarded LTA Storage(TB)"); - } - if (index === 0) { - csvData["Project"] = projectName; - csvData["Contact Project Friend"] = reportData.friends?reportData.friends.join(","):"-" - csvData["Awarded Observing Time(hours)"] = projectResources["LOFAR Observing Time"]?projectResources["LOFAR Observing Time"].convertedValue:"-"; - csvData["Awarded Processing Time(hours)"] = projectResources["CEP Processing Time"]?projectResources["CEP Processing Time"].convertedValue:"-"; - csvData["Awarded LTA Storage(TB)"] = projectResources["LTA Storage"]?projectResources["LTA Storage"].convertedValue:"-"; - } // For every column of the data, replace the column name with the column title for (const colKey of colKeys) { - let colHeader = _.find(SU_DETAILS_COLUMNS, ["propertyName", colKey]); - colHeader = colHeader?colHeader.headerTitle:_.upperFirst(colKey); + let colHeader = _.upperFirst(colKey); if (!isColHeaderSet) { colHeaders.push(colHeader); } @@ -203,37 +167,37 @@ class CycleReportMain extends Component { csvList.push(csvData); isColHeaderSet = true; }); - - } - // Pass column headers to CSV parser - if (colHeaders.length > 0) { - csvConfig.columns = colHeaders; - } - // Parse the CSV list and header opject to create CSV string - const csvString = Papa.unparse(csvList, csvConfig); - // Create a CSV BLOB from the csvString - const blob = new Blob([csvString], { type: "text/csv" }); + // Pass column headers to CSV parser + if (colHeaders.length > 0) { + csvConfig.columns = colHeaders; + } + // Parse the CSV list and header opject to create CSV string + const csvString = Papa.unparse(csvList, csvConfig); + // Create a CSV BLOB from the csvString + const blob = new Blob([csvString], { type: "text/csv" }); - // Add dummy link to click and download the created CSV - var a = document.createElement("a"); - document.body.appendChild(a); - a.style = "display: none"; - var url = window.URL.createObjectURL(blob); - a.href = url; - const reportPeriod = `${moment(this.state.reportPeriod[0]).format("DDMMMYYYY")}-${moment(this.state.reportPeriod[1]).format("DDMMMYYYY")}`; - a.download = `Project_${reportPeriod}.csv`; - a.click(); - window.URL.revokeObjectURL(url); + // Add dummy link to click and download the created CSV + var a = document.createElement("a"); + document.body.appendChild(a); + a.style = "display: none"; + var url = window.URL.createObjectURL(blob); + a.href = url; + const reportPeriod = `${moment(this.state.reportPeriod[0]).format("DDMMMYYYY")}-${moment(this.state.reportPeriod[1]).format("DDMMMYYYY")}`; + a.download = `Cycle_${reportName}_${reportPeriod}.csv`; + a.click(); + window.URL.revokeObjectURL(url); + } } /** - * Function called to set report project from the selected projects. + * Function called to set report cycles from the selected cycles. */ async setReportCycles() { this.setState({isLoading: true}); const cycleNames = _.map(_.orderBy(this.state.selectedCycles, 'start'), 'name'); let cyclesReportData = []; + // TODO: Based on API Response time keep this or remove the commented lines // for (const cycle of this.state.selectedCycles) { // let reportData = await ReportService.getCycleReport(cycle.name); // cyclesReportData.push(reportData); @@ -244,6 +208,11 @@ class CycleReportMain extends Component { isLoading: false}); } + /** + * To extract data required for the sub report component from the cycle report API response data. + * @param {String} reportVariable - sub report variable from the cycle report API response + * @returns Object - Extracted object for the respective sub report component + */ getReportData(reportVariable) { let reportData = _.map(this.state.cyclesReportData, data => { let repData = { cycle: data.cycle }; @@ -254,13 +223,13 @@ class CycleReportMain extends Component { } /** - * Callback function passed to the CycleReport component to get the report data to use in CSV export. + * Callback function passed to the CycleReport sub components to get the report data to use in CSV export. * @param {String} reportName - * @param {Object} cycleReportData - All required data from the CycleReport component + * @param {Object} reportData - All required data from the CycleReport sub component */ - setReportData(reportName, cycleReportData) { + setExportData(reportName, reportData) { let cyclesReportData = this.cyclesReportData || {}; - cyclesReportData[reportName] = cycleReportData; + cyclesReportData[reportName] = reportData; this.cyclesReportData = cyclesReportData; } @@ -295,6 +264,8 @@ class CycleReportMain extends Component { </div> {this.state.isLoading && <AppLoader />} + {this.state.isDownloading && + <div><ProgressBar mode="indeterminate" style={{ height: '5px' }}/></div> } {this.state.reportCycles.length>0 && <> <div ref={(el) => (this.reportDownloadBarRef = el)} > @@ -315,46 +286,68 @@ class CycleReportMain extends Component { /> </div> <div ref={(el) => (this.reportPrintRef = el)}> - <CycleReportIntro reportPeriod={this.state.reportPeriod} cycles={this.state.reportCycles} /> - <div id="telescope_time"> + <div className="report-div" id="Intro"> + <CycleReportIntro reportPeriod={this.state.reportPeriod} cycles={this.state.reportCycles} /> + </div> + <div className="report-div" id="TelescopeTime"> <label>Telescope Time Distribution</label> - <CycleTelescopeTime data={this.getReportData(REPORT_VARIABLE_MAP["TelescopeTime"])} /> + <CycleTelescopeTime id="TelescopeTime" + data={this.getReportData(REPORT_VARIABLE_MAP["TelescopeTime"])} + setExportData={this.setExportData} /> </div> - <div id="avg_efficiency"> + <div className="report-div" id="AverageEfficiency"> <label>Average Efficiency</label> - <CycleReportAvgEfficiency data={this.getReportData(REPORT_VARIABLE_MAP["AverageEfficiency"])} /> + <CycleReportAvgEfficiency id="AverageEfficiency" + data={this.getReportData(REPORT_VARIABLE_MAP["AverageEfficiency"])} + setExportData={this.setExportData} /> </div> - <div id="completion_level"> + <div className="report-div" id="CompletionLevel"> <label>Cycle Completion Level</label> - <CycleCompletionLevel data={this.getReportData(REPORT_VARIABLE_MAP["CompletionLevel"])} /> + <CycleCompletionLevel id="CompletionLevel" + data={this.getReportData(REPORT_VARIABLE_MAP["CompletionLevel"])} + setExportData={this.setExportData} /> </div> - <div id="category_observations"> + <div className="report-div" id="CategoryObservation"> <label>Observation Hours per Category</label> - <CycleCategoryObservations data={this.getReportData(REPORT_VARIABLE_MAP["CategoryObservation"])} /> + <CycleCategoryObservations id="CategoryObservation" + data={this.getReportData(REPORT_VARIABLE_MAP["CategoryObservation"])} + setExportData={this.setExportData} /> </div> - <div id="weekly_efficiency"> + <div className="report-div" id="WeeklyEfficiency"> <label>Weekly Efficiency</label> - <CycleWeeklyEfficiency data={this.getReportData(REPORT_VARIABLE_MAP["WeeklyEfficiency"])} /> + <CycleWeeklyEfficiency id="WeeklyEfficiency" + data={this.getReportData(REPORT_VARIABLE_MAP["WeeklyEfficiency"])} + setExportData={this.setExportData} /> </div> - <div id="site_ingest_data"> + <div className="report-div" id="DataIngestedPerSite"> <label>Ingested Data per Site</label> - <CycleSiteWiseData data={this.getReportData(REPORT_VARIABLE_MAP["DataIngestedPerSite"])} /> + <CycleSiteWiseData id="DataIngestedPerSite" + data={this.getReportData(REPORT_VARIABLE_MAP["DataIngestedPerSite"])} + setExportData={this.setExportData} /> </div> - <div id="category_ingest_data"> + <div className="report-div" id="DataIngestedPerCategory"> <label>Ingested Data per Category</label> - <CycleCategoryWiseData data={this.getReportData(REPORT_VARIABLE_MAP["DataIngestedPerCategory"])} /> + <CycleCategoryWiseData id="DataIngestedPerCategory" + data={this.getReportData(REPORT_VARIABLE_MAP["DataIngestedPerCategory"])} + setExportData={this.setExportData} /> </div> - <div id="projects_summary"> + <div className="report-div" id="ProjectSummary"> <label>Projects Summary Overview</label> - <CycleProjectSummary data={this.getReportData(REPORT_VARIABLE_MAP["ProjectSummary"])} /> + <CycleProjectSummary id="ProjectSummary" + data={this.getReportData(REPORT_VARIABLE_MAP["ProjectSummary"])} + setExportData={this.setExportData} /> </div> - <div id="ilt_local_usage"> + <div className="report-div" id="ILT_LocalUsage"> <label>ILT vs Local Mode Usage</label> - <CyclesILTLocalUsage data={this.getReportData(REPORT_VARIABLE_MAP["ILT_LocalUsage"])} /> + <CyclesILTLocalUsage id="ILT_LocalUsage" + data={this.getReportData(REPORT_VARIABLE_MAP["ILT_LocalUsage"])} + setExportData={this.setExportData} /> </div> - <div id="failures"> + <div className="report-div" id="Failures"> <label>Failure Rate</label> - <CycleFailureRate data={this.getReportData(REPORT_VARIABLE_MAP["Failures"])} /> + <CycleFailureRate id="Failures" + data={this.getReportData(REPORT_VARIABLE_MAP["Failures"])} + setExportData={this.setExportData} /> </div> </div> {/* Dummy reference div to scroll down before exporting to PDF so that diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.project.summary.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.project.summary.js index d44aecff75968cc648ae60a17020f301a3eb80e1..656393fb768020da1a290cbded47fb949c4f7533 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.project.summary.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.project.summary.js @@ -38,24 +38,24 @@ class CycleProjectSummary extends Component{ reportData.push(projectData); } }); + if (this.props.setExportData) { + this.props.setExportData('ProjectSummary', reportData); + } return reportData; } render() { return( <React.Fragment> - <div> - <DataTable value={this.getReportData()} resizableColumns columnResizeMode="expand" className="card" style={{paddingLeft: '0em', textAlign: 'center'}}> - <Column field="cycle" header="Cycle Code"></Column> - <Column field="project" header="Cycle Code"></Column> - <Column field="durationObserved" header="Time Observed (hr)"></Column> - <Column field="duratioProcessed" header="Time Processed (hr)"></Column> - <Column field="sara" header="Ingested To Sara data size (TB)"></Column> - <Column field="juelich" header="Ingested To Juelich data size (TB)"></Column> - <Column field="poznan" header="Ingested To Poznan data size (TB)"></Column> - </DataTable> - </div> - + <DataTable value={this.getReportData()} resizableColumns columnResizeMode="expand" className="card" style={{paddingLeft: '0em', textAlign: 'center'}}> + <Column field="cycle" header="Cycle Code"></Column> + <Column field="project" header="Cycle Code"></Column> + <Column field="durationObserved" header="Time Observed (hr)"></Column> + <Column field="duratioProcessed" header="Time Processed (hr)"></Column> + <Column field="sara" header="Ingested To Sara data size (TB)"></Column> + <Column field="juelich" header="Ingested To Juelich data size (TB)"></Column> + <Column field="poznan" header="Ingested To Poznan data size (TB)"></Column> + </DataTable> </React.Fragment> ) } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.site.data.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.site.data.js index afc793a661f2c4a0a902cc1a25779f33ecd5c3fb..5d59e699ec71b90ce83aca6964ad2e445c471941 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.site.data.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.site.data.js @@ -19,6 +19,9 @@ class CycleSiteWiseData extends Component{ getBarData() { let reportData = this.getReportData(false); + if (this.props.setExportData) { + this.props.setExportData('DataIngestedPerSite', reportData); + } return { labels: _.map(reportData, 'cycle'), datasets:[ diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.telescope.time.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.telescope.time.js index aee98ec771fafdb19849fc5b532c514fcfaf0a5f..1d726532ec7b8ebace2773ac0a1ba1a9d71fa59f 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.telescope.time.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.telescope.time.js @@ -149,6 +149,9 @@ class CycleTelescopeTime extends Component{ failed: MathUtility.getAverage(_.map(reportData, 'failed')), idle: MathUtility.getAverage(_.map(reportData, 'idle')) }); + if (this.props.setExportData) { + this.props.setExportData('TelescopeTime', reportData); + } this.setState({reportData : reportData}); } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.weekly.efficiency.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.weekly.efficiency.js index ebb8ae86fbda90449d0353baceb8bcb35792fef3..7e339b4af74449c7fd5bd84fec055889fd7ee695 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.weekly.efficiency.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.weekly.efficiency.js @@ -141,6 +141,9 @@ class CycleWeeklyEfficiency extends Component { } reportData.tableData.push(averageData); // } + if (this.props.setExportData) { + this.props.setExportData('WeeklyEfficiency', reportData.tableData); + } return reportData; }