Skip to content

Commit 4a31cf2

Browse files
authored
Extend submit support ID with problem description field (#3350)
1 parent 62f5cec commit 4a31cf2

File tree

4 files changed

+52
-12
lines changed

4 files changed

+52
-12
lines changed

locales/en/messages.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,9 @@
555555
"supportWarningDialogText": {
556556
"message": "Please confirm data submission to the Betaflight team.<br><br>This process will run some commands and submit the output to the build server.<br><br>You will then be provided a unique identifier for your data submission.<br><br>Please ensure you provide this unique identifier to the Betaflight team when using Discord or opening an issues on Github."
557557
},
558+
"supportWarningDialogInputPlaceHolder": {
559+
"message": "Describe the problem"
560+
},
558561
"releaseCheckLoaded": {
559562
"message" : "Loaded release information for $1 from GitHub."
560563
},

src/css/tabs/cli.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@
5656
border: 1px solid var(--subtleAccent);
5757
resize: none;
5858
}
59+
textarea[name='supportWarningDialogInput'] {
60+
-webkit-box-sizing: border-box;
61+
width: 100%;
62+
margin-top: 8px;
63+
height: 22px;
64+
line-height: 20px;
65+
padding-left: 5px;
66+
border: 1px solid var(--subtleAccent);
67+
resize: none;
68+
}
5969
#content-watermark {
6070
z-index: 0;
6171
}

src/js/tabs/cli.js

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,17 +273,19 @@ cli.initialize = function (callback) {
273273

274274
$('.tab-cli .support').click(function() {
275275

276-
function submitSupportData() {
276+
function submitSupportData(data) {
277277
clearHistory();
278278
const api = new BuildApi();
279-
api.getSupportCommands((commands) => {
279+
280+
api.getSupportCommands(commands => {
281+
commands = [`###\n# Problem description\n# ${data}\n###`, ...commands];
280282
executeCommands(commands.join('\n')).then(() => {
281283
const delay = setInterval(() => {
282284
const time = new Date().getTime();
283285
if (self.lastArrival < time - 250) {
284286
clearInterval(delay);
285287
const text = self.outputHistory;
286-
api.submitSupportData(text, (key) => {
288+
api.submitSupportData(text, key => {
287289
writeToOutput(i18n.getMessage('buildServerSupportRequestSubmission', [key]));
288290
});
289291
}
@@ -292,15 +294,7 @@ cli.initialize = function (callback) {
292294
});
293295
}
294296

295-
const dialogSettings = {
296-
title: i18n.getMessage("supportWarningDialogTitle"),
297-
text: i18n.getMessage("supportWarningDialogText"),
298-
buttonYesText: i18n.getMessage("submit"),
299-
buttonNoText: i18n.getMessage("cancel"),
300-
buttonYesCallback: submitSupportData,
301-
};
302-
303-
GUI.showYesNoDialog(dialogSettings);
297+
self.supportWarningDialog(submitSupportData);
304298
});
305299

306300
// Tab key detection must be on keydown,
@@ -561,6 +555,25 @@ cli.send = function (line, callback) {
561555
serial.send(bufferOut, callback);
562556
};
563557

558+
cli.supportWarningDialog = function (onAccept) {
559+
const supportWarningDialog = $('.supportWarningDialog')[0];
560+
const supportWarningDialogTextArea = $('.tab-cli textarea[name="supportWarningDialogInput"]');
561+
562+
if (!supportWarningDialog.hasAttribute('open')) {
563+
supportWarningDialog.showModal();
564+
565+
$('.cancel').on('click', function() {
566+
supportWarningDialog.close();
567+
});
568+
569+
$('.submit').on('click', function() {
570+
supportWarningDialog.close();
571+
onAccept(supportWarningDialogTextArea.val());
572+
supportWarningDialogTextArea.val('');
573+
});
574+
}
575+
};
576+
564577
cli.cleanup = function (callback) {
565578
if (TABS.cli.GUI.snippetPreviewWindow) {
566579
TABS.cli.GUI.snippetPreviewWindow.destroy();

src/tabs/cli.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,18 @@
4343
<a class="confirm" href="#" i18n="cliConfirmSnippetBtn"></a>
4444
</div>
4545
</div>
46+
47+
<dialog class="supportWarningDialog">
48+
<h3 i18n="supportWarningDialogTitle"></h3>
49+
<div class="content">
50+
<div i18n="supportWarningDialogText"></div>
51+
<div>
52+
<textarea name="supportWarningDialogInput" i18n_placeholder="supportWarningDialogInputPlaceHolder" rows="3" cols="0"></textarea>
53+
</div>
54+
</div>
55+
<div class="buttons">
56+
<a class="submit regular-button" href="#" i18n="submit"></a>
57+
<a class="cancel regular-button" href="#" i18n="cancel"></a>
58+
</div>
59+
</dialog>
4660
</div>

0 commit comments

Comments
 (0)