Moved the javascripts of the following browser node modules to the

'static' directory from 'templates' in the respective module directory:
- Server Group
- Server
- Database
- Schema
- Cast
- Event trigger
- Extension
- Foreign data wrapper
- Language
- Catalog Object
- Collation
- Domain Constraint
- Domain
- Foreign server
- FTS Configuration
- FTS Dictionary
- FTS Parser
- FTS Template
- Function
- Procedure
- Trigger Function
- Package
- Sequence
- Catalog
- Schema
- Synonym
- Table
- Type
- Materialized View
- View
- pgAgent Modules
  + Job (pga_job)
  + Schedule (pga_schedule)
  + Steps (pga_jobstep)

Added new dynanic modules for listing the supported server types, and
current user information.

NOTE: We've not yet moved the javascripts for the children of the table
module.
This commit is contained in:
Ashesh Vashi
2017-06-22 15:56:45 +05:30
parent 67fd119de8
commit d26337a1ba
54 changed files with 255 additions and 259 deletions

View File

@@ -17,6 +17,8 @@ from flask import render_template, request, \
from flask_babel import gettext as _
from flask_security import login_required, roles_required, current_user
from flask_security.utils import encrypt_password
import config
from pgadmin.utils import PgAdminModule
from pgadmin.utils.ajax import make_response as ajax_response, \
make_json_response, bad_request, internal_server_error
@@ -49,6 +51,11 @@ class UserManagementModule(PgAdminModule):
'name': 'pgadmin.tools.user_management',
'path': url_for('user_management.index') + 'user_management',
'when': None
},{
'name': 'pgadmin.user_management.current_user',
'path': url_for('user_management.index') + 'current_user',
'when': None,
'is_template': True
}]
def show_system_objects(self):
@@ -120,7 +127,25 @@ def script():
"user_management/js/user_management.js", _=_,
is_admin=current_user.has_role("Administrator"),
user_id=current_user.id
),
status=200,
mimetype="application/javascript"
)
@blueprint.route("/current_user.js")
@login_required
def current_user_info():
return Response(
response=render_template(
"user_management/js/current_user.js",
is_admin='true' if current_user.has_role("Administrator") else 'false',
user_id=current_user.id,
email=current_user.email,
name=(
current_user.email.split('@')[0] if config.SERVER_MODE is True
else 'postgres'
),
allow_save_password='true' if config.ALLOW_SAVE_PASSWORD else 'false'
),
status=200,
mimetype="application/javascript"

View File

@@ -0,0 +1,9 @@
define('pgadmin.user_management.current_user', [], function() {
return {
'id': {{ user_id }},
'email': '{{ email }}',
'is_admin': {{ is_admin }},
'name': '{{ name }}',
'allow_save_password': {{ allow_save_password }}
}
});