mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-09-03 20:52:57 -05:00
Introduced a mechanism to load required javascripts at runtime
(lazy loading) using the require.js. This allows us to load the javascript required for any node, only when it was loaded in the browser tree. Also, introduced the mechanism to show/edit/create of any node in a tab panel (wcDocker.Panel).
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
##########################################################################
|
||||
#
|
||||
# pgAdmin 4 - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2013 - 2015, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
from flask import Blueprint
|
||||
from collections import defaultdict
|
||||
from operator import attrgetter
|
||||
import sys
|
||||
|
||||
|
||||
|
||||
class PgAdminModule(Blueprint):
|
||||
"""
|
||||
Base class for every PgAdmin Module.
|
||||
|
||||
@@ -9,13 +9,25 @@
|
||||
|
||||
"""Utility functions for dealing with AJAX."""
|
||||
|
||||
from flask import jsonify
|
||||
from flask import Response
|
||||
import json
|
||||
|
||||
def make_json_response(success=True, **kwargs):
|
||||
def make_json_response(success=1, errormsg='', info='', result=None, data=None, status=200):
|
||||
"""Create a HTML response document describing the results of a request and
|
||||
containing the data."""
|
||||
response = kwargs.copy()
|
||||
response.setdefault('result', {})
|
||||
response.setdefault('data', {})
|
||||
return jsonify(response)
|
||||
doc = dict()
|
||||
doc['success'] = success
|
||||
doc['errormsg'] = errormsg
|
||||
doc['info'] = info
|
||||
doc['result'] = result
|
||||
doc['data'] = data
|
||||
|
||||
return Response(response=json.dumps(doc),
|
||||
status=status,
|
||||
mimetype="text/json")
|
||||
|
||||
def make_response(response=None, status=200):
|
||||
"""Create a JSON response handled by the backbone models."""
|
||||
return Response(response=json.dumps(response),
|
||||
status=status,
|
||||
mimetype="text/json")
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
##########################################################################
|
||||
#
|
||||
# pgAdmin 4 - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2013 - 2015, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
PRIORITY = 100
|
||||
@@ -10,16 +19,19 @@ class MenuItem(object):
|
||||
class Panel(object):
|
||||
|
||||
def __init__(self, name, title, content, width=500, height=600, isIframe=True,
|
||||
showTitle=True, isCloseable=True, isPrivate=False, priority=None):
|
||||
showTitle=True, isCloseable=True, isPrivate=False, priority=None,
|
||||
icon=None, data=None):
|
||||
self.name = name
|
||||
self.title = title
|
||||
self.content = content
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.isIfframe = isIframe
|
||||
self.isIframe = isIframe
|
||||
self.showTitle = showTitle
|
||||
self.isCloseable = isCloseable
|
||||
self.isPrivate = isPrivate
|
||||
self.icon = icon
|
||||
self.data = None
|
||||
if priority is None:
|
||||
global PRIORITY
|
||||
PRIORITY += 100
|
||||
|
||||
Reference in New Issue
Block a user