mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Using client-side 'url_for' implementation in the maintenance module.
This commit is contained in:
parent
5d45dee686
commit
07580b8444
web/pgadmin/tools/maintenance
@ -65,6 +65,13 @@ class MaintenanceModule(PgAdminModule):
|
||||
]
|
||||
return stylesheets
|
||||
|
||||
def get_exposed_url_endpoints(self):
|
||||
"""
|
||||
Returns:
|
||||
list: URL endpoints for backup module
|
||||
"""
|
||||
return ['maintenance.create_job']
|
||||
|
||||
|
||||
blueprint = MaintenanceModule(MODULE_NAME, __name__)
|
||||
|
||||
@ -155,7 +162,9 @@ def script():
|
||||
)
|
||||
|
||||
|
||||
@blueprint.route('/create_job/<int:sid>/<int:did>', methods=['POST'])
|
||||
@blueprint.route(
|
||||
'/job/<int:sid>/<int:did>', methods=['POST'], endpoint='create_job'
|
||||
)
|
||||
@login_required
|
||||
def create_maintenance_job(sid, did):
|
||||
"""
|
||||
|
@ -1,9 +1,11 @@
|
||||
define([
|
||||
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
|
||||
'pgadmin', 'pgadmin.browser', 'backbone', 'backgrid', 'backform',
|
||||
'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser.node.ui'
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
|
||||
'underscore.string', 'alertify', 'pgadmin', 'pgadmin.browser', 'backbone',
|
||||
'backgrid', 'backform', 'pgadmin.backform', 'pgadmin.backgrid',
|
||||
'pgadmin.browser.node.ui'
|
||||
], function(
|
||||
gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, Backform
|
||||
gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid,
|
||||
Backform
|
||||
) {
|
||||
|
||||
pgAdmin = pgAdmin || window.pgAdmin || {};
|
||||
@ -267,9 +269,15 @@ define([
|
||||
text: '', className: 'btn btn-default pull-left fa fa-lg fa-info',
|
||||
attrs:{name:'object_help', type:'button', url: 'maintenance.html', label: gettext('Maintenance')}
|
||||
},{
|
||||
text: '', key: 112, className: 'btn btn-default pull-left fa fa-lg fa-question',
|
||||
attrs:{name:'dialog_help', type:'button', label: gettext('Maintenance'),
|
||||
url: '{{ url_for('help.static', filename='maintenance_dialog.html') }}'}
|
||||
text: '', key: 112,
|
||||
className: 'btn btn-default pull-left fa fa-lg fa-question',
|
||||
attrs:{
|
||||
name:'dialog_help', type:'button',
|
||||
label: gettext('Maintenance'),
|
||||
url: url_for(
|
||||
'help.static', {'filename': 'maintenance_dialog.html'}
|
||||
)
|
||||
}
|
||||
},{
|
||||
text: gettext("OK"), key: 13, className: "btn btn-primary fa fa-lg fa-save pg-alertify-button",
|
||||
'data-btn-name': 'ok',
|
||||
@ -328,14 +336,14 @@ define([
|
||||
'unique_constraint': unique_constraint,
|
||||
'index': index})
|
||||
|
||||
baseUrl = "{{ url_for('maintenance.index') }}" +
|
||||
"create_job/" + treeInfo.server._id + "/" + treeInfo.database._id,
|
||||
args = this.view.model.toJSON();
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
url: url_for(
|
||||
'maintenance.create_job', {
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id
|
||||
}),
|
||||
method: 'POST',
|
||||
data:{ 'data': JSON.stringify(args) },
|
||||
data:{'data': JSON.stringify(this.view.model.toJSON())},
|
||||
success: function(res) {
|
||||
if (res.data && res.data.status) {
|
||||
//Do nothing as we are creating the job and exiting from the main dialog
|
||||
|
Loading…
Reference in New Issue
Block a user