Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
truenas-rk3588
truenas
Commits
542604af
Commit
542604af
authored
10 years ago
by
William Grzybowski
Browse files
Options
Download
Email Patches
Plain Diff
Add a new system hook replacing static button for Performance Test
Ticket: #5466
parent
340490ef
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gui/system/__init__.py
+3
-1
gui/system/__init__.py
gui/system/hook.py
+28
-0
gui/system/hook.py
with
31 additions
and
1 deletion
+31
-1
gui/system/__init__.py
View file @
542604af
...
...
@@ -24,4 +24,6 @@
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
from
freenasUI.freeadmin.apppool
import
appPool
from
.hook
import
SystemHook
appPool
.
register
(
SystemHook
)
This diff is collapsed.
Click to expand it.
gui/system/hook.py
0 → 100644
View file @
542604af
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
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help