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.

Need help accessing plugin tabs from multiple menus in the webui

Featured Replies

I am working on a plugin that has 2 tabs, main and settings. Main is the first tab and settings is the second tab. I'm having issues trying to access different parts of my plugin from different parts of the webui in a cohesive way. I'd like it so in the UnRaid webui under Settings>User Utilities I can click on my plugin icon and it will go to the settings tab of my plugin. I'd also like to go to the UnRaid webui under Tools>Disk Utilities and click on my plugin and have it go to the main tab. I don't know if there is any way to do this. I can have it with no tabs at all but that isn't very user friendly for the user having to go through more clicks in the webui.  Any auggestions?

Not quite sure what you are trying to achieve.   What I think you are saying is that you are going to have 2 page files - one located on the Settings tab and one located on the Tools tab?  If that is what you want it will be easy to achieve.    Do you really want the one on the Tools tab to go into its own Disk Utilities area rather than adding it to one of the existing ones? This is achievable but a bit more work than adding it to one of the existing areas.

  • Author

Yeah, I didn't word it very well. I'm still toying with how I want to do things. To rephrase, the first tab is the main tab and the second tab is the settings. Basically, if I go to the plugin through Tools in the UnRaid webui it should go to the first tab and if I go to the plugin through the Settings in the webui, it should go to the second tab, which is my plugin settings. I hope that clears things up.

Then you simply need to add the right header to your page file.

 

As an example in my Parity Check Tuning plugin I use:

Menu="Scheduler:1b"
Title="Parity Check Tuning"
Tag="gear"
---

to add a new page to the Scheduler section of the Settings page.   You may want to add it to a different section?

 

I then use 

Menu="About"
Title="Parity Problems Assistant"
Tag="gear"
---

to add it to the "About Section" of the Tools page.

 

You can look at the existing page files stored at /usr/local/emhttp/webGui to see examples.   That also shows how to create a new section within an existing page (use the About.page as a simple example).

 

Also note that your page files need not contain the bulk of your actual plugin code. You can implement the functionality in a php file and include it in one or more page files.

 

Author="dcflachs"
Title="Compose"
Type="php"
Menu="Docker:2"
Cond="(pgrep('dockerd')!==false)"
---
<?php include '/usr/local/emhttp/plugins/compose.manager/php/compose_manager_main.php';?>

 

  • Author
On 6/8/2023 at 7:36 AM, primeval_god said:

Also note that your page files need not contain the bulk of your actual plugin code. You can implement the functionality in a php file and include it in one or more page files.

 

Author="dcflachs"
Title="Compose"
Type="php"
Menu="Docker:2"
Cond="(pgrep('dockerd')!==false)"
---
<?php include '/usr/local/emhttp/plugins/compose.manager/php/compose_manager_main.php';?>

 

I considered that but I don't know how to do that. What does that 'cond' do? I've been using examples but haven't found much documentation on the plg format options.

19 hours ago, bobbintb said:

I considered that but I don't know how to do that. What does that 'cond' do? I've been using examples but haven't found much documentation on the plg format options.

Cond is a condition to evaluate to determine if the page should be displayed. Really the only relevant part of my example is the <?php include ?> line. You should be able to include one or more php files regardless of what the header portion of your .page files looks like (header being everything down to the ---).

  • 1 month later...
  • Author

I stepped away from this for a bit to clear my head but I came back to it and I still can't make heads or tails of it, even after looking at several existing examples for hours on end and trying to extrapolate and experiment. I also forgot about the plugins page which currently point to something that doesn't exist. I just can't seem to get the heading of the pages right. I'll try explaining this again now that I've had some time away from it:
 

1. My plugins is one page with two tabs: `main`, and `settings`
2. Going to `Tools page > Disk Utilities > My Plugin` should go to the `main` tab.

3. Going to `Settings > User Utilities > My Plugin` should go to the `settings` tab.

4. Going to `Plugins > Installed Plugins > My Plugin` should go to the `settings` tab.

I can only get one to work at a time. I can include snapshots or mockups if need be.

3 minutes ago, bobbintb said:

I stepped away from this for a bit to clear my head but I came back to it and I still can't make heads or tails of it, even after looking at several existing examples for hours on end and trying to extrapolate and experiment. I also forgot about the plugins page which currently point to something that doesn't exist. I just can't seem to get the heading of the pages right. I'll try explaining this again now that I've had some time away from it:
 

1. My plugins is one page with two tabs: `main`, and `settings`
2. Going to `Tools page > Disk Utilities > My Plugin` should go to the `main` tab.

3. Going to `Settings > User Utilities > My Plugin` should go to the `settings` tab.

4. Going to `Plugins > Installed Plugins > My Plugin` should go to the `settings` tab.

I can only get one to work at a time. I can include snapshots or mockups if need be.

I would create two page files one for settings link to settings page and main one under tools. Can you post a link to a repo?

You need two .page files

 

And for #4 you need the launch attribute in the <PLUGIN section with a relative URL  Look at pretty much any .plg in /boot/config/plugins and you'll see what I mean

DiskUtilities.page doesn't exist.  If you want that section, then you need that file and it contains something like

Menu="Tools"
Title="Disk Utilities"
Type="menu"
Tag="cogs"

 

then the page file that lives there you have

Menu="DiskUtilities"
Type="menu"
Title="whatever"
Tag="question-circle-o"

 

The page that lives within Settings you do the same except change the Menu to be Utilities

  • Author

I did realize just a few minutes ago that Disk Utilities didn't exist. I didn't realize it was a custom section created by the pre-clear plugin.

The problem I had doing it that way is that they are now separate pages. I was hoping to keep the tabs so once the user gets to the page they don't have to click through the UI a bunch to go between "main" and "settings". I did just find a bit of a trick to get a tabbed page to appear in both "Settings" and "Tools" though. Since it goes off of the name of the page file I copied "Dedupe.page" as "Dedupe .page" and changed "DiskUtilities" to "Utilities". The whitespace gets stripped at the end of the file name. I don't think there is a way to have it go to anything but the first tab though and I'm trying to get the link in the "Settings" page to go to the "Settings" tab, which is second.

Edited by bobbintb

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.