~pieq/checkbox/add-30suspend-1reboot-cycles-support

« back to all changes in this revision

Viewing changes to checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml

  • Committer: Zygmunt Krynicki
  • Date: 2015-09-17 13:32:37 UTC
  • mto: This revision was merged to the branch mainline in revision 4014.
  • Revision ID: zygmunt.krynicki@canonical.com-20150917133237-7d4mdzlgpin1na9g
checkbox-gui: remove checkbox gui entirely

This patch removes all of checkbox-gui. This was long in the making but
it's now done. We cannot maintain this codebase effectively. Keeping it
around slows us down as we are unable to make feature-parity changes
here with the same simplicity that we can make them elsewhere, most
notably in checkbox-converged.

The code has served us well but it is the time to let go and make
checkbox-converged the only application that we use across all of Ubuntu
releases and across different environments (phone, table and desktop).

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * This file is part of Checkbox
3
 
 *
4
 
 * Copyright 2013 Canonical Ltd.
5
 
 *
6
 
 * Authors:
7
 
 * - Julia Segal <julia.segal@cellsoftware.co.uk>
8
 
 *
9
 
 * This program is free software; you can redistribute it and/or modify
10
 
 * it under the terms of the GNU General Public License as published by
11
 
 * the Free Software Foundation; version 3.
12
 
 *
13
 
 * This program is distributed in the hope that it will be useful,
14
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
 * GNU General Public License for more details.
17
 
 *
18
 
 * You should have received a copy of the GNU General Public License
19
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 
 */
21
 
 
22
 
 
23
 
import QtQuick 2.0
24
 
import Ubuntu.Components 0.1
25
 
import Ubuntu.Components.Popups 0.1
26
 
import "."
27
 
 
28
 
DarkDialog {
29
 
    id: dialog
30
 
 
31
 
    title: i18n.tr("Report")
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."))
33
 
 
34
 
    TextField {
35
 
        RegExpValidator {
36
 
            id: regex_validator
37
 
            regExp: new RegExp(settings.value("submission/regex", ".*"));
38
 
        }
39
 
        function initialize() {
40
 
            var input_type = settings.value("submission/input_type", "")
41
 
            if (input_type == "regex") {
42
 
                validator = regex_validator;
43
 
                visible = true;
44
 
            }
45
 
            else if (input_type == "none") {
46
 
                visible = false;
47
 
            }
48
 
            else {
49
 
                inputMethodHints = Qt.ImhEmailCharactersOnly;
50
 
                visible = true;
51
 
            }
52
 
            var secure_id = settings.value("submission/secure_id","");
53
 
            if (secure_id) {
54
 
                text = secure_id;
55
 
            }
56
 
        }
57
 
 
58
 
        id: upload_input
59
 
        placeholderText: settings.value("submission/input_placeholder", i18n.tr("Launchpad E-Mail Address"))
60
 
        Component.onCompleted: initialize()
61
 
    }
62
 
 
63
 
    Row {
64
 
        function initialize() {
65
 
            if (settings.value("submission/submit_to_hexr","false").toLowerCase() == "true") {
66
 
                visible = true;
67
 
            }
68
 
        }
69
 
 
70
 
        spacing: units.gu(8)
71
 
        visible: false
72
 
        Label {
73
 
            id: submit_to_hexr_label
74
 
            text: i18n.tr("Submit to HEXR:")
75
 
        }
76
 
 
77
 
        CheckBox {
78
 
            id: submit_to_hexr
79
 
            text: i18n.tr("Submit to HEXR:")
80
 
        }
81
 
        Component.onCompleted: initialize()
82
 
 
83
 
    }
84
 
 
85
 
    Button {
86
 
        id: submitbutton
87
 
        text: settings.value("submission/ok_btn_text", i18n.tr("Submit Results"))
88
 
        enabled: upload_input.acceptableInput
89
 
        color: UbuntuColors.orange
90
 
        onClicked: {
91
 
            var submit_to = settings.value("transport/submit_to", "")
92
 
            var export_path = settings.value("exporter/xml_export_path", "/tmp/submission.xml")
93
 
 
94
 
            if (submit_to == "certification") {
95
 
                if (updater.success) {
96
 
                    dialog.text = guiEngine.SendSubmissionViaCertificationTransport(export_path,
97
 
                                                                                    upload_input.text,
98
 
                                                                                    submit_to_hexr.checked);
99
 
                }
100
 
                else {
101
 
                    dialog.text = i18n.tr("Could not export the tests results for uploading.");
102
 
                }
103
 
            }
104
 
            else {
105
 
                dialog.text = guiEngine.SendSubmissionViaLaunchpadTransport(export_path,
106
 
                                                                            upload_input.text);
107
 
            }
108
 
        }
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
 
            reportTypeModel.append({"type": "json", "name": i18n.tr("JSON Report (*.json)")})
116
 
        }
117
 
 
118
 
        id: reportTypeModel
119
 
        Component.onCompleted: initialize()
120
 
    }
121
 
 
122
 
    Component {
123
 
        id: reportTypeDelegate
124
 
        OptionSelectorDelegate {
125
 
            text: name
126
 
        }
127
 
    }
128
 
 
129
 
    OptionSelector {
130
 
        id: reportTypeSelect
131
 
        model: reportTypeModel
132
 
        delegate: reportTypeDelegate
133
 
    }
134
 
 
135
 
    Button {
136
 
        id: save_button
137
 
        text: i18n.tr("Save Report")
138
 
        color: UbuntuColors.lightAubergine
139
 
        onClicked: {
140
 
            var option_list = new Array("client-name=" + client_name, "with-certification-status");
141
 
            var success = false;
142
 
            if (reportTypeSelect.selectedIndex == 0) {
143
 
                var exporter_unit = settings.value("exporter/XML", "2013.com.canonical.plainbox::hexr")
144
 
                var path = guiEngine.GetSaveFileName('submission.xml',
145
 
                    i18n.tr("XML files (*.xml)"))
146
 
                success = guiEngine.GuiExportSessionToFileAsXML(path,
147
 
                                                                option_list,
148
 
                                                                exporter_unit);
149
 
            }
150
 
            else if (reportTypeSelect.selectedIndex == 1) {
151
 
                var exporter_unit = settings.value("exporter/XLSX", "2013.com.canonical.plainbox::xlsx")
152
 
                var path = guiEngine.GetSaveFileName('submission.xlsx',
153
 
                    i18n.tr("XLSX files (*.xlsx)"))
154
 
                success = guiEngine.GuiExportSessionToFileAsXLSX(path, ["with-sys-info", "with-summary", "with-job-description", "with-text-attachments"], exporter_unit);
155
 
            }
156
 
            else if (reportTypeSelect.selectedIndex == 2) {
157
 
                var exporter_unit = settings.value("exporter/JSON", "2013.com.canonical.plainbox::json")
158
 
                var path = guiEngine.GetSaveFileName('submission.json',
159
 
                    i18n.tr("JSON files (*.json)"))
160
 
                success = guiEngine.GuiExportSessionToFileAsJSON(path, ["with-certification-status", "with-job-defs", "with-io-log", "with-comments"], exporter_unit);
161
 
            }
162
 
 
163
 
            if (success) {
164
 
                runmanagerview.reportIsSaved = success;
165
 
            }
166
 
        }
167
 
    }
168
 
 
169
 
    Button {
170
 
        id: view_button
171
 
        text: i18n.tr("View Results")
172
 
        color: UbuntuColors.lightAubergine
173
 
        onClicked: {
174
 
            onClicked:{
175
 
                var mysavepath = '/tmp/report.html';
176
 
                var exporter_unit = settings.value("exporter/HTML", "2013.com.canonical.plainbox::html")
177
 
                var option_list = new Array("client-name=" + client_name, "with-certification-status");
178
 
                runmanagerview.reportIsSaved = guiEngine.GuiExportSessionToFileAsHTML(mysavepath,
179
 
                                                                                      option_list,
180
 
                                                                                      exporter_unit);
181
 
                Qt.openUrlExternally(mysavepath);
182
 
            }
183
 
        }
184
 
    }
185
 
    Button {
186
 
        id: donebutton
187
 
        text: i18n.tr("Done")
188
 
        color: UbuntuColors.warmGrey
189
 
        onClicked: {
190
 
            if (!runmanagerview.reportIsSaved)
191
 
                PopupUtils.open(submission_warning_dialog, donebutton);
192
 
            else
193
 
                PopupUtils.close(dialog)
194
 
        }
195
 
    }
196
 
 
197
 
    Component {
198
 
        id: submission_warning_dialog
199
 
        WarningDialog{
200
 
            text: settings.value("submission/cancel_warning", i18n.tr("You are about to exit this test run without saving your results report.  Do you want to save the report?"))
201
 
 
202
 
            showContinue: false
203
 
            showCheckbox: false
204
 
 
205
 
            onCancel: PopupUtils.close(dialog)
206
 
        }
207
 
    }
208
 
}