From c6f1507e655a8c694c5226d93507182c17a74fb0 Mon Sep 17 00:00:00 2001 From: "Jeffrey T. Palmer" Date: Sat, 2 May 2020 16:31:37 -0400 Subject: [PATCH 1/3] Switch to new report after "Save As" --- html/gui/js/report_builder/ReportCreator.js | 18 ++++++++++-------- tests/ui/test/specs/xdmod/reportGenerator.js | 17 +++++++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/html/gui/js/report_builder/ReportCreator.js b/html/gui/js/report_builder/ReportCreator.js index 3b5ab7df86..1b406672f1 100644 --- a/html/gui/js/report_builder/ReportCreator.js +++ b/html/gui/js/report_builder/ReportCreator.js @@ -501,17 +501,17 @@ XDMoD.ReportCreator = Ext.extend(Ext.form.FormPanel, { if (success) { self.parent.reportsOverview.reportStore.reload(); - if (!generateCopy) { - btnSaveReport.setDisabled(true); - self.needsSave = false; - CCR.xdmod.reporting.dirtyState = false; + btnSaveReport.setDisabled(true); + self.needsSave = false; + CCR.xdmod.reporting.dirtyState = false; - self.setReportID(responseData.report_id); + self.setReportID(responseData.report_id); - // This reload triggers (server-side) - // cache cleanup - flushReloadReportCharts(responseData.report_id); + // This reload triggers (server-side) + // cache cleanup + flushReloadReportCharts(responseData.report_id); + if (!generateCopy) { var action = responseData.phase.slice(0,1).toUpperCase() + responseData.phase.slice(1) + 'd'; @@ -533,6 +533,8 @@ XDMoD.ReportCreator = Ext.extend(Ext.form.FormPanel, { } ); } else { + self.setReportName(reportData.report_name); + XDMoD.TrackEvent( 'Report Generator (Report Editor)', 'Report successfully saved as a copy', diff --git a/tests/ui/test/specs/xdmod/reportGenerator.js b/tests/ui/test/specs/xdmod/reportGenerator.js index b06956bd64..c06ca3d84f 100644 --- a/tests/ui/test/specs/xdmod/reportGenerator.js +++ b/tests/ui/test/specs/xdmod/reportGenerator.js @@ -630,6 +630,15 @@ describe('Report Generator', function () { it('Click "Save" in "Save As" window', function () { reportGeneratorPage.confirmSaveReportAs(); }); + it('Edit copied report', function () { + testReport.header = 'Header for copied report'; + reportGeneratorPage.setHeaderText(testReport.header); + testReport.chartsPerPage = testReport.chartsPerPage === 1 ? 2 : 1; + reportGeneratorPage.setNumberOfChartsPerPage(testReport.chartsPerPage); + }); + it('Save report', function () { + reportGeneratorPage.saveReport(); + }); it('Return to "My Reports"', function () { reportGeneratorPage.returnToMyReports(); }); @@ -644,6 +653,14 @@ describe('Report Generator', function () { expect(reportRow.getNumberOfCharts(), 'Number of charts of is correct').to.be.equal(testReport.numberOfCharts); expect(reportRow.getNumberOfChartsPerPage(), 'Number of charts per page is correct').to.be.equal(testReport.chartsPerPage); }); + it('Edit copied report and compare values', function () { + reportGeneratorPage.getMyReportsRows()[2].doubleClick(); + expect(reportGeneratorPage.getHeaderText(), 'Header text is correct').to.be.equal(testReport.header); + expect(reportGeneratorPage.getNumberOfChartsPerPage(), 'Number of charts per page is correct').to.be.equal(testReport.chartsPerPage); + }); + it('Return to "My Reports"', function () { + reportGeneratorPage.returnToMyReports(); + }); }); describe('Edit report and make changes', function () { From d9261d6977496afe45aebbf5e93604a97826565f Mon Sep 17 00:00:00 2001 From: "Jeffrey T. Palmer" Date: Sat, 2 May 2020 17:00:06 -0400 Subject: [PATCH 2/3] Add test --- tests/ui/test/specs/xdmod/reportGenerator.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/ui/test/specs/xdmod/reportGenerator.js b/tests/ui/test/specs/xdmod/reportGenerator.js index c06ca3d84f..faf9582c2f 100644 --- a/tests/ui/test/specs/xdmod/reportGenerator.js +++ b/tests/ui/test/specs/xdmod/reportGenerator.js @@ -630,6 +630,9 @@ describe('Report Generator', function () { it('Click "Save" in "Save As" window', function () { reportGeneratorPage.confirmSaveReportAs(); }); + it('Check copied report name', function () { + expect(reportGeneratorPage.getReportName(), 'Report name is correct').to.be.equal(testReport.name); + }); it('Edit copied report', function () { testReport.header = 'Header for copied report'; reportGeneratorPage.setHeaderText(testReport.header); From 55ba6a49a00ad7e3b83118d94f67a2bc9759061d Mon Sep 17 00:00:00 2001 From: "Jeffrey T. Palmer" Date: Sat, 2 May 2020 17:09:36 -0400 Subject: [PATCH 3/3] Declare variables before use --- html/gui/js/report_builder/ReportCreator.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/html/gui/js/report_builder/ReportCreator.js b/html/gui/js/report_builder/ReportCreator.js index 1b406672f1..c20215399b 100644 --- a/html/gui/js/report_builder/ReportCreator.js +++ b/html/gui/js/report_builder/ReportCreator.js @@ -131,6 +131,11 @@ XDMoD.ReportCreator = Ext.extend(Ext.form.FormPanel, { thumbnailChartLayoutPreview; }, this, {single: true}); + // Declare variable before they are used, but cannot be defined here + // due to circular references. + var btnSaveReport; + var btnSaveReportAs; + this.dirtyConfig = function (field, nv, ov) { CCR.xdmod.reporting.dirtyState = true; self.needsSave = true; @@ -1042,7 +1047,7 @@ XDMoD.ReportCreator = Ext.extend(Ext.form.FormPanel, { p.expandGeneralInfo = false; }); - var btnSaveReport = new Ext.Button({ + btnSaveReport = new Ext.Button({ iconCls: 'btn_save', text: 'Save', disabled: true, @@ -1056,7 +1061,7 @@ XDMoD.ReportCreator = Ext.extend(Ext.form.FormPanel, { } }); - var btnSaveReportAs = new Ext.Button({ + btnSaveReportAs = new Ext.Button({ iconCls: 'btn_save', text: 'Save As', tooltip: 'Create and save a copy of this report.',