Feature request: Confirm to uninstall a plugin.

Discussions on developing plugins for the Cacti Plugin Architecture

Moderators: Developers, Moderators

Post Reply
User avatar
browniebraun
Developer
Posts: 791
Joined: Tue Jun 13, 2006 1:17 am
Location: Cologne, Germany

Feature request: Confirm to uninstall a plugin.

Post by browniebraun »

Hi Jimmy!

I'm currently working on ReportIt 0.7.0 and implemented the features of PIA 2.x last weekend. During a test of "plugin_reportit_uninstall" I realised that all data will be removed directly. Mmmhhh ... that's a little bit too fast.

So, how do you think about a confirmation box to avoid that?

I modified your function "update_show_current()" to test it with some lines of Java Script.

added:

Code: Select all

    ?>
    <script type="text/javascript">
    <!--

    function confirmation(plugin) {
    	var answer = confirm("Do you really want to uninstall " + plugin.toUpperCase() + " ?\nPlease note that individual settings, results and configurations of that plugin will get lost." )
    	if (answer){
            window.location = "plugins.php?mode=uninstall&id=" + plugin;
    	}
    }
    //-->
    </script>
    <?php
changed:

Code: Select all

					$links['uninstall'] = "<font color='blue' "
											. " onmouseover=\"this.style.textDecoration='underline';this.style.color='black';\" "
											. " onmouseout=\"this.style.textDecoration='none';this.style.color='blue'\" "
											. " onclick=confirmation('$plugin') style='cursor:pointer;'><b>Uninstall</b></font>";
Ok, the second part looks a little bit strange, but it's the only way I know how it will work with Opera too.

Best regards
-Andreas-
Attachments
Confirmation
Confirmation
confirm.png (58.65 KiB) Viewed 5515 times
Hat das Blümchen einen Knick, war der Schmetterling zu dick! ;)
reportit v0.7.5a
SNMPAgent v0.2.3
Download ReportIt | Download SNMPAgent | ReportIt SVN | ReportIt Templates | Wish list
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

This is why I added only an empty function for _uninstall() too... far too easy to just remove all your data. I would cry for quite some time if I did that with thold.

Also, when the _check() is implemented, that should be able to return a message to the user about why the check failed.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Ya, I will definitely add that. I am currently working on several new functions too that are needed for upgrades, updating / adding hooks, adding indexes, updating realm filenames, etc... I am also looking into an automatic version tracking, and a few things I noticed when writing a major upgrade for thold.

Lots and lots of work still needed. Keep the ideas coming so I can see the issues that everyone else is running into.


BTW, even with the uninstall hook blank, it will still wipe out all the data, as long as it used the plugin function to install the tables. It logs the tables and columns it added, so it knows what to remove when the time comes. The uninstall function is just incase there is anything extra, like temp files, that you want to remove.

I think ALOT of documentation is in order also.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

cigamit wrote:BTW, even with the uninstall hook blank, it will still wipe out all the data, as long as it used the plugin function to install the tables. It logs the tables and columns it added, so it knows what to remove when the time comes. The uninstall function is just incase there is anything extra, like temp files, that you want to remove.

I think ALOT of documentation is in order also.
You can say that again. I didn't know there even was an api function to create tables. :-)

I've accidentally uninstalled plugins a number of times recently, and *especially* since the blocks in the Plugin Management move around depending on whether plugins are enabled (thought you uninstalled the plugin you just disabled? nope, sorry). That makes having it also automatically delete all my data without warning seem like a bad idea. Perhaps at least the option to dump the tables to a file before dropping them would be useful...
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Howie wrote:*especially* since the blocks in the Plugin Management move around depending on whether plugins are enabled
I will be fixing that next, its a pain now that the new version shows all plugins and everything is jumpy. I will just sort it by alphabetical.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests