Skip to content

Commit 0b9b133

Browse files
authored
Merge pull request ryantxu#26 from danilogit/master
Adding Show/Hide error messages
2 parents 786a56b + 735dd29 commit 0b9b133

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/examples.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const examples = [
2525
responseType: 'text',
2626
withCredentials: false,
2727
skipSameURL: true,
28+
showErrors: true,
2829

2930
showTime: false,
3031
showTimePrefix: null,

src/module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,10 @@ class AjaxCtrl extends MetricsPanelCtrl {
464464
}
465465

466466
let txt = `<h1>${msg}</h1>`;
467-
if (err) {
467+
if (err && this.panel.showErrors) {
468468
txt += '<pre>' + JSON.stringify(err) + '</pre>';
469+
} else {
470+
txt += '<pre>Something went wrong while executing your request.</pre>';
469471
}
470472

471473
this.ngtemplate.html(txt);

src/partials/editor.request.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ <h5 class="section-heading">Source</h5>
6969
label-class="width-9"
7070
checked="ctrl.panel.skipSameURL"
7171
on-change="ctrl.onConfigChanged()"></gf-form-switch>
72+
<gf-form-switch
73+
class="gf-form"
74+
tooltip="Show/Hide error messages."
75+
label="Show Errors"
76+
label-class="width-9"
77+
checked="ctrl.panel.showErrors"
78+
on-change="ctrl.onConfigChanged()"></gf-form-switch>
7279
</div>
7380

7481

0 commit comments

Comments
 (0)