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
1=== modified file 'checkbox-gui/checkbox-gui/qml/RunManagerView.qml'
2--- checkbox-gui/checkbox-gui/qml/RunManagerView.qml 2014-02-19 11:31:39 +0000
3+++ checkbox-gui/checkbox-gui/qml/RunManagerView.qml 2014-05-06 14:45:28 +0000
4@@ -81,7 +81,11 @@
5 runmanagerview.testingComplete = true;
6
7 // update ui
8- //runbuttons.pauseButtonEnabled = false;
9+ var option_list = new Array("client-name=" + client_name);
10+ var export_path = settings.value("exporter/xml_export_path", "/tmp/submission.xml")
11+
12+ var success = guiEngine.GuiExportSessionToFileAsXML(export_path,
13+ option_list);
14 runbuttons.resultsButtonEnabled = true;
15 progress.title = "Completed (" + utils.formatElapsedTime((new Date() - updater.startTime)) + ")";
16 progress.enabled = false;
17
18=== modified file 'checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml'
19--- checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml 2014-04-28 14:17:44 +0000
20+++ checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml 2014-05-06 14:45:28 +0000
21@@ -29,7 +29,7 @@
22 id: dialog
23
24 title: i18n.tr("Report")
25- text: settings.value("submission/message", i18n.tr("The following test report has been generated. You may view it now or save it for later."))
26+ 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."))
27
28 TextField {
29 RegExpValidator {
30@@ -89,16 +89,8 @@
31 color: UbuntuColors.orange
32 onClicked: {
33 var submit_to = settings.value("transport/submit_to", "")
34- var option_list = new Array("client-name=" + client_name);
35 var export_path = settings.value("exporter/xml_export_path", "/tmp/submission.xml")
36
37- if (!export_path) {
38- export_path = guiEngine.GetSaveFileName();
39- }
40- var success = guiEngine.GuiExportSessionToFileAsXML(export_path,
41- option_list);
42- var xls_export_path = export_path.replace('.xml', '.xls');
43- guiEngine.GuiExportSessionToFileAsXLSX(xls_export_path, []);
44 if (submit_to == "certification") {
45 if (success) {
46 dialog.text = guiEngine.SendSubmissionViaCertificationTransport(export_path,
47@@ -109,17 +101,61 @@
48 dialog.text = i18n.tr("Could not export the tests results for uploading.");
49 }
50 }
51- else if (submit_to == "local") {
52- if (success) {
53- runmanagerview.reportIsSaved = success;
54- }
55- }
56 else {
57 dialog.text = guiEngine.SendSubmissionViaLaunchpadTransport(export_path,
58 upload_input.text);
59 }
60 }
61 }
62+
63+ ListModel {
64+ function initialize() {
65+ reportTypeModel.append({"type": "xml", "name": i18n.tr("XML Report (*.xml)")})
66+ reportTypeModel.append({"type": "xlsx", "name": i18n.tr("XLSX Report (*.xlsx)")})
67+ }
68+
69+ id: reportTypeModel
70+ Component.onCompleted: initialize()
71+ }
72+
73+ Component {
74+ id: reportTypeDelegate
75+ OptionSelectorDelegate {
76+ text: name
77+ }
78+ }
79+
80+ OptionSelector {
81+ id: reportTypeSelect
82+ model: reportTypeModel
83+ delegate: reportTypeDelegate
84+ }
85+
86+ Button {
87+ id: save_button
88+ text: i18n.tr("Save Report")
89+ color: UbuntuColors.lightAubergine
90+ onClicked: {
91+ var option_list = new Array("client-name=" + client_name);
92+ var success = false;
93+ if (reportTypeSelect.selectedIndex == 0) {
94+ var path = guiEngine.GetSaveFileName('submission.xml',
95+ i18n.tr("XML files (*.xml)"))
96+ success = guiEngine.GuiExportSessionToFileAsXML(path,
97+ option_list);
98+ }
99+ else if (reportTypeSelect.selectedIndex == 1) {
100+ var path = guiEngine.GetSaveFileName('submission.xlsx',
101+ i18n.tr("XLSX files (*.xlsx)"))
102+ success = guiEngine.GuiExportSessionToFileAsXLSX(path, []);
103+ }
104+
105+ if (success) {
106+ runmanagerview.reportIsSaved = success;
107+ }
108+ }
109+ }
110+
111 Button {
112 id: view_button
113 text: i18n.tr("View Results")
114
115=== modified file 'checkbox-gui/gui-engine/gui-engine.cpp'
116--- checkbox-gui/gui-engine/gui-engine.cpp 2014-04-28 14:17:44 +0000
117+++ checkbox-gui/gui-engine/gui-engine.cpp 2014-05-06 14:45:28 +0000
118@@ -2638,14 +2638,15 @@
119 return PBTreeNode::PBJobResult_DepsNotMet;
120 }
121
122-QString GuiEngine::GetSaveFileName(void)
123+QString GuiEngine::GetSaveFileName(const QString& defaultName,
124+ const QString& text)
125 {
126 QString prompt = "Choose a filename:";
127
128 return QFileDialog::getSaveFileName(NULL, \
129 prompt, \
130- "submission.xml", \
131- tr("XML files (*.xml)"), \
132+ defaultName, \
133+ text, \
134 NULL, \
135 QFileDialog::DontUseNativeDialog);
136 }
137
138=== modified file 'checkbox-gui/gui-engine/gui-engine.h'
139--- checkbox-gui/gui-engine/gui-engine.h 2014-04-28 14:17:44 +0000
140+++ checkbox-gui/gui-engine/gui-engine.h 2014-05-06 14:45:28 +0000
141@@ -181,7 +181,7 @@
142 const QString &email);
143
144 // Convenience until we move to Qt 5.1 and the FileDialog component
145- QString GetSaveFileName(void);
146+ QString GetSaveFileName(const QString& defaultName, const QString& text);
147
148 // Session management from the GUI
149 void GuiSessionRemove(void);

Subscribers

People subscribed via source and target branches