Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Force GUI page refresh?

Featured Replies

I was wondering if anyone knows if there is a way to force the current GUI page to be refreshed from a script that has been initiated via cron or an Unraid event? 

 

The reason I want to be able to do this this is that if the GUI is sitting on the Main tab and the Parity Check Tuning plugin either pauses or resumes a parity operation the GUI does not enable the pause/resume buttons as I would like.   Doing a manual refresh corrects this but it would be tidier if I could do it at an appropriate time from my code running in the background (i.e. not as part of a .page file).

Don't think you can other than your javascript either via nchan or an intermittent post etc checks the status and then reloads the page itself

Why not do it via .page and JS, periodically checking the status of the parity operation and enabling/disabling buttons accordingly?

There'd be no need to do a full page refresh with JS checking the parity operation's status and then enabling/disabling buttons via jQuery.

 

Edited by Rysz

  • Author
4 hours ago, Rysz said:

Why not do it via .page and JS, periodically checking the status of the parity operation and enabling/disabling buttons accordingly?

There'd be no need to do a full page refresh with JS checking the parity operation's status and then enabling/disabling buttons via jQuery.

 

Because I do not own the .page file in question and did not want to try and modify the standard file.    However I wonder if I can add a hidden section to that page  that does a refresh - something to look into.

6 hours ago, itimpi said:

Because I do not own the .page file in question and did not want to try and modify the standard file.    However I wonder if I can add a hidden section to that page  that does a refresh - something to look into.

 

That's what I meant, you can create a seperate .page file in your plugin for this, specifically by using the "Buttons" menu your hidden code will be available on all GUI pages. Then you can use PHP to make sure it is included only on the "Main" page where it is needed. Using JS you could then communicate with (for example) a PHP script of your plugin that returns the parity check status, afterwards parsing that result and then using jQuery to enable/disable the respective buttons on the fly. That checking function could be run periodically using a timer, say every 5 seconds or whatever time you set.

 

There's no real need to cause a full page refresh, you could just update the relevant parts using jQuery.


Here's an example .page file that would achieve such a hidden code insertion:

 

Menu="Buttons:198"
Link="nav-user"
---

<?if(stripos($path, "main") !== false):?>
<script type="text/javascript">
  // this section gets added to all GUI pages where path has 'main' in the URL
  // could check for parity check status here, e.g. communicating with PHP script
  // or checking for file existence. could parse result and enable/disable parity
  // buttons using jQuery afterwards. a timer could run check function periodically.
</script>
<?endif;?>

 

Edited by Rysz

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.