Closed 1337rout closed 3 months ago
If the site isn't on our Cloudflare Enterprise setup, we should display a message in the box. Easy to tell, we just need to show this if the Firewall setting is on "Sucuri" or "None/Other":
It looks like your site isn't currently on our Cloudflare Enterprise service. Please contact us to discuss how this feature can help your site's performance and security.
@1337rout I installed on eatingrules.com, which is on Cloudflare Enterprise (DNS 3). It's not showing anything in the box. It's pointed to the production server.
@blogtutor relay doesn’t have the API available yet. There’s still an open PR for it. https://github.com/blogtutor/np-dashboard/pull/483
I’ll bug Jon to get it reviewed for me so it’ll be easier to test this one.
Oh! Well that would explain it. 🤦♂️
Approved with one suggestion
@blogtutor I have removed the disclaimer text in favor of letting Relay send it along with the graph. I'll let you know when the relay change is up on at least relaydev.nerdpress!
&& now it's on relaydev!
Hey @1337rout - could you please change the text in the widget header to just "NerdPress Stats"? And we'd like to change the icon to be teal on dark blue -- using a circle not a rounded square. Let me know if you need a hand with converting the image format. Thanks!
I just noticed that we're not appending a versioned query string to this request:
https://eatingrules.com/wp-content/plugins/blog-tutor-support-feature-display-cloudflare-graph-from-relay/includes/css/html-admin-menu.css
Which means that if we don't clear the Cloudflare cache after updating the support plugin, the widget ain't gonna look so good. Can you please add a query string with the plugin version number? Pretty sure we already have that as a constant elsewhere, so don't reinvent any wheels.
I just noticed that we're not appending a versioned query string to this request:
https://eatingrules.com/wp-content/plugins/blog-tutor-support-feature-display-cloudflare-graph-from-relay/includes/css/html-admin-menu.css
Which means that if we don't clear the Cloudflare cache after updating the support plugin, the widget ain't gonna look so good. Can you please add a query string with the plugin version number? Pretty sure we already have that as a constant elsewhere, so don't reinvent any wheels.
@blogtutor ~So we don't have that variable, or at least not using it when enqueuing js.~ We aren't properly enqueuing the styles. Are you okay with a hard-coded value now and a new issue to fix all of our enqueues and convert all uses of stylesheets to be properly enqueued?
Ignore me I found it, we're using it when registering the scripts, not enqueuing them.
Just put latest version of the branch on Eating Rules. Looking good!
✅ N icon looks good. (I agree it's a half-pixel off to the left but I'll [try to] accept that as wabi-sabi) ✅ Help Scout beacon opens, even if it hadn't been initialized already. ✅ Admin CSS now has a version number.
✅ And the stats widget now correctly does not show for contributor
and editor
users (those are the only two I tested - looks good.)
@blogtutor did you check that changing the firewall setting sends a snapshot so you don't have to manually do this?
Ah! Thanks for reminding me.
I just tested on Eating Rules, which is sending to relaydev right now. It DID correctly try to send snapshots back on setting save, and also appears to be doing it only when I make a change to the settings. (This is desired/expected behavior, right?)
BUT both requests also timed out. Seems unrelated but maybe something we should look into elsewhere?
cURL error 28: Operation timed out after 5000 milliseconds with 0 out of -1 bytes received
Ah! Thanks for reminding me.
I just tested on Eating Rules, which is sending to relaydev right now. It DID correctly try to send snapshots back on setting save, and also appears to be doing it only when I make a change to the settings. (This is desired/expected behavior, right?)
BUT both requests also timed out. Seems unrelated but maybe something we should look into elsewhere?
cURL error 28: Operation timed out after 5000 milliseconds with 0 out of -1 bytes received
Weird that I am not getting this on my local. This is worrisome as I don't think it actually sent. I'll look into it further.
It did send. I'm using Log HTTP requests.
I see the issue. It's with relay. A response is never sent back to the requesting server (client plugin). I can work on getting this updated to send a response. I'll make an issue to get this fixed.
Ah, so it's saving the snapshot but then the client's not getting back a "Success" message. Got it.
@blogtutor I solved this in https://github.com/blogtutor/np-dashboard/pull/526 and have put it on relaydev. Can you check again, please?
Still getting a timeout after 5 seconds.
@blogtutor I just increased the timeout on the request to 20 seconds just to be safe, I guess my local is just too fast for this to happen. :shrug: at least the curl 28 isn't showing in my debug log.
Ok so I remember now that we ran into some issues with this kind of stuff a long time ago, and that's why we're not waiting for a response.
This should probably be moved to a separate issue and future PR -- because it's really a bigger thing to look into. (Perhaps this is also related to some sites not successfully sending snapshots back because of something slow at Relay, not because of cron issue son the client end).
Maybe for now we should revert these recent changes and have a convo with Jon, as he'll probably remember details better than I do.
Adds a dashboard widget that sends a request to relay for the Cloudflare pageviews html and renders it.