Commit 542604af authored by William Grzybowski's avatar William Grzybowski
Browse files

Add a new system hook replacing static button for Performance Test

Ticket:	#5466
parent 340490ef
No related merge requests found
Showing with 31 additions and 1 deletion
+31 -1
......@@ -24,4 +24,6 @@
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
from freenasUI.freeadmin.apppool import appPool
from .hook import SystemHook
appPool.register(SystemHook)
from django.core.urlresolvers import reverse
from django.utils.html import escapejs
from django.utils.translation import ugettext as _
from freenasUI.freeadmin.hook import AppHook
class SystemHook(AppHook):
name = 'system'
def hook_form_buttons_AdvancedForm(self, form, action, *args, **kwargs):
from freenasUI.middleware.notifier import notifier
has_failover = hasattr(notifier, 'failover_status')
btns = []
if (
has_failover and notifier().failover_status in ('MASTER', 'SINGLE')
or not has_failover
):
btns.append({
'name': 'PerfTester',
'verbose_name': _('Performance Test'),
'onclick': 'editScaryObject(\'%s\', \'%s\');' % (
escapejs(_('Performance Test')),
escapejs(reverse('system_perftest')),
),
})
return btns
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment