Add mobile support for datasync restart
This commit is contained in:
parent
22c7fee0f6
commit
06dee96af6
|
@ -37,3 +37,10 @@ $(document).on('pageshow', function() {
|
|||
el.focus();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(document).on('click', '#datasync-restart', function() {
|
||||
|
||||
// disable datasync restart button when clicked
|
||||
$(this).button('disable');
|
||||
});
|
||||
|
|
|
@ -72,6 +72,9 @@
|
|||
% elif request.is_admin:
|
||||
<li class="root-user" data-icon="forbidden">${h.link_to("Become root", url('become_root'), **{'data-ajax': 'false'})}</li>
|
||||
% endif
|
||||
% if request.has_perm('datasync.restart'):
|
||||
<li>${h.link_to("DataSync", url('datasync.mobile'))}</li>
|
||||
% endif
|
||||
<li data-icon="lock">${h.link_to("Logout", url('logout'), **{'data-ajax': 'false'})}</li>
|
||||
<li data-icon="info">${h.link_to("About {}".format(capture(self.app_title)), url('mobile.about'))}</li>
|
||||
</ul>
|
||||
|
|
8
tailbone/templates/mobile/datasync.mako
Normal file
8
tailbone/templates/mobile/datasync.mako
Normal file
|
@ -0,0 +1,8 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="/mobile/base.mako" />
|
||||
|
||||
<%def name="title()">DataSync</%def>
|
||||
|
||||
${h.form(url('datasync.restart'))}
|
||||
${h.submit('restart', "Restart DataSync", id='datasync-restart')}
|
||||
${h.end_form()}
|
|
@ -43,7 +43,6 @@ class DataSyncChangesView(MasterView):
|
|||
Master view for the DataSyncChange model.
|
||||
"""
|
||||
model_class = model.DataSyncChange
|
||||
model_title = "DataSync Change"
|
||||
url_prefix = '/datasync/changes'
|
||||
permission_prefix = 'datasync'
|
||||
|
||||
|
@ -74,7 +73,10 @@ class DataSyncChangesView(MasterView):
|
|||
self.request.session.flash("DataSync daemon has been restarted.")
|
||||
else:
|
||||
self.request.session.flash("DataSync daemon could not be restarted; result was: {}".format(result), 'error')
|
||||
return self.redirect(self.request.route_url('datasyncchanges'))
|
||||
return self.redirect(self.request.get_referrer(default=self.request.route_url('datasyncchanges')))
|
||||
|
||||
def mobile_index(self):
|
||||
return {}
|
||||
|
||||
@classmethod
|
||||
def defaults(cls, config):
|
||||
|
@ -84,10 +86,14 @@ class DataSyncChangesView(MasterView):
|
|||
|
||||
# restart daemon
|
||||
config.add_route('datasync.restart', '/datasync/restart')
|
||||
config.add_view(cls, attr='restart', route_name='datasync.restart',
|
||||
permission='datasync.restart')
|
||||
config.add_view(cls, attr='restart', route_name='datasync.restart', permission='datasync.restart')
|
||||
config.add_tailbone_permission('datasync', 'datasync.restart', label="Restart DataSync Daemon")
|
||||
|
||||
# mobile
|
||||
config.add_route('datasync.mobile', '/mobile/datasync/')
|
||||
config.add_view(cls, attr='mobile_index', route_name='datasync.mobile',
|
||||
permission='datasync.restart', renderer='/mobile/datasync.mako')
|
||||
|
||||
cls._defaults(config)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue