File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed
src/app/code/JetRails/Cloudflare/view/adminhtml/web/js Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff 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 `)
Original file line number Diff line number Diff 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 ` )
You can’t perform that action at this time.
0 commit comments