Commit Graph

105 Commits

Author SHA1 Message Date
Murtuza Zabuawala
9ad1316990 Various encoding fixes. Fixes #2160 2017-02-16 11:00:40 +00:00
George Gelashvili
19be3529f8 Create a template loader for SQL templates.
This will automatically find the correct version of a template for the server version, and allows us to remove templates that were previously duplicated for different server versions.

Patch by George & Tira at Pivotal. Review by me and Murtuza from EDB.

Discussion: https://www.postgresql.org/message-id/flat/CAHowoHaU9_pkCt%2B1g8dpY3hsXXZmsJZiJH-3-_Hd%2BC1MxiGhtA%40mail.gmail.com#CAHowoHaU9_pkCt+1g8dpY3hsXXZmsJZiJH-3-_Hd+C1MxiGhtA@mail.gmail.com
2017-01-30 11:25:03 +00:00
Dave Page
f221194bcc Update copyright notices for 2017. 2017-01-04 13:33:32 +00:00
Dave Page
8ae4a10c64 Apparently Flask-HTMLmin still requires django-htmlmin 2016-11-21 13:37:52 +00:00
Dave Page
020bf1d532 Minify HTML with Flask-HTMLMIN 2016-11-18 16:42:38 +00:00
Dave Page
f736051309 Handle broken config databases much more gracefully. Fixes #1922 2016-11-02 17:00:26 +02:00
Dave Page
bc5cc964a3 Move security keys into the SQLite database, and auto-generate them.
This avoids packagers having to deal with the issue, which can be
difficult if they need to cater for both server and desktop modes.

Fixes #1849
2016-10-19 09:22:38 +01:00
Surinder Kumar
7cfcf14312 Move the declaration of a variable into the correct scope. 2016-09-09 14:50:51 +01:00
Murtuza Zabuawala
1b75679ec4 Python 2.6 fixes. Fixes #1636. Fixes #1659 2016-09-06 14:07:30 +01:00
Ashesh Vashi
f12d981a9d Handling the bad/lost connection of a database server.
Made backend changes for:
* Taking care of the connection status in the psycopg2 driver. And, when
  the connection is lost, it throws a exception with 503 http status
  message, and connection lost information in it.
* Allowing the flask application to propagate the exceptions even in the
  release mode.
* Utilising the existing password (while reconnection, if not
  disconnected explicitly).
* Introduced a new ajax response message 'service_unavailable' (http
  status code: 503), which suggests temporary service unavailable.

Client (front-end) changes:
* To handle the connection lost of a database server for different
  operations by generating proper events, and handle them properly.

Removed the connection status check code from different nodes, so that
- it generates the proper exception, when accessing the non-alive
  connection.

Fixes #1387
2016-08-29 12:01:35 +05:30
Murtuza Zabuawala
06e881570a Fix numerous encoding issues. Fixes #1307. Fixes #1479 2016-07-26 15:05:14 +01:00
Dave Page
60659975ed Stop using deprecated imports. 2016-07-22 16:25:23 +01:00
Ashesh Vashi
1ada5031cd 'hasattr' function on '__builtins__' for 'xrange' function does not
return correct information from a script, but works well on interactive
shell. Used a more proper check for Python > 2 instead of the current
implementation.

Thanks Vishal for the report.
2016-07-12 13:21:21 +05:30
Ashesh Vashi
889b69ac82 [Python 3 compability] Allow to run the auto-discovery implementation on
Python 3. Refs #1389
2016-07-11 01:18:24 +05:30
Ashesh Vashi
61698b7b4d Do not use the sqlite for session handling, as the old implementation is
optimized to work from multiple threads. It has too many frequent
transaction from multiple threads, and that tends to result into the
'database is locked' error of sqlite.

With the new implemenation, we're using the caching mechanism, which
keep the data in the memory all the time, and saves it on request
completion, and loads it only for the first time. Also, it will storage
the data using pickle, which will be faster than accessing sqlite.

Fixes #1329
2016-07-08 16:57:46 +05:30
Dave Page
9c39fe2f2e Fix architecture detection on 32 bit Windows. Fixes #1427 2016-07-01 15:50:28 +01:00
Dave Page
1acc1a7678 Auto-discover locally installed servers at login. Fixes #1389 2016-06-23 16:27:06 +01:00
Dave Page
7d0fe669ca Code tidy. 2016-06-21 14:21:06 +01:00
Dave Page
3026b470e9 Optimise Python imports. 2016-06-21 14:12:14 +01:00
Ashesh Vashi
512e11c47c 'pgadmin.utils.storage' has been renamed to 'pgadmin.utils.paths'. Resolved the typo. 2016-05-13 00:36:45 +05:30
Ashesh Vashi
9cdd1f8098 Added support for the server side file manager, which will be useful in
selection, creation, upload/download files/directories resides on the
server side.

This will be useful for file selection/creation for different server
side utilites like pg_dump, pg_dumpall, pg_restore.
2016-05-13 00:04:32 +05:30
Ashesh Vashi
7513cebd8c Load only one set of CSS files per module.
There are times, a module is loaded multiple times, and returns same set
of CSS files mulitple times, in order to avoid loading the same file
multiple times, we will create a set out of the list of CSS files.
2016-05-11 12:46:16 +05:30
Ashesh Vashi
9cae686c65 Allow the modules to define the i18n messages, and other messages
required by its javascript module.

This will allow us to load the javascript modules as a static file, and
not as a Jinja2 template. This will increase the load time, as it will
decrease number of templates to be processed during loading those
javascripts.
2016-05-10 16:07:48 +05:30
Ashesh Vashi
d8cbee3850 Adding the timeout for the connection on the configuration database.
While accessing the configuration database from multiple session, it
results in to the error - OperationError, because - sqlite locks all the
database, and does not allow to access it simultaneously. We added the
timeout to give some time window for accessing it simultaneously.
2016-05-10 15:59:04 +05:30
Ashesh Vashi
26e9ceaf48 Do not reset the driver registry when the 'load_driver' method of
DriverRegistry is executed second time.

Also, initialize the driver before registering different blueprints,
which uses those driver inside them.

Thanks Khushboo for reporting the issue.
2016-04-25 15:33:54 +05:30
Ashesh Vashi
30d189f499 Load the codemirror as package in the require.js, which will allow us to
load the codemirror addons without any modification.
2016-04-14 12:34:17 +05:30
Ashesh Vashi
3c366fafe7 Server side session management support. 2016-03-22 15:05:43 +00:00
Dave Page
5ea822f33e Preferences dialogue. Patch by Ashesh and Khushboo Vashi. 2016-03-07 11:48:53 +00:00
Ashesh Vashi
a6466c091c Resolved a regess of the previous commit, which introduced during
previous commit: 39d432ca2c.

[Thanks Neel Patel for pointing this out..]
2016-03-01 10:24:46 +05:30
Ashesh Vashi
39d432ca2c Remove some unnecessary imports from the pgadmin/__init__.py, and
removed the file hooks.py, which is not used any more with new
infrastructure.
2016-02-29 23:08:08 +05:30
Harshal Dhumal
b77c5a6c54 Python 2.6 support fixes. 2016-01-27 15:59:54 +01:00
Dave Page
694506453b Copyright updates for 2016. 2016-01-18 14:48:14 +00:00
Murtuza Zabuawala
5f890dadc9 Remove any unwanted white-spaces while renderting any template in template code 2015-12-22 10:43:24 +05:30
Murtuza Zabuawala
209ee78b25 First round of Python 3 compatibility fixes. 2015-11-06 10:23:19 +00:00
Ashesh Vashi
e27e39a8f3 Added support for the infrastructure for on demand access/create the
server connection.

The BaseDriver and BaseConnection are two abstract classes, which allows
us to replace the existing driver with the currently used. The current
implementation supports to connect the PostgreSQL and Postgres Plus
Advanced Server using the psycopg2 driver.
2015-10-20 12:33:29 +05:30
Ashesh Vashi
86479453b3 Check for current schema version on startup and update the schema (if
required).
2015-07-22 22:12:42 +05:30
Ashesh Vashi
aa150030eb 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).
2015-06-30 11:21:57 +05:30
Ronan Dunklau
b626eec0fd Inherited the test, about & help module from PgAdminModule class to load
them automatically by PgAdmin.
2015-06-29 13:26:43 +05:30
Ronan Dunklau
eb6580b43a Introduced a PgAdmin class inherited from the Flask, which looks for
submodules inherited from the PgAdminModule instead of regular
Blueprint. This allows us to load the module automatically from the
under the pgadmin directory, and will work to extend the pgAdmin
extension module.

PgAdminModule is inherited from the Blueprint, and bring several
methods:
-  get_own_stylesheets, which returns the stylesheets used by the module
   (excluding its submodules stylesheets)
- get_own_javascripts
- menu_items, which returns a dictionray mapping the old hook names
  (context_items etc) to a list of MenuItem instances

For more specialized modules (as for now, any module that should be part
of the browser tree construction), one can define an abstract base class
defining additional methods.

For example, the BrowserPluginModule abstract base class defines the
following methods:
- jssnippets
- csssnipeets
- node_type
- get_nodes
2015-06-29 12:28:41 +05:30
Dave Page
fe834d1ed2 Re-organise node structure and loading to make things somewhat more
simple. This also adds the ability to display servers on the treeview.
2015-03-10 13:09:11 +00:00
Dave Page
613df8b596 Copyright year fixes and doc tweaks. 2015-02-25 20:25:41 +00:00
Dave Page
0988245ccd Remove debug message. 2015-02-25 17:06:43 +00:00
Dave Page
83cbe87040 i18n support. 2015-02-25 17:06:00 +00:00
Dave Page
89cc11fb80 This is a big one campers; Add initial support for treeview nodes.
This commit adds the following:

- Storage of server groups in the configuration database
- Creation of a default server group on in the database
- A mechanism for plugging in treeview node types
- A node type for server groups with:
  - Treeview display
  - Custom per-node javascript implementing a menu option/dialogue to add new groups
  - Custom per-node CSS to style the treeview node
- JSON formatted data in response to AJAX requests, including:
  - Success/failure indication
  - Error message
  - Extra info (e.g. stack trace)
  - The original request data
  - Additional return data, e.g. node ID and label etc.
2015-02-15 17:10:53 -05:00
Dave Page
bb6a3f9b5b Use minified output when not in debug mode, and non-minified when debugging.
Update jQuery while we're at it.
2015-02-12 10:28:15 +00:00
Dave Page
1b6d7edd01 Add the core of the main browser layout. 2015-02-05 14:06:20 +00:00
Dave Page
afd5626fe4 Add a simple module for storing and retrieving settings from the
config database.
2015-02-03 11:48:15 +00:00
Dave Page
d492da3ca1 Add automatic browser menu integration for modules.
Modules may now include functions that return lists of menu items
that will be included on the main browser window menu. While we're
at it, move the test views into a separate module.
2015-01-27 14:18:27 +00:00
Dave Page
7c60fb3377 Support a desktop authentication mode.
This uses a single default user in the config database, which is
auto-logged into the app when SERVER_MODE = False. In this mode we
also hide/remove user-related functions in the UI.
2015-01-26 15:20:28 +00:00
Dave Page
10515431c7 Add authentication and the basis of the browser module.
A user authentication module based on flask-security is added, which
allows users to login and change/recover passwords etc. Custom templates
are included for the user/password UIs.

A new setup script will initialise the user (and later settings) DB,
adding the first user and granting them an Administrator role.

A redirects blueprint module is added to handle simple URL redirects.

A browser module is added and currently renders a skeleton page with
a menu bar, gravatar and jumbotron.

NOTE FOR LATER: Currently this code might make the nice basis for any
web app that needs user management and plugins. Hmmm....
2015-01-22 15:56:23 +00:00
Dave Page
7fa40d7671 Use Python docsctrings 2015-01-21 12:00:13 +00:00
Dave Page
7b8cb207ab Support dynamically loaded modules. 2015-01-20 12:32:06 +00:00
Dave Page
2c1688e6f4 Use Flask blueprints for modularisation, per Khushboo Vashi. 2015-01-19 16:38:47 +00:00
Dave Page
ca6ef66b61 Disable the DEBUG log handler so our own is used. 2014-12-18 17:56:17 +00:00
Dave Page
b9bf6d9aa3 Restructure to enable use of modules for different components of pgAdmin. 2014-12-18 17:49:09 +00:00