|
82 | 82 | const req = this.icinga.loader.loadUrl(url, $(modal.querySelector('#modal-content'))); |
83 | 83 | req.addToHistory = false; |
84 | 84 |
|
85 | | - const _this = this; |
86 | | - req.done(function () { |
87 | | - _this.setTitle(req.$target.data('icingaTitle').replace(/\s::\s.*/, '')); |
88 | | - _this.show(); |
89 | | - _this.focus(); |
| 85 | + req.done(() => { |
| 86 | + this.setTitle(req.$target.data('icingaTitle').replace(/\s::\s.*/, '')); |
| 87 | + this.show(); |
| 88 | + this.focus(); |
90 | 89 | }); |
91 | | - req.fail(function (req, _, errorThrown) { |
| 90 | + req.fail((req, _, errorThrown) => { |
92 | 91 | if (req.status >= 500) { |
93 | 92 | // Yes, that's done twice (by us and by the base fail handler), |
94 | 93 | // but `renderContentToContainer` does too many useful things.. |
95 | | - _this.icinga.loader.renderContentToContainer(req.responseText, $(redirectTarget), req.action); |
| 94 | + this.icinga.loader.renderContentToContainer(req.responseText, $(redirectTarget), req.action); |
96 | 95 | } else if (req.status > 0) { |
97 | 96 | const msg = "".concat(...iterator.map( |
98 | 97 | not$.render("<div>" + req.responseText + "</div>").querySelectorAll('.error-message'), |
|
102 | 101 | errorThrown += ': ' + msg; |
103 | 102 | } |
104 | 103 |
|
105 | | - _this.icinga.loader.createNotice('error', errorThrown); |
| 104 | + this.icinga.loader.createNotice('error', errorThrown); |
106 | 105 | } |
107 | 106 |
|
108 | | - _this.hide(); |
| 107 | + this.hide(); |
109 | 108 | }); |
110 | 109 |
|
111 | 110 | return false; |
|
148 | 147 | const req = this.icinga.loader.submitForm($(form), $autoSubmittedBy, $button); |
149 | 148 | req.addToHistory = false; |
150 | 149 |
|
151 | | - const _this = this; |
152 | | - req.done(function (data, textStatus, req) { |
| 150 | + req.done((data, textStatus, req) => { |
153 | 151 | const title = req.getResponseHeader('X-Icinga-Title'); |
154 | 152 | if (!! title) { |
155 | | - _this.setTitle(decodeURIComponent(title).replace(/\s::\s.*/, '')); |
| 153 | + this.setTitle(decodeURIComponent(title).replace(/\s::\s.*/, '')); |
156 | 154 | } |
157 | 155 |
|
158 | 156 | if (req.getResponseHeader('X-Icinga-Redirect')) { |
159 | | - _this.hide(); |
| 157 | + this.hide(); |
160 | 158 | } |
161 | | - }).always(function () { |
162 | | - delete _this.modal?.dataset.noIcingaAjax; |
| 159 | + }).always(() => { |
| 160 | + delete this.modal?.dataset.noIcingaAjax; |
163 | 161 | }); |
164 | 162 |
|
165 | 163 | if (! ('baseTarget' in form.dataset)) { |
|
319 | 317 | this.modal.classList.add("wobble"); |
320 | 318 | } |
321 | 319 |
|
322 | | - const _this = this; |
323 | | - this._wobbleTimeout = setTimeout(function () { |
324 | | - _this.modal?.classList.remove("wobble"); |
325 | | - _this._wobbleTimeout = null; |
| 320 | + this._wobbleTimeout = setTimeout(() => { |
| 321 | + this.modal?.classList.remove("wobble"); |
| 322 | + this._wobbleTimeout = null; |
326 | 323 | }, 1000 - timingOffset); |
327 | 324 | } |
328 | 325 |
|
|
342 | 339 | this.modal.classList.remove("active"); |
343 | 340 |
|
344 | 341 | // Using `setTimeout` here to let the transition finish |
345 | | - const _this = this; |
346 | | - setTimeout(function () { |
347 | | - not$(_this.modal.querySelector('#modal-content')) |
| 342 | + setTimeout(() => { |
| 343 | + not$(this.modal.querySelector('#modal-content')) |
348 | 344 | .trigger('close-modal') |
349 | | - .then(() => _this.modal = null); |
| 345 | + .then(() => this.modal = null); |
350 | 346 | }, 200); |
351 | 347 | } |
352 | 348 | } |
|
0 commit comments