How does the plugin system work? Documentation Added - WIP


dlandon

Recommended Posts

Dynamix has a status indicator you can use to show the status of your process.  Details are in the OP.

 

I would encourage you to do this to be consistent with the way dynamix shows process status.

Thanks that's very useful.  Another thing that's useful is the tabs.  I've been helping Peter with his openvpn plugins.  So instead of having everything on one page it's tabbed with settings and logs.  It could be useful for your apcupsd to show full ups status in a separate tab. Or you could have 3 tabs with a main status page, settings page and full status page.

 

Great idea. I'll look into it.

Link to comment
  • Replies 195
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Dynamix has a status indicator you can use to show the status of your process.  Details are in the OP.

 

I would encourage you to do this to be consistent with the way dynamix shows process status.

Thanks that's very useful.  Another thing that's useful is the tabs.  I've been helping Peter with his openvpn plugins.  So instead of having everything on one page it's tabbed with settings and logs.  It could be useful for your apcupsd to show full ups status in a separate tab. Or you could have 3 tabs with a main status page, settings page and full status page.

 

Get me started. What does the base page file have in it to enable tabs?

Link to comment

You need to break the single file into multiple files, each file will represent a different tab.

 

You can force the display of tabs or not, by setting Tabs="true" or Tabs="false" in the file header, when this entry is not present the page will be viewed depending on the setting of "page view".

 

Link to comment

You need to break the single file into multiple files, each file will represent a different tab.

 

You can force the display of tabs or not, by setting Tabs="true" or Tabs="false" in the file header, when this entry is not present the page will be viewed depending on the setting of "page view".

 

Like this with separate page files for each tab?

 

Menu="OtherSettings"
Icon="apcupsd.png"
Version="2014.12.05"
Author="seeDrs/dlandon"
Title="APC UPS"
Tabs="true"

Link to comment

It depends a bit on the structure you want to build, in your case a 'master' file is created under "Othersettings" or another parent. The header section for this file looks file:

 

Menu="OtherSettings"

Type="xmenu"

Title="APC UPS"

Icon="apcupsd.png"

Tabs="true"

---

 

The next file (tab) within the APC section then has a header section as follows (assuming the master file is called "APCUPS.page"):

 

Menu="APCUPS"

Title="More Settings"

---

 

Link to comment

It depends a bit on the structure you want to build, in your case a 'master' file is created under "Othersettings" or another parent. The header section for this file looks file:

 

Menu="OtherSettings"

Type="xmenu"

Title="APC UPS"

Icon="apcupsd.png"

Tabs="true"

---

 

The next file (tab) within the APC section then has a header section as follows (assuming the master file is called "APCUPS.page"):

 

Menu="APCUPS"

Title="More Settings"

---

 

And that trick you told me about sorting helps too for each child page.

Menu="APCUPS:1"

Menu="APCUPS:2"

And each page needs an icon in the icons folder.  I just borrowed from /usr/local/emhttp/plugins/dynamix/icons and renamed.

 

Can you explain about the tablesorter tables? I was able to correct the margins through css or style but I wasn't sure why sometimes the top margin would be so different.

 

Link to comment

It depends a bit on the structure you want to build, in your case a 'master' file is created under "Othersettings" or another parent. The header section for this file looks file:

 

Menu="OtherSettings"

Type="xmenu"

Title="APC UPS"

Icon="apcupsd.png"

Tabs="true"

---

 

The next file (tab) within the APC section then has a header section as follows (assuming the master file is called "APCUPS.page"):

 

Menu="APCUPS"

Title="More Settings"

---

 

And that trick you told me about sorting helps too for each child page.

Menu="APCUPS:1"

Menu="APCUPS:2"

And each page needs an icon in the icons folder.  I just borrowed from /usr/local/emhttp/plugins/dynamix/icons and renamed.

 

I figured out the sorting.  Pretty slick way to control the order of the tabs.  I have released another apcupsd update.

 

Is there a way to get the full bar back with the icon and "APC UPS" text and the status on the right?  I'd like to have the full bar as it was and then the two menu tabs underneath if possible.

Link to comment

I figured out the sorting.  Pretty slick way to control the order of the tabs.  I have released another apcupsd update.

 

Is there a way to get the full bar back with the icon and "APC UPS" text and the status on the right?  I'd like to have the full bar as it was and then the two menu tabs underneath if possible.

Yes this is how I help set it up for openvpn before you shared your status trick.  But you may need to adjust style="..." to get it where you want.

<table class="tablesorter"  style="margin-top: -21px">
   <thead>
      <th colspan="2"><b>Status: </b><img src='/plugins/openvpnserver/images/device_status.png'>
         <?if ($openvpnserver_running=="yes"):?>
            <span class="green"><b>OpenVPN Server is RUNNING</b></span>
         <?else:?>
            <span class="red"><b>OpenVPN Server is NOT RUNNING</b></span>
        <?endif;?>
          </span>
       </th>
       <th class="header"></th>
   </thead>
</table>

 

Also you could add this to the status tab table to move it to the right a bit.

 

echo "<br />
           <table  class='settings' style='margin-left: 10px'>
      </tr>";

 

Edit: You may need to adjust the colspan and add align="left for the title and align="right" for the status

You could also use a similar method like the plugins tabs where the check for updates button is on the right but instead have it show status instead.

 

Link to comment

I had a question though too about apcupsd.  I know you have to stop the daemon to change settings.  It may have been that way before you took it over.  I wasn't sure why seetings couldn't be available to change at anytime and then apply saves them and restarts the daemon.  I've just seen it asked a few times why someone can't change settings.  No big deal.  But it looks great with what youv'e done.

Link to comment

I had a question though too about apcupsd.  I know you have to stop the daemon to change settings.  It may have been that way before you took it over.  I wasn't sure why seetings couldn't be available to change at anytime and then apply saves them and restarts the daemon.  I've just seen it asked a few times why someone can't change settings.  No big deal.  But it looks great with what youv'e done.

 

Thanks for the feedback.  I agree that it is a bit rough when changing settings and I'll take a look at it again.  It wasn't really a priority before, but I think if I can do anything to keep down support issues, it is worth it.  I'll have a go at it.

Link to comment

I had a question though too about apcupsd.  I know you have to stop the daemon to change settings.  It may have been that way before you took it over.  I wasn't sure why seetings couldn't be available to change at anytime and then apply saves them and restarts the daemon.  I've just seen it asked a few times why someone can't change settings.  No big deal.  But it looks great with what youv'e done.

 

Thanks for the feedback.  I agree that it is a bit rough when changing settings and I'll take a look at it again.  It wasn't really a priority before, but I think if I can do anything to keep down support issues, it is worth it.  I'll have a go at it.

 

Turned out to be a piece of cake.  Not sure why the form was read only when the ups daemon was running.  I'll work with it a bit to be sure I didn't break anything.

Link to comment

Tried "setsid" but it holds plugin installation, like when executing the command directly.

 

The "at" approach makes the plugin installation continue.

 

I have just encountered the problem of the web page not refreshing after starting/restarting a plugin process.  I found that sudo works fine ... but why setsid doesn't is not clear.

Link to comment

Can a plugin automatically restart after downloading an update via the plugin manager, or must this always be a manually operation.

 

If it can be done automatically, what is needed in the .plg file?

 

I'm not sure what you are asking here, but I don't think a plugin can tell if it is being installed the first time or being updated.

Link to comment
  • 2 weeks later...

Hmm I had a look at the page code, it's only a link if appname.page is detected. But the link goes no where.

 

Right, this is something I've been meaning to address with Tom.  There is a way to make the icon either clickable or not.  PHAzE, I'll ask Tom to either chime in here or give me feedback on this so I can share here.  Beat me over the head with a stick if I don't get back to you on this by end of next week ;-).

Link to comment

Hmm I had a look at the page code, it's only a link if appname.page is detected. But the link goes no where.

 

Right, this is something I've been meaning to address with Tom.  There is a way to make the icon either clickable or not.  PHAzE, I'll ask Tom to either chime in here or give me feedback on this so I can share here.  Beat me over the head with a stick if I don't get back to you on this by end of next week ;-).

 

Let me chime in here ...

 

The purpose of the link is to have a direct jump possible to the page which is used by the particular plugin, however most plugins do not live under their own page, e.g. they are under settings or some other page. This makes the direct link not functioning most of the time.

 

In Dynamix v5 it was a programmable variable, but this isn't present in the current plugin (plg) concept, I guess it is something for future consideration.

 

Link to comment

So on the plugin manager page it shows you the plugins you have installed. The icons are clickable. I assume this is so you can go to the gui php page but I'm not sure how to set it. Does that makes sense?

 

A direct jump to the plugin's configuration page makes a great deal of sense.

Link to comment

So on the plugin manager page it shows you the plugins you have installed. The icons are clickable. I assume this is so you can go to the gui php page but I'm not sure how to set it. Does that makes sense?

 

A direct jump to the plugin's configuration page makes a great deal of sense.

 

I am not a plugin developer (Yet) but this make absolute sense to me. I got really confused at first when I installed my first plugin, only to have to hunt though the menus to descover where it was located. Clicking the plugin icon or link seems way more intuitive.

Link to comment

I think the challenge here is that plugins do not necessarily need to enumerate a control panel at all.  Some just modify the existing look/feel of unRAID's standard page files.  Dynamix at one point was a great example of that as a web UI plugin.  It itself didn't need a control panel for the base plugin at all.

 

The second challenge is that plugins today enumerate icons typically under the settings page, but technically can do so to any page.  We'd like to avoid redundancy where possible, so what's the right answer here?  Centralize all plugin icons to the plugins page and remove the ability to create new icons for plugins outside of that page?  Simply instruct developers to not bother creating icons on other pages because this method is available?

 

Another challenge is familiarity.  Many users are already comfortable with how the existing plugin system works.  We could end up with a lot of threads asking "where did my settings page for X plugin go?"

 

While I agree that fundamentally, this makes sense to do, there are other considerations that we should take into account before we do such things.

Link to comment

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.