Commit Graph

272 Commits

Author SHA1 Message Date
Surinder Kumar
a64824a851 Fix various encoding issues with multibyte paths and filenames.
Fixes #1986. Fixes #1940.
2016-12-05 13:10:56 +09:00
Dave Page
29743ad3c4 Allow selection of process output and commands. 2016-11-18 12:05:19 +00:00
Murtuza Zabuawala
e6d018c44f Ensure we handle external processes that fail to start. Fixes #1679 2016-10-21 15:35:06 +01:00
Surinder Kumar
1e66119ef5 Ensure the File Manager honours the file type while traversing the directories. Fixes #1858
When a File Manager is closed by clicking cancel button. Its dom element not destroyed.. So on traversing into directories, when it tries to get currently selected file type, it looks into the dom element but it gets dom of previous dialogs not of currently dialog.

Now whenever an instance of File Manager is closed. its dom elements are also destroyed.
2016-10-21 14:26:12 +01:00
Surinder Kumar
d806a9ce9e Fix the file manager when used under Python 3. Fixes #1872
Issues fixed:

1) In Python 3, parameter "cmp" is removed from sorted method. So File Manager won't open.
As we are sorting data on JS side using Natural sort, so on server side sorting is not required.

2) Improvement in Exception handling.
2016-10-21 12:43:02 +01:00
Surinder Kumar
df09f02e80 List files/folders alphabetically, and don't excessively truncate their names. Fixes #1792 2016-10-18 11:39:12 +01:00
Surinder Kumar
3963272523 Don't show Upload File icon unless it is in capabilities list [Storage Manager]. Fixes #1739
Issue:
When clicked on upload icon while saving a file prompt user to leave page. It is because the icon is a button and its type is set to submit which makes it to prompt, instead it should be 'button'

Storage Manager's menu items depends on capabilities list set by the module using it. If capabilities doesn't have 'upload' in it, It won't work. Upload button is bound to click event only when it is in capabilities.

Solution:
As upload button is being added only when it is in capabilities, so upload button html is removed from html file. It will not shown on UI untill it is in capabilities list.
2016-10-07 12:31:38 +01:00
Surinder Kumar
3b4776ab5f Improve network/server activity feedback for the user. Fixes #1751 2016-09-26 15:10:38 +01:00
Surinder Kumar
3dace5ff22 Fix file navigator to properly show drives in Windows. Fixes #1665 2016-09-05 17:07:07 +01:00
Ashesh Vashi
b6f307256b Sorting the data during tree data loading using the natural sort
algorithm.

This patch takes care of:
* Consistent behaviour during create, update operation on any node.
  - It should return the node data during creating a new object, or
    updating the existing one.
* Now that - we have consistent behaviour during these operations, we
  can consistently move, update the tree item based the node data from
  the server.
* Implemented the methods for each node to get the information about
  that particular node only.
* Using the above changes to implement the 'refresh' operation on tree
  node properly.

I must thank Surinder, and Harshal for helping me implement the 'node'
method, and also changed the behaviour of create & update methods to
return the node data for most of the nodes.

Fixes #1244
2016-08-29 20:06:58 +05:30
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
Dave Page
6701bb191d String fix. 2016-08-17 15:10:33 +01:00
Surinder Kumar
a43f053a10 Fix file upload in File Manager in pgAdmin4 Runtime. Fixes #1397 2016-08-04 16:34:30 +01:00
Dave Page
790b28fb61 Flask-Babel 0.11+ compatibility. Fixes #1496 2016-07-25 17:23:10 +01:00
Dave Page
60659975ed Stop using deprecated imports. 2016-07-22 16:25:23 +01:00
Murtuza Zabuawala
419ead9121 Ensure ajax requests are sent on second click of an object. Fixes #1462 2016-07-21 13:26:09 +01:00
Surinder Kumar
1a129cf30e File management dialogue enhancements:
- Double click on file/folder icon or name will navigate to the folder/file.
- Selected file/folder can be renamed by Rename button only. Double click rename is removed.
- Filename text box will not hide on smaller screen. Setting minimum width of File Browser fixed it.
- Path at top will only show directory name, not the file name and it is greyed out
2016-07-15 10:50:25 +01:00
Surinder Kumar
53434030c1 Consistent busy indication. Fixes #1242 2016-06-29 12:16:02 +01:00
Harshal Dhumal
9396cb03d5 Fix intermittent CodeMirror rendering issue. Fixes #1399 2016-06-29 11:19:04 +01:00
Dave Page
1222681888 Revert "Display busy indicators in a much more consistent way. Fixes #1242"
This reverts commit 7fbefa507b which seems to be
missing things.
2016-06-29 10:32:20 +01:00
Dave Page
7fbefa507b Display busy indicators in a much more consistent way. Fixes #1242 2016-06-27 17:09:37 +01:00
Dave Page
78d329fc47 Don't blink the elapsed time - it's distracting. 2016-06-24 14:01:23 +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
a35288e25d Save the runtime status information in the application object for using
it other places.

globals() does not return consistent value across the application
context.

Thanks Neel Patel for reporting the issue.
2016-06-21 15:13:04 +05:30
Ashesh Vashi
bfe1b773b3 Do not rely on config.SERVER_MODE for determining (if it is running from
runtime, or time), instead check the environment variable PGADMIN_PORT
to do that as per Dave.
2016-06-20 22:00:16 +05:30
Ashesh Vashi
800d5d71d7 Use the python interpreter explicitly while running the background
process from the runtime.
2016-06-20 21:31:19 +05:30
Dave Page
05e7ee5a05 Second attempt at fixing the file handling code. Tested on Mac and Windows in both desktop and server modes. 2016-06-17 22:05:49 +01:00
Dave Page
2c62d1a4b7 Revert "Make the file manager work a little more sanely with regard to paths."
This breaks things even more on Windows :-(

This reverts commit 35243b9869.
2016-06-17 18:19:51 +01:00
Dave Page
35243b9869 Make the file manager work a little more sanely with regard to paths. 2016-06-17 17:12:04 +01:00
Dave Page
1172e31019 File dialogue layout tweaks. 2016-06-17 17:11:30 +01:00
Dave Page
a53811ef27 Get rid of canvas colouring in graphical explain. 2016-06-17 16:34:03 +01:00
Dave Page
f2b6ab816b Process manager UI cleanup. 2016-06-17 15:24:15 +01:00
Dave Page
fd6c43b393 String improvements. 2016-06-17 14:21:14 +01:00
Murtuza Zabuawala
b94b47f021 Fix issue which was showing incorrect datetime in Backup/Restore dialog. Fixes #1377 2016-06-17 13:54:31 +01:00
Surinder Kumar
9e8e3fc787 Fix file selection on Windows. Fixes #1319
1) Unable to select sql file through query tool on windows OS. In file_manager.js, we are stripping initial slash '/' from the path obtained, but we should not strip if it is full path like 'c:/path/to/dir/filename.ext'

2) Handle directory path if STORAGE_DIR is None. Proper checks are added.
2016-06-10 17:06:22 +01:00
Murtuza Zabuawala
47007076cc Fix validation issue causing statistics tab to break if no node is selected on browser tree and user clicks on statistics tab. 2016-06-08 12:48:34 +01:00
Surinder Kumar
a871b15fe9 When any of the docked tab(statistics, dependents & dependencies)
are clicked without selecting any tree node. it gives error in browser
console panel.
Because the node passed is undefined. and check is missing. This is now
fixed by adding check for node passed.
2016-06-08 12:46:30 +01:00
Murtuza Zabuawala
ac2612264c Fix validation of object before using it 2016-06-07 12:37:58 +01:00
Ashesh Vashi
486da5e12c Fixed issue only coming in the runtime.
* Do not need to translate an empty string. (that results into the
  translation header inclusion in the javacript module).
* String.prototype.StartsWith is not an well received function, it has
  not been available in the QWebkit for linux.
2016-06-02 13:15:26 +05:30
Murtuza Zabuawala
af84ba5a4f Fixed all the review comments from Dave.
* Moved the Columns, and Constraint to its repective tabs.
* Ensure all the labels only have a capital letter on the first word
  (except for keywords or acronyms).
* Resolve the typo in string - 'System table'.
* Error messages on fields should not be shown unless the field loses
  focus and has an error.
* "General" section should have a limited subset of information.
* Variables grids should not be on the Security tab.
* Fixes the field labels that imply a question.
* Privileges controls on the Properties lists should be in a "Security"
  group.

Apart from review comments improved few other areas too:
* Used in-place DepsCell functionality for columns in both index, and
  type node.
* Improved the error handling in constraint nodes.
* Added create, alert SQL Help for nodes associated with the table node.
2016-05-24 23:29:55 +05:30
Akshay Joshi
0a354055a9 Adding support for autocomplete in the SQL Editor.
In Query editor, we can use the autocomplete feature by using keyword
combination - 'Ctrl + Space'.
2016-05-21 16:04:29 +05:30
Neel Patel
da28dc8507 Added support for importing and exporting the table data. 2016-05-21 15:43:43 +05:30
Surinder Kumar
3120ce1909 Fixes few issues with File Manager.
- Rename file/folder not working in list view.
- Selection folder only should not allow to select file.
- Ui changes in table list to match with the pgadmin color styles.
- Custom STORAGE_DIR path don't list files/folders when opened in window
  system.
- Code cleanup, formatting & did proper commenting.
- In file selection mode, the value typed in text box not setting into
  backbone model.
- Removed create file code, it should be handled on module using it.
- Written a common function to make ajax request, instead of writing
  individual functions for same task.
2016-05-21 15:02:05 +05:30
Ashesh Vashi
d1e3237e2e Fixed misc issues 2016-05-16 19:51:15 +05:30
Ashesh Vashi
76087f3df3 Fixed issue while using decode() without checking type of the variable. Type maybe string or byte. 2016-05-16 13:22:10 +05:30
Ashesh Vashi
3bbfd8a19f Loading the explain.js as 'application/javascript'
On some older version of browser, it was considering it as HTML.

Thanks Neel Patel for reporting.
2016-05-16 11:28:23 +05:30
Ashesh Vashi
28af92d386 Resolved a bug about listing file type listing, 'All Files' were listed
twice in some cases.
2016-05-16 02:43:38 +05:30
Ashesh Vashi
63b951baee Adding initial version for showing statistics for the server, and
database nodes.
2016-05-16 01:58:02 +05:30
Sanket Mehta
fcc3d112e2 Integrate the graphical explain module in the Query Editor.
Added few TODO list for the graphical explain module by Ashesh.
2016-05-16 01:07:54 +05:30
Ashesh Vashi
ca62825c90 Set PGPASSWORD environment variable from the process executor before running
the external utility.
2016-05-15 22:29:17 +05:30
Murtuza Zabuawala
8ca760ee2b Addd support for taking backup for the server.
Tweaked by Ashesh Vashi to integrate the backgroud process, and also
with some improvements as stated below:
* Resolved an issue loading existing preference.
* Improved the background process observer/executor for supporting
  detalied view.
* Added the utility path preferences in the ServerType class.
2016-05-15 16:04:39 +05:30
Ashesh Vashi
fe0911f285 [Python 3 compatibility] Improved the background process executor to
work with Python 3.
2016-05-15 00:03:25 +05:30
Surinder Kumar
1aeab98a2b Load, and save the files in the Query Editor.
Also, the changes done by Ashesh to resolved few issue with the file
manager in 'Select' mode.
2016-05-14 15:29:08 +05:30
Ashesh Vashi
b22d73ec46 Improvise the pgsql driver to keep the utility names used for different
operation like backup, restore, etc within it.

Also:
* improvised the color combination of the background process logger.
* Removed an unnecessary print statement from the
  get_storage_directory(..) function, also return None if STORAGE_DIR
  is set to None.
2016-05-14 00:48:20 +05:30
Surinder Kumar
5348f6e96a Improvised the file manager functionalities as per comments given:
* Do not show the drives on windows, if STORAGE_DIR is set.
* Do not show non-applicable buttons, whenever no files/directory
  present in the storage directory.
* Showing dimmer under the warning messages for replace/delete.
* Select file type other than 'All Files' in create/replace mode.

Tweaked a bit by Ashesh.
2016-05-14 00:42:41 +05:30
Akshay Joshi
8e4e1640e7 Fixed cStringIO and StringIO module compatibility in python 2016-05-13 11:22:59 +05:30
Ashesh Vashi
f682f06c94 Adding a background process executor, and observer.
We will be using the external utilities like pg_dump, pg_dumpall,
pg_restore in background. pgAdmin 4 can be run as a CGI script, hence -
it is not good idea to run those utility in a controlled environment.
The process executor will run them in background, and we will execute
the process executor in detached mode.

Now that - the process executor runs in detached mode, we need an
observer, which will look at the status of the processes. It also reads
output, and error logs on demand.

Thanks - Surinder for helping in some of the UI changes.
2016-05-13 08:49:51 +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
Dave Page
1efba422bc Fix comment marker. 2016-05-06 10:23:17 +01:00
Ashesh Vashi
085ce50545 Refresh the SQL control, whenever necessary.
Also, remove the CodeMirror object for better clean up process.

When a SQL control/tab is rendered in a hidden element, it does not
render really well. Because - it rely on the height, and width of the
container to count the gutten position, and margin, and other elements.

Hence - whenever the tab, panel becomes visible, we will refresh the
control.
2016-04-22 15:29:23 +05:30
Ashesh Vashi
e07ebdc049 Moving the messages used in common utilities in a separate javascript. 2016-04-11 17:07:58 +05:30
Neel Patel
3969e91563 Add support for Foreign data wrappers, servers and user mappings. 2016-03-17 11:39:38 +00:00
Dave Page
62bd1a21cc Improve message display. 2016-03-15 15:45:40 +00:00
Neel Patel
000c76871f Updated the misc module javascripts to work with latest wcDocker. 2016-02-29 19:37:24 +05:30
Akshay Joshi
c153032e3b Add support for displaying dependency and dependents info. 2016-02-22 13:07:16 +00:00
Dave Page
2233583dbd Avoid unnecessary redraws of the SQL pane. 2016-02-17 10:43:02 +00:00
Ashesh Vashi
8120b380bb Introduced a event manager for the browser, which will generate certain
known events, when any activity happens on the browser layout.

The following types of events will be triggered through the browser
event manager.
- pgadmin-browser:frame:* [1]
- pgadmin-browser:frame-<name>:* [1]
- pgadmin-browser:panel:* [1]
- pgadmin-browser:panel-<name>:* [1]
- pgadmin-browser:panel
- pgadmin-browser:frame
- pgadmin-browser:tree
- pgadmin-browser:tree:* [2]

[1] The '*' denotes some of the events generated by the wcDocker, which
    can be useful to do some operations.
	These events are:
	+ wcDocker.EVENT.UPDATED
	+ wcDocker.EVENT.VISIBILITY_CHANGED
	+ wcDocker.EVENT.BEGIN_DOCK
    + wcDocker.EVENT.END_DOCK
	+ wcDocker.EVENT.GAIN_FOCUS,
	+ wcDocker.EVENT.LOST_FOCUS
	+ wcDocker.EVENT.CLOSED
	+ wcDocker.EVENT.BUTTON
	+ wcDocker.EVENT.ATTACHED
	+ wcDocker.EVENT.DETACHED
	+ wcDocker.EVENT.MOVE_STARTED
	+ wcDocker.EVENT.MOVE_ENDED
	+ wcDocker.EVENT.MOVED
	+ wcDocker.EVENT.RESIZE_STARTED
	+ wcDocker.EVENT.RESIZE_ENDED
	+ wcDocker.EVENT.RESIZED
	+ wcDocker.EVENT.SCROLLED

[2] The '*' denotes all the events generated by the Browser Tree
    (aciTree).

The extension modules can utilize these events to do some operations on
nodes, and panels.

This patch includes showing 'Reversed Engineered Query' for the selected
node (if allowed) using the above approch.

The ShowNodeSQL module looks for two events.
1. SQL Panel Visibility change.
   - Based on the visibility of that panel, we start/stop listening the
	 node selection event.
2. Node Selection in Browser tree
   - Based on the selected node type, it will look for 'hasSQL'
	 parameter of the node, and fetch the Query from the server, and
	 show it in the SQL editor.
2016-01-19 18:18:47 +05:30
Dave Page
694506453b Copyright updates for 2016. 2016-01-18 14:48:14 +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
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