Merge lp:~sylvain-pineau/checkbox/fix-1452217-gui into lp:checkbox

Proposed by Sylvain Pineau
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 3811
Merged at revision: 3811
Proposed branch: lp:~sylvain-pineau/checkbox/fix-1452217-gui
Merge into: lp:checkbox
Diff against target: 85 lines (+31/-1)
3 files modified
checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml (+6/-0)
checkbox-gui/gui-engine/gui-engine.cpp (+21/-0)
checkbox-gui/gui-engine/gui-engine.h (+4/-1)
To merge this branch: bzr merge lp:~sylvain-pineau/checkbox/fix-1452217-gui
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Sylvain Pineau Needs Resubmitting
Review via email: mp+260135@code.launchpad.net

Description of the change

Fixes https://bugs.launchpad.net/checkbox-gui/+bug/1452217 by adding the needed methods to export to json from the GUI.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Just one quick comment below

3811. By Sylvain Pineau

checkbox-gui: Add all the methods to export results to json format

Fixes https://bugs.launchpad.net/checkbox-gui/+bug/1452217

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Json options list now includes 'with-io-log' and 'with-comments'.

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

+1

Revision history for this message
Zygmunt Krynicki (zyga) :
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/SubmissionDialog.qml'
2--- checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml 2015-05-12 14:51:58 +0000
3+++ checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml 2015-05-26 14:07:16 +0000
4@@ -112,6 +112,7 @@
5 function initialize() {
6 reportTypeModel.append({"type": "xml", "name": i18n.tr("XML Report (*.xml)")})
7 reportTypeModel.append({"type": "xlsx", "name": i18n.tr("XLSX Report (*.xlsx)")})
8+ reportTypeModel.append({"type": "json", "name": i18n.tr("JSON Report (*.json)")})
9 }
10
11 id: reportTypeModel
12@@ -149,6 +150,11 @@
13 i18n.tr("XLSX files (*.xlsx)"))
14 success = guiEngine.GuiExportSessionToFileAsXLSX(path, ["with-sys-info", "with-summary", "with-job-description", "with-text-attachments"]);
15 }
16+ else if (reportTypeSelect.selectedIndex == 2) {
17+ var path = guiEngine.GetSaveFileName('submission.json',
18+ i18n.tr("JSON files (*.json)"))
19+ success = guiEngine.GuiExportSessionToFileAsJSON(path, ["with-certification-status", "with-job-defs", "with-io-log", "with-comments"]);
20+ }
21
22 if (success) {
23 runmanagerview.reportIsSaved = success;
24
25=== modified file 'checkbox-gui/gui-engine/gui-engine.cpp'
26--- checkbox-gui/gui-engine/gui-engine.cpp 2015-02-26 15:17:08 +0000
27+++ checkbox-gui/gui-engine/gui-engine.cpp 2015-05-26 14:07:16 +0000
28@@ -1571,6 +1571,14 @@
29 return ExportSession(m_session,output_format,options);
30 }
31
32+QString GuiEngine::GuiExportSessionAsJSON(void)
33+{
34+ qDebug("GuiEngine::GuiExportSessionAsJSON");
35+ QString output_format = "json";
36+ QStringList options; // No options
37+ return ExportSession(m_session,output_format,options);
38+}
39+
40
41 const QString GuiEngine::ExportSession(const QDBusObjectPath session, \
42 const QString &output_format, \
43@@ -1642,6 +1650,19 @@
44 return true;
45 }
46
47+bool GuiEngine::GuiExportSessionToFileAsJSON(const QString& output_file,
48+ const QStringList& option_list)
49+{
50+ QString output_format = "json";
51+ // very basic argument checking
52+ if (output_file.isEmpty()) {
53+ return false;
54+ }
55+ // FIXME - When we get a useful success/failure code here, return to caller
56+ QString done = ExportSessionToFile(m_session,output_format,option_list,output_file);
57+ return true;
58+}
59+
60 const QString GuiEngine::ExportSessionToFile(const QDBusObjectPath session, \
61 const QString &output_format, \
62 const QStringList &option_list, \
63
64=== modified file 'checkbox-gui/gui-engine/gui-engine.h'
65--- checkbox-gui/gui-engine/gui-engine.h 2015-01-13 13:57:09 +0000
66+++ checkbox-gui/gui-engine/gui-engine.h 2015-05-26 14:07:16 +0000
67@@ -163,6 +163,7 @@
68 QString GuiExportSessionAsXML(void);
69 QString GuiExportSessionAsHTML(void);
70 QString GuiExportSessionAsXLSX(void);
71+ QString GuiExportSessionAsJSON(void);
72
73 bool GuiExportSessionToFileAsXML(const QString& output_file,
74 const QStringList& option_list);
75@@ -170,7 +171,9 @@
76 const QStringList& option_list);
77 bool GuiExportSessionToFileAsXLSX(const QString& output_file,
78 const QStringList& option_list);
79-
80+ bool GuiExportSessionToFileAsJSON(const QString& output_file,
81+ const QStringList& option_list);
82+
83 const QString SendSubmissionViaCertificationTransport( \
84 const QString &submission_path,
85 const QString &secure_id,

Subscribers

People subscribed via source and target branches