Skip to content

Commit 256207d

Browse files
author
Rafael Grigorian
committed
Fixed #44
1 parent 486ca4c commit 256207d

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

src/app/code/JetRails/Cloudflare/view/adminhtml/web/js/bundle.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11110,15 +11110,21 @@ function loadSections ( additional = "" ) {
1111011110
return false
1111111111
}
1111211112
if ( hasErrors ( response ) ) {
11113+
var header = "Authorization Error"
11114+
var message = "It appears that the configured Cloudflare token does not have sufficient permissions to render this section."
11115+
if ( response && response.errors && response.errors.some ( e => e.message.startsWith ("API Tokens are not supported") ) ) {
11116+
header = "Unsupported Error"
11117+
message = "Currently, this API endpoint cannot be used with token authorization. This may change in the future."
11118+
}
1111311119
$(section).find (".row:nth-child( n + 2 )").remove ()
1111411120
$(section).find (".wrapper_bottom").remove ()
1111511121
$(section).find (".wrapper_right").remove ()
1111611122
$(section).find (".wrapper_left *:nth-child( n + 3 )").remove ()
1111711123
$(section).find (".row").append (`
1111811124
<div class="wrapper_right" >
1111911125
<div>
11120-
<h5 class="error" >Authorization Error</h5>
11121-
<p>It appears that the configured Cloudflare token does not have sufficient permissions to render this section.</p>
11126+
<h5 class="error" >${header}</h5>
11127+
<p>${message}</p>
1112211128
</div>
1112311129
</div>
1112411130
`)

src/app/code/JetRails/Cloudflare/view/adminhtml/web/js/bundle.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/code/JetRails/Cloudflare/view/adminhtml/web/js/common.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,21 @@ function loadSections ( additional = "" ) {
2727
return false
2828
}
2929
if ( hasErrors ( response ) ) {
30+
var header = "Authorization Error"
31+
var message = "It appears that the configured Cloudflare token does not have sufficient permissions to render this section."
32+
if ( response && response.errors && response.errors.some ( e => e.message.startsWith ("API Tokens are not supported") ) ) {
33+
header = "Unsupported Error"
34+
message = "Currently, this API endpoint cannot be used with token authorization. This may change in the future."
35+
}
3036
$(section).find (".row:nth-child( n + 2 )").remove ()
3137
$(section).find (".wrapper_bottom").remove ()
3238
$(section).find (".wrapper_right").remove ()
3339
$(section).find (".wrapper_left *:nth-child( n + 3 )").remove ()
3440
$(section).find (".row").append (`
3541
<div class="wrapper_right" >
3642
<div>
37-
<h5 class="error" >Authorization Error</h5>
38-
<p>It appears that the configured Cloudflare token does not have sufficient permissions to render this section.</p>
43+
<h5 class="error" >${header}</h5>
44+
<p>${message}</p>
3945
</div>
4046
</div>
4147
`)

0 commit comments

Comments
 (0)