mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Implementation of the client side 'url_for(...)' function.
Created a url_for function module to be used by different javascript modules to use the same functionality of flask at client side. A python module can expose the list of endpoints, used by its javascripts, by overriding the 'get_exposed_url_endpoints(self)' function. In this patch, we have modified all the browser modules to use this function. It will allow us to move the majority of the javascript modules of browser nodes from templates directory to the static directory. TODO:: - Move these javascripts modules to the static directory. - Use this function in all the applicable javascript modules. e.g. tools, miscellaneous modules
This commit is contained in:
@@ -44,6 +44,13 @@ class SettingsModule(PgAdminModule):
|
||||
]
|
||||
}
|
||||
|
||||
def get_exposed_url_endpoints(self):
|
||||
"""
|
||||
Returns:
|
||||
list: a list of url endpoints exposed to the client.
|
||||
"""
|
||||
return ['settings.store', 'settings.store_bulk']
|
||||
|
||||
|
||||
blueprint = SettingsModule(MODULE_NAME, __name__)
|
||||
|
||||
@@ -82,8 +89,8 @@ def script():
|
||||
mimetype="application/javascript")
|
||||
|
||||
|
||||
@blueprint.route("/store", methods=['POST'])
|
||||
@blueprint.route("/store/<setting>/<value>", methods=['GET'])
|
||||
@blueprint.route("/store", methods=['POST'], endpoint='store_bulk')
|
||||
@blueprint.route("/store/<setting>/<value>", methods=['PUT'], endpoint='store')
|
||||
@login_required
|
||||
def store(setting=None, value=None):
|
||||
"""Store a configuration setting, or if this is a POST request and a
|
||||
|
Reference in New Issue
Block a user