Merge lp:~brendan-donegan/checkbox/save_report_as into lp:checkbox

Proposed by Brendan Donegan
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 2961
Merged at revision: 2978
Proposed branch: lp:~brendan-donegan/checkbox/save_report_as
Merge into: lp:checkbox
Diff against target: 149 lines (+60/-19)
4 files modified
checkbox-gui/checkbox-gui/qml/RunManagerView.qml (+5/-1)
checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml (+50/-14)
checkbox-gui/gui-engine/gui-engine.cpp (+4/-3)
checkbox-gui/gui-engine/gui-engine.h (+1/-1)
To merge this branch: bzr merge lp:~brendan-donegan/checkbox/save_report_as
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Review via email: mp+218391@code.launchpad.net

Description of the change

This branch updates the SubmissionDialog of checkbox-gui to display an option selector and a button, which can be used to select a report type and save it to the users preferred location (where the report types are XML and XLSX). It also moves the code to save the reports to a default location (e.g. /tmp/submission.xml/xlsx) to when the test run completes, rather than when the users submits the report.

To post a comment you must log in.
2961. By Brendan Donegan

checkbox-gui: Allow user to save both XML and XLSX reports to preffered location

Add to the SubmissionDialog an OptionSelector and a Button, containing the
option to save either the XML or the XLSX format report to a user-specified
location.

Signed-off-by: Brendan Donegan <email address hidden>

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'checkbox-gui/checkbox-gui/qml/RunManagerView.qml'
--- checkbox-gui/checkbox-gui/qml/RunManagerView.qml 2014-02-19 11:31:39 +0000
+++ checkbox-gui/checkbox-gui/qml/RunManagerView.qml 2014-05-06 14:45:28 +0000
@@ -81,7 +81,11 @@
81 runmanagerview.testingComplete = true;81 runmanagerview.testingComplete = true;
8282
83 // update ui83 // update ui
84 //runbuttons.pauseButtonEnabled = false;84 var option_list = new Array("client-name=" + client_name);
85 var export_path = settings.value("exporter/xml_export_path", "/tmp/submission.xml")
86
87 var success = guiEngine.GuiExportSessionToFileAsXML(export_path,
88 option_list);
85 runbuttons.resultsButtonEnabled = true;89 runbuttons.resultsButtonEnabled = true;
86 progress.title = "Completed (" + utils.formatElapsedTime((new Date() - updater.startTime)) + ")";90 progress.title = "Completed (" + utils.formatElapsedTime((new Date() - updater.startTime)) + ")";
87 progress.enabled = false;91 progress.enabled = false;
8892
=== modified file 'checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml'
--- checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml 2014-04-28 14:17:44 +0000
+++ checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml 2014-05-06 14:45:28 +0000
@@ -29,7 +29,7 @@
29 id: dialog29 id: dialog
3030
31 title: i18n.tr("Report")31 title: i18n.tr("Report")
32 text: settings.value("submission/message", i18n.tr("The following test report has been generated. You may view it now or save it for later."))32 text: settings.value("submission/message", i18n.tr("The following test report has been generated for submission to Launchpad. You may also view it or save it."))
3333
34 TextField {34 TextField {
35 RegExpValidator {35 RegExpValidator {
@@ -89,16 +89,8 @@
89 color: UbuntuColors.orange89 color: UbuntuColors.orange
90 onClicked: {90 onClicked: {
91 var submit_to = settings.value("transport/submit_to", "")91 var submit_to = settings.value("transport/submit_to", "")
92 var option_list = new Array("client-name=" + client_name);
93 var export_path = settings.value("exporter/xml_export_path", "/tmp/submission.xml")92 var export_path = settings.value("exporter/xml_export_path", "/tmp/submission.xml")
9493
95 if (!export_path) {
96 export_path = guiEngine.GetSaveFileName();
97 }
98 var success = guiEngine.GuiExportSessionToFileAsXML(export_path,
99 option_list);
100 var xls_export_path = export_path.replace('.xml', '.xls');
101 guiEngine.GuiExportSessionToFileAsXLSX(xls_export_path, []);
102 if (submit_to == "certification") {94 if (submit_to == "certification") {
103 if (success) {95 if (success) {
104 dialog.text = guiEngine.SendSubmissionViaCertificationTransport(export_path,96 dialog.text = guiEngine.SendSubmissionViaCertificationTransport(export_path,
@@ -109,17 +101,61 @@
109 dialog.text = i18n.tr("Could not export the tests results for uploading.");101 dialog.text = i18n.tr("Could not export the tests results for uploading.");
110 }102 }
111 }103 }
112 else if (submit_to == "local") {
113 if (success) {
114 runmanagerview.reportIsSaved = success;
115 }
116 }
117 else {104 else {
118 dialog.text = guiEngine.SendSubmissionViaLaunchpadTransport(export_path,105 dialog.text = guiEngine.SendSubmissionViaLaunchpadTransport(export_path,
119 upload_input.text);106 upload_input.text);
120 }107 }
121 }108 }
122 }109 }
110
111 ListModel {
112 function initialize() {
113 reportTypeModel.append({"type": "xml", "name": i18n.tr("XML Report (*.xml)")})
114 reportTypeModel.append({"type": "xlsx", "name": i18n.tr("XLSX Report (*.xlsx)")})
115 }
116
117 id: reportTypeModel
118 Component.onCompleted: initialize()
119 }
120
121 Component {
122 id: reportTypeDelegate
123 OptionSelectorDelegate {
124 text: name
125 }
126 }
127
128 OptionSelector {
129 id: reportTypeSelect
130 model: reportTypeModel
131 delegate: reportTypeDelegate
132 }
133
134 Button {
135 id: save_button
136 text: i18n.tr("Save Report")
137 color: UbuntuColors.lightAubergine
138 onClicked: {
139 var option_list = new Array("client-name=" + client_name);
140 var success = false;
141 if (reportTypeSelect.selectedIndex == 0) {
142 var path = guiEngine.GetSaveFileName('submission.xml',
143 i18n.tr("XML files (*.xml)"))
144 success = guiEngine.GuiExportSessionToFileAsXML(path,
145 option_list);
146 }
147 else if (reportTypeSelect.selectedIndex == 1) {
148 var path = guiEngine.GetSaveFileName('submission.xlsx',
149 i18n.tr("XLSX files (*.xlsx)"))
150 success = guiEngine.GuiExportSessionToFileAsXLSX(path, []);
151 }
152
153 if (success) {
154 runmanagerview.reportIsSaved = success;
155 }
156 }
157 }
158
123 Button {159 Button {
124 id: view_button160 id: view_button
125 text: i18n.tr("View Results")161 text: i18n.tr("View Results")
126162
=== modified file 'checkbox-gui/gui-engine/gui-engine.cpp'
--- checkbox-gui/gui-engine/gui-engine.cpp 2014-04-28 14:17:44 +0000
+++ checkbox-gui/gui-engine/gui-engine.cpp 2014-05-06 14:45:28 +0000
@@ -2638,14 +2638,15 @@
2638 return PBTreeNode::PBJobResult_DepsNotMet;2638 return PBTreeNode::PBJobResult_DepsNotMet;
2639}2639}
26402640
2641QString GuiEngine::GetSaveFileName(void)2641QString GuiEngine::GetSaveFileName(const QString& defaultName,
2642 const QString& text)
2642{2643{
2643 QString prompt = "Choose a filename:";2644 QString prompt = "Choose a filename:";
26442645
2645 return QFileDialog::getSaveFileName(NULL, \2646 return QFileDialog::getSaveFileName(NULL, \
2646 prompt, \2647 prompt, \
2647 "submission.xml", \2648 defaultName, \
2648 tr("XML files (*.xml)"), \2649 text, \
2649 NULL, \2650 NULL, \
2650 QFileDialog::DontUseNativeDialog);2651 QFileDialog::DontUseNativeDialog);
2651}2652}
26522653
=== modified file 'checkbox-gui/gui-engine/gui-engine.h'
--- checkbox-gui/gui-engine/gui-engine.h 2014-04-28 14:17:44 +0000
+++ checkbox-gui/gui-engine/gui-engine.h 2014-05-06 14:45:28 +0000
@@ -181,7 +181,7 @@
181 const QString &email);181 const QString &email);
182182
183 // Convenience until we move to Qt 5.1 and the FileDialog component183 // Convenience until we move to Qt 5.1 and the FileDialog component
184 QString GetSaveFileName(void);184 QString GetSaveFileName(const QString& defaultName, const QString& text);
185185
186 // Session management from the GUI186 // Session management from the GUI
187 void GuiSessionRemove(void);187 void GuiSessionRemove(void);

Subscribers

People subscribed via source and target branches