Today's Update to CA (2019.08.05) opens up a few more functions for plugin authors to use
addBannerWarning and removeBannerWarning
These functions allow a plugin author to add a warning across the unRaid banner to display any important warnings, etc (ie: something like "A reboot is required for changes to take effect")
Usage is simple:
if (typeof addBannerWarning === "function" ) {
addBannerWarning("A Reboot Is Required For These Changes To Take Effect");
}
This will automatically add a little warning symbol prior to the message and also allow the user to dismiss the warning by clicking a little "x" at the right
If you want your plugin to be able to remove the banner if circumstances change, then you'll change the syntax slightly:
if (typeof addBannerWarning === "function" ) {
var myWarning = addBannerWarning("A Reboot Is Required For These Changes To Take Effect");
}
.
.
.
if (typeof removeBannerWarning === "function" ) {
removeBannerWarning(myWarning);
}
You can also slightly customize slightly the options with the warnings:
addBannerWarning(text,warning=true,noDismiss=false)
warning = true|false will select whether or not to display the little warning icon prior to the warning text
noDismiss = true|false will select whether or not the warning is dismiss-able or not
A dismiss-able warning is handled via a cookie that expires at the end of the session. If the user has dismissed the warning, then so long as that session is active, the warning will not re-appear
Any dismiss-able warning should be unique, as the cookie that determines whether or not the warning has been dismissed is the alphanumeric text of the warning (sans spaces, special characters, etc)
If there are multiple warnings or upgrade notices, then the browser will cycle through them all with a delay of 10 seconds.
* Note: All banner warnings take place in the banner itself. It is not possible to relocate them to a separate element.
If you want to see this in action, go to settings - Docker and disable the docker service then go to the Apps Tab.