Commit Graph

353 Commits

Author SHA1 Message Date
Surinder Kumar
92bc312d2d Fix updating of matview definitions. Fixes #1595 2016-09-16 15:41:07 +01:00
Surinder Kumar
3035ae13df Fix CMD+V (Paste) in the Mac runtime. Finally fixes #1478 2016-09-14 11:17:34 +01:00
Murtuza Zabuawala
4ba8f4830b Don't sort columns (tables, views, matviews, catalogs etc) on the treeview by name, but by ordinal. Fixes #1687 2016-09-14 11:13:50 +01:00
Murtuza Zabuawala
a67c4fc1dc Fix a typo in the error handling in the browser that caused some errors to be reported to the console only. 2016-09-14 10:33:41 +01:00
Ashesh Vashi
aeaa4bcad1 Add an object in an parent properly, which was expanded earlier, and do
not have any child withing it.

Fixes #1481, #1627.
2016-09-06 23:20:38 +05:30
Ashesh Vashi
8ac65070bc Improve the logic for Bad handling of missing connection database server RM #1387 2016-09-06 15:35:20 +05:30
Murtuza Zabuawala
689ef8d8d1 Fixes issues specific to SYNONYMS
- On droping a synonyms - the query should be modified in SQL pane.
- A proper message should be given on trying to drop an already dropped
  synonyms.
- Handle the synonyms with special characters.

Fixes #1607, #1608, #1609
2016-08-29 20:25:18 +05:30
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
Harshal Dhumal
cf1be2a320 Add support for Packages on EPAS. 2016-08-22 12:30:16 +01:00
Surinder Kumar
761b54ce69 Allow the user to configure tabs in the SQL editor. Fixes #1406 2016-08-19 11:40:19 +01:00
Akshay Joshi
2b1b60bc2b Reduce main menu height a little. Fixes #1453 2016-08-18 16:51:22 +01:00
Akshay Joshi
9dfc7bff35 Add missing collection node child counts. Fixes #1250 2016-08-09 12:12:05 +01:00
Dave Page
a025c0ebf0 Missing comma. Sigh. 2016-08-08 15:39:06 +01:00
Surinder Kumar
1bcac0b67c Fix more of the funky keyboard shortcuts. 2016-08-08 15:26:37 +01:00
Neel Patel
37ca3579f3 Fix a JS error in the runtime caused by f78024808e (#1177) 2016-08-08 14:42:14 +01:00
Harshal Dhumal
f78024808e Prevent the user attempting to run external commands if the bin path is not configured. Fixes #1177 2016-08-08 11:59:37 +01:00
Khushboo Vashi
8e099e29c3 Fix various escaping issues. Fixes #1527 2016-08-05 12:20:00 +01:00
Dmitriy Olshevskiy
94aa36f3d5 Remove redundant -- marker in the SQL panel on the properties dialogues. 2016-08-01 14:28:14 +01:00
daze
19306934a0 Property 'URL' (of type string) not quoted in browser.js template when extending pgAdmin.Browser. Fixes #1504
Without quotes, the property can be mistakenly treated as a regex:

e.g.: URL: /pgadmin/browser/,

When that happens, JS engine throws "SyntaxError: invalid regular expression flag b" and the whole web interface freezes.
This problem usually occurs when pgadmin is hosted inside a subdirectory (https://host/pgadmin/ instead of https://host/).
2016-07-26 12:47:46 +01:00
Dave Page
790b28fb61 Flask-Babel 0.11+ compatibility. Fixes #1496 2016-07-25 17:23:10 +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
Ashesh Vashi
417af3676d Using better way to find the current object in the properties panel. 2016-07-19 15:30:39 +05:30
Dave Page
7b3b7736d9 Resolve loading panel does not hide in Mac runtime. Fixes #1425 2016-07-01 10:20:43 +01:00
Dave Page
c4504f1dc2 Localise the loading message. 2016-06-29 20:48:09 +01:00
Dave Page
d795f37fe5 Prefix the version number with 'v' in the Loading message. 2016-06-29 20:47:11 +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
Surinder Kumar
5d0c160fb8 Show a loading indicator until things are ready to rock. Fixes #1400 2016-06-29 10:46:48 +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
Surinder Kumar
a7e1e25cf4 Add a title bar to the treeview browser, as this is the only (currently) supported way to fix docking issues with our code in wcDocker. Fixes #1184
Original patch by Surinder. Simplified and re-styled by me.
2016-06-24 10:12:57 +01:00
Dave Page
7d0fe669ca Code tidy. 2016-06-21 14:21:06 +01:00
Surinder Kumar
3f25e9331f Remove Query tool from object menu. It is already shown under tools menu, so no need to show under object menu. 2016-06-20 14:17:10 +01:00
Dave Page
3bcc5a4bd3 Further string improvements. 2016-06-17 14:51:01 +01:00
Dave Page
0717b40543 Wording improvements. 2016-06-15 12:42:21 +01:00
Harshal Dhumal
b0b21fd46c Avoid showing multiple 'Reset Layout' options under file menu. Fixes #1348
Also restructured code related to reset layout functionality.
2016-06-14 15:01:15 +01:00
Dave Page
970d3aafbf Help buttons for various dialogues. 2016-06-13 16:17:36 +01:00
Murtuza Zabuawala
d9804ae2a2 Add a menu option to reset the layout. Fixes #1248 2016-06-10 16:55:58 +01:00
Surinder Kumar
8eb0742076 Add the Query Tool to the context menu, and improve prioritisation. Fixes #1256 2016-06-08 13:18:59 +01:00
Harshal Dhumal
f3fae9d238 Fix email validation and mouse pointer over the Users option. 2016-06-07 09:24:44 +01:00
Harshal Dhumal
e3ab4501d5 User management. 2016-06-06 13:34:08 +01:00
Murtuza Zabuawala
9436542074 Fixes #1223 - Do not allow to drop user from non-super user.
Also - fixed some javascript variable scope issue in the 'delete_obj'
function of nodes.
2016-06-03 15:32:33 +05:30
Ashesh Vashi
57f3cbfa3b Select parent node when deleting/dropping the last children. 2016-06-03 06:06:40 +05:30
Ashesh Vashi
05a3d509bc Fixes #1104 - Load the first level node properly, whenever we add first
node under it, and select that node.

This fixes the problem of adding first server.
2016-06-03 05:57:58 +05:30
Ashesh Vashi
cf0f692d00 Dialog default sizing. 2016-05-25 11:18:05 +01:00
Ashesh Vashi
748497916e Honour the node type (if provided) in the menu item, and disable it on
any other nodes.
2016-05-25 01:15:10 +05:30
Ashesh Vashi
b2b6d443b5 Do not validate the model unnecessarily (when closing).
Clear the cache of a node, whenever an object has been removed of that
kind, it will allow us to fetch the latest list.
2016-05-21 15:36:41 +05:30
Murtuza Zabuawala
077075c765 Renaming the label of the browser left node after editing the properties
properly.
2016-05-21 15:06:14 +05:30
Ashesh Vashi
875e251359 Allow to specify the height & width from the javascript modules of an
individual node.
2016-05-21 14:18:26 +05:30
Dave Page
1606f1d8e8 Link online help to dialogs 2016-05-16 22:35:27 -04:00
Surinder Kumar
2c7a45814c Resolved an issue about missing 'canDrop' function check for the browser
tree nodes.

Each individual node is responsible for introducing the 'canDrop'
function/flag to decide whether the 'Delete/Drop' context menu should be
enabled/disabled.

In commit-id: 26aa5607ad, 'obj.canDrop'
was set to true in the 'pgBrowser.Node' in delete callback, just to make
the server-group droppable, which is wrong, as all the nodes are
getting affected because of this change in a wrong way.

To fix the issue, added the 'canDrop' function in the server-group node.

Apart from them, also added restriction for not allowing to delete the
default server-group.

Also, handled the same restriction at the server end.
2016-05-16 23:09:11 +05:30
Murtuza Zabuawala
5ca63fba48 Initial version for generationg the CREATE/SELECT/EXEC scripts for the
selected node.
2016-05-16 00:25:34 +05:30
Surinder Kumar
cc91a538e0 Fixed the canDrop function of the node menus does not get called during
enable/disable menu checks.

Tweaked a little bit by Ashesh.
2016-05-14 01:10:20 +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
d768faf2ea Do not validate the attributes on saving, because - sometimes it results
into an error, and does not call the callback - 'success/fail'
internally.

And, that will not close the property dialog in those cases.

Reported by Harshal Dhumal.
2016-05-12 15:51:21 +05:30
Murtuza Zabuawala
ce043fbe07 Python 3 compatibility fix - iteritems() is deprecated. 2016-05-10 17:01:11 +01:00
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
Khushboo Vashi
7a400bacf3 Do not send the incomplete definition of a node object to the server
instead show proper message.

Tweaked by Ashesh for adding the proper message
2016-05-10 12:34:24 +05:30
Khushboo Vashi
e522ebbcca Ensure delete/drop works without JS errors. 2016-05-06 15:47:21 +01:00
Khushboo Vashi
f3d05279a7 In IE10, the Save/Reset buttons are not getting enabled after changing fields. 2016-05-06 15:29:32 +01:00
Karen Blatchley
949e536bae First round of string review and cleanup. 2016-05-06 13:53:48 +01:00
Dave Page
0628ee0425 Dashboards v1 2016-05-05 16:42:16 +01:00
Ashesh Vashi
32e0a0d4b6 Clear the node cache, when an node is created/updated to make sure - we
will always have latest data related to that type of node. Also, fixed
the cache_level for different node types.

This commit also contains fixes for the following issue:
* In extension module - use the 'node-list-by-name' instead of using a
  custom 'node-ajax-options' control, and removed redundant template
  schemas from it.
* When we tries to destroy the select2 object from
  Select2Cell/Select2Control while releasing the properties view,
  sometimes select2 can not find the instance related it for some
  unknown reason. Hence - before removing it we will check for manual
  instance existance using $.data('select2').
* When we traverse through the browser tree nodes very quickly, it tries
  to remove the object before it gets created completely, and results
  into an exception.
* Icon in the select2 drop down list was not visible due to some CSS
  issues.

Apart of that, we will generate two new browser events -
'pgadmin-node:created:<NODE-TYPE>', 'pgadmin-node:updated:<NODE-TYPE>'
whenever a new node is created, or an existing node will be updated.
2016-04-29 15:50:38 +05:30
Murtuza Zabuawala
dac514a4ae Added a new control for rendering the notes to be used by different
tools/utitilities dialog.

Modified a little bit by Ashesh Vashi.
2016-04-28 11:52:06 +05:30
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
a5aa6d159a Updated the CodeMirror to the latest stable version (5.14.2).
It has now the 'sql/x-pgsql' mode, which will make the queries more
familiar, and lot more improved addons.
2016-04-22 15:28:34 +05:30
Ashesh Vashi
9aee9794c1 Fix the properties toolbar at the top of the panel so it's always
visible.

This patch also introduce a callback 'onCreate' for each panel, and
frame, which will be called whenever a panel/frame is being created.
2016-04-18 12:38:56 +05:30
Dave Page
e176190256 Core infrastructure for dashboards. 2016-04-16 17:51:44 +01:00
Seçkin Alan
26aa5607ad Fix dropping of server groups. 2016-04-16 09:55:38 +01:00
Ashesh Vashi
34ba5bef24 Improvised the data clean up, in some cases, it was calling validation
due to internal 'set' function call from the internal 'reset' function.

We will stop the session management, before doing any clean up for
ignoring such events.
2016-04-15 19:29:30 +05:30
Khushboo Vashi
de0864a92c Fix SQL Help on older browsers without string.endsWith(). 2016-04-15 14:26:32 +01:00
Ashesh Vashi
7ca939dcaf Fix dialogue close issue. 2016-04-15 14:02:21 +01:00
Dave Page
4d7d3bd5e1 Icon and toolbar cleanup/consistency. 2016-04-15 13:32:17 +01:00
Ashesh Vashi
58fcbd943a Deleting the object (model & nested model/collection) during showing
the node properties.
2016-04-15 16:14:22 +05:30
Seçkin Alan
7b344185b4 Validate the model on save. 2016-04-14 21:51:07 +01:00
Ashesh Vashi
8a39b3a700 Backend changes to fetch the statistics for the database and server
nodes, along with the front-end changes for those node.

NOTE:
We've not yet added the support to show them on the front-end.
2016-04-14 16:45:34 +05:30
Ashesh Vashi
6f58170894 Bind the current panel with the temporary functions, so that - it works
on the object everytime, it hits the buttons, and the callback functions
are being executed. The original implementation was not using the same
panel, when it was recalled from other function. And, results into
unexpected behaviour like not able to work with Edit object again.

Thanks Murtuza for reporting the issue.
2016-04-14 12:50:20 +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
Dave Page
edf9f25691 Fix general category default. 2016-04-12 17:00:12 +01:00
Dave Page
fc8c3db33f Remove unnecessary line of code. 2016-04-12 13:39:06 +01:00
Dave Page
62fcfd928d Add context-sensitive SQL help. 2016-04-12 13:36:06 +01:00
Ashesh Vashi
e07ebdc049 Moving the messages used in common utilities in a separate javascript. 2016-04-11 17:07:58 +05:30
Dave Page
d53ab31eb8 Button bar styling:
- Left justify the top button bar and match the style of the query tool
- Allow buttons to have tooltips and optional labels
2016-04-08 11:58:47 +01:00
Harshal Dhumal
43d532321b Allow to close the create/edit dialog after successful 'save'
operation.

Some of the nodes do not return id as result, when they were created.
Modified the logic to allow to open the parent node in such conditions.
2016-04-01 15:34:29 +05:30
Dave Page
2a2374329e String improvements. 2016-03-23 16:03:22 +00:00
Dave Page
72f6353561 String improvements. 2016-03-23 16:00:26 +00:00
Khushboo Vashi
8ca134871f Update the Browser Tree Node Icon after editing. 2016-03-22 13:14:38 +00:00
Ashesh Vashi
87f9834951 Allow to create sub-menu/menu-group by specify the same category in
multiple menu-items (not just the 'create' menu-group).

Moved all the main menu/context menu generation implementation in the
'menu' javascript menu.

In this implementation, if more than one menu-items specify same type
of categories, they will be created withing that group, otherwise - it
will be created separately (unless 'single' property of that category is
set to true).

We can also provide icon, priority, separator(s) above/below it for the
individual sub-menu too using pgAdmin.Browser.add_menu_category
function(...).
2016-03-21 23:56:08 +05:30
Ashesh Vashi
79d6d50dcc The minimal refresh functionality, which will not unload the whole
tree, when 'refresh' on any node was selected.
2016-03-21 22:44:59 +05:30
Ashesh Vashi
b056ba7bb7 Speed up the expansion/collapsing of nodes.
[as per Thom Brown <thom@linux.com>]

Also, we will not like to wait for 500 microsecond before initialing the
tree items, load them asap.
2016-03-21 22:44:59 +05:30
Dave Page
62bd1a21cc Improve message display. 2016-03-15 15:45:40 +00:00
Ashesh Vashi
6014448dd7 Trigger an event whenever a register script has been initialized from
the browser.
2016-03-06 18:52:22 +05:30
Ashesh Vashi
3051e7cd62 Log the exception loading the module script on the console. 2016-02-28 17:05:50 +05:30
Ashesh Vashi
f8a45799b6 Resolved an issue related to adding menus dynamically using the jinja2
templates. The variable scope for the jinja2 template variable is not
consitent across all the for loop (loop withing loop), it was behaving
inconsistently, a value set in a loop was not properly accessible in
inner loop properly. In order to resolve the issue - setting/using the
variable only in inner loop, and call add_menus function multiple times,
which we were trying to avoid, but - we can live with that.
2016-02-28 17:00:52 +05:30
Ashesh Vashi
2bf8eccb67 Pass the tree item (missing from the code) for making it inode agai. 2016-02-28 12:15:08 +05:30
Ashesh Vashi
2d7a218792 Resolved few issues with browser.js:
(dynamic menu generation, typo in error message)

- Dynamic menu generation code was failing for some corner cases.
- Removed trailing whitespaces.
- Resolved a typo in the message - 'click_for_detailed_msg', which was
  resulting in '{}' message instead of actual error message.
2016-02-28 12:15:08 +05:30
Dave Page
0b1cf1ad2c Remove an unnecessary line ending. 2016-02-24 16:42:38 +00:00
Akshay Joshi
c153032e3b Add support for displaying dependency and dependents info. 2016-02-22 13:07:16 +00:00
Akshay Joshi
8186e45844 Adding Numeric control support for Backform.
This patch also includes an issue related to IntegerControl, which does
not emit any error message, when it has some issues.

In order to fix the issue, it will trigger 'pgadmin-session:invalid'
event, when the input value is not an valid integer.
2016-02-22 17:18:08 +05:30
Akshay Joshi
dafd2f3323 Add support for Resource Groups in EDB Advanced Server 9.4+. 2016-02-22 10:51:35 +00:00
Dave Page
2a52462dbf Add a simple version check mechanism to warn the user if a new release is available. 2016-02-08 16:28:20 +00:00
Harshal Dhumal
c6cfad4f01 Fix minor status bar display issue. 2016-01-21 09:10:00 +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
Ashesh Vashi
2acba32c86 Moving the data model and collection to separate module for better code
handling.
2016-01-19 10:16:02 +05:30
Ashesh Vashi
6a071292aa Adding two new controls tab and fieldset for better layout management
used in some of the nodes.
2016-01-17 22:21:05 +05:30
Harshal Dhumal
4e5e7755b5 Make the privilege control to work as expected. Using the
NodeListByNameCell for selecting the grantee.

This patch includes:
- Change the RolePrivilegesModel schema to allow to use the
  NodeListByNameCell for showing grantee, and granter information.
- When setting some value - do not use the silent flag in Select2Cell, which
  will allow the session manager to take the value in account, which is
  used by the NodeListByNameCell.
- Set the top object in the children of the UniqueControl collections.
  [Ashesh Vashi]
- Pass on the node information to the actual data model, so that - we can use
  node information by the control itself. [Ashesh Vashi]
- While adding the new privilege, set the granter to the current user.
  [Ashesh Vashi]
2016-01-15 19:10:49 +05:30
Ashesh Vashi
586b81b162 Data management within the properties dialog in Create/Edit mode is not
done using the Backbone event management.

Emitting 'pgadmin-session:*' for different operations, when we
create/modify the data within the properties dialog.

We will keep track of each child node using the handler object within
the Model, and Collection objects, also - provides them the name of the
attribute, it represents. It will be used to identify the invalid nested
objects within the existing object.

Also, provide the array of modified variables, which were modified in
the validation function to avoid checking each, and every thing in the
validation function. We will need to validate that particular and the
dependent attributes only.

Also - avoid multiple validation operations from the parent object to
improve performance. And, depends on the event based operations for
validation, instead of integrate the data operation and view operation
within one operation. We do maintain the invalid objects, and validate
them only from the collection objects, which also helps improve the
performance during validation.
2016-01-15 16:41:36 +05:30
Ashesh Vashi
4feea580aa Using the events to track the session changes, and enable/disable Save,
Reset buttons.

Also - setting/reseting the error messages on status-bar when data are
not valid.
2016-01-12 22:21:33 +05:30
Ashesh Vashi
2bdd449bd0 Changed the way - we saw the title in the panel to allow the node to
decide, what to saw.
2016-01-11 21:30:46 +05:30
Ashesh Vashi
65f70b46ce Remove the objects from the session while JSONify the objects, sent to
the server.

Also - set width of the select2 container to 100% under backgrid.
2016-01-09 21:55:21 +05:30
Ashesh Vashi
429f585a62 Resolved an issue found generating the URL for some other node from some
other.

i.e.
While fetching the database nodes from the role nodes, it was generating
the wrong URL.

Used the parent_type in each node to identify maximum node URL level
using the priority set in the tree node hearachy information, and
generate URL up to that level only.
2016-01-09 19:54:53 +05:30
Ashesh Vashi
a611f84aad data stringification was not done, when object was not modified, and
passed as it is and that leads to error during fetching the modified
SQL.

Thanks Neel for the point out.
2016-01-07 18:31:13 +05:30
Ashesh Vashi
5e67ca959d JSONinfy all data in new mode for the Backbone.Model.
Also, takes care about not quoting the identifier, when found any digit
in the name (except it starts with a digit).
2016-01-07 09:40:45 +05:30
Ashesh Vashi
ee3efc369d Stringify the data only during GET mode. 2016-01-07 08:37:14 +05:30
Ashesh Vashi
753793820b Resolved an issue in the sesion tracking, and generating the data
properly.

Also, takes care of setting options to empty array, when it couldn't
fetch the options for the NodeAjaxOptionsControl.

And, generating proper url for 'msql' url in the SQL tab, when creating
new node from the same type of node.
2016-01-06 19:20:55 +05:30
Ashesh Vashi
456f5bc5b7 Making minor changes:
* Start tracking changes immediatedly depends on the handler.
* Attaching control with the filter in the NodeListByNameControl.
* Generating proper data for the NodeListByNameControl.
2016-01-06 02:25:13 +05:30
Murtuza Zabuawala
675e79daab Adding the IntegerControl for the backform.
(With few cosmetic changes by Ashesh.)
2016-01-05 16:50:00 +05:30
Ashesh Vashi
d498b473c7 Changing the caching mechanism to allow it to store at particular level.
Some data will be applicable to parent level, even though - it has
been fetched it from a particular node.

i.e.
roles will be applicable to server level (not particular role level).
2016-01-05 14:36:33 +05:30
Ashesh Vashi
aec96b4933 Adding the node at correct place in the browser tree after creating new object. 2016-01-05 13:02:00 +05:30
Ashesh Vashi
7beaefd1c6 Resolving few issues with the drop/drop cascade object function at front-end.
Also, modified the translation messages as per Dave (Thanks Akshay Joshi for the patch).

Modified the way, we show the error message dialog.
2016-01-05 12:36:33 +05:30
Ashesh Vashi
faa984debc Append the new node under the collection, when it should be. 2016-01-05 02:15:22 +05:30
Ashesh Vashi
8cd0fda406 Pass the data of the parent, not type, while checking in the isParent(..) function 2016-01-04 23:25:21 +05:30
Ashesh Vashi
6b0f4790da Show the menus "Delete/Drop", and "Drop Cascade", when defined respective functions canDrop(..), and canDropCascade(..) for the node. 2016-01-04 21:57:18 +05:30
Ashesh Vashi
ec7e98e6a7 Allow a node to have two types of parents, modified the code to handle
such situation. This has been modified specifically for the children
under the schema, and catalog nodes.

Also, override the Backform.Control.prototype.render function to allow
to provide the control data to the evaluable functions (i.e. disabled,
visible, required).
2016-01-04 17:52:34 +05:30
Ashesh Vashi
84843f8c37 Pass the tree item object to the menu objects, which could be used by
the disabled function to make it enable/disable based on the current
selected item.
2016-01-04 17:22:06 +05:30
Harshal Dhumal
9d9f17c163 Clear the status-bar on the 'on-status-clear' event of the model 2016-01-04 16:54:06 +05:30
Harshal Dhumal
6057259bdc Create the status-bar in the properties dialog, and it will listen for
on-status event from the model.
2016-01-04 13:35:11 +05:30
Ashesh Vashi
eb83d57c5a Introduced new controls to show the list of a node type (by name and id) as properties of other node.
Resolved a typo in privileges control.
Removed duplicate lines in backform.pgadmin.js
2015-12-28 01:00:20 +05:30
Murtuza Zabuawala
d56ddb9fa4 Adding the SQL tab for the nodes, with 'hasSQL' property set to true, in
create/edit mode. It will fetch the modified sql using the 'msql' url
specific to that node.

Also, modified by Ashesh before committing it.
i.e. Added code comments, cleanup code for the control, etc.
2015-12-26 16:15:40 +05:30
Ashesh Vashi
402e89e535 Keep all the information in the tree node data in the
getTreeNodeHierarchy(..) function, and make changes to make the
generate_url function to work with it.
2015-12-26 14:22:29 +05:30
Ashesh Vashi
d55b02aeab Resolved a typo in collection.js, which leads to not adding the
properties of a node in backgrid list with mode parameter.

Thanks Akshay Joshi for reporting the issue.
2015-12-23 18:11:30 +05:30
Ashesh Vashi
c51ecc69e4 Resolved few intialization issue with Node model data, moved the
privileges functionality out of the backform.pgadmin.js to make it more
modular. Now - privileges will expect the privileges data in following
format:
<name_of_the_property> : [{
    "privileges": [{
        "privilege_type": <privilege_type>,
        "privilege": true,
        "with_grant": false
    },
    ...
    ],
    "grantee": <grantee>,
    "grantor": <grantor>
    },
   ...
]

Example:
acl": [{
    "privileges": [{
        "privilege_type": "CONNECT",
        "privilege": true,
        "with_grant": false
     	}],
    "grantee": '',
    "grantor": 'ashesh'
},{
    "privileges": [{
        "privilege_type": "CREATE",
        "privilege": true,
        "with_grant": false
    },{
        "privilege": true,
        "privilege_type": "TEMPORARY",
        "with_grant": false
    }],
    "grantee": test,
    "grantor": ashesh
}]
2015-12-23 12:10:23 +05:30
Ashesh Vashi
0273c29283 Introduction of the privilege support for database object (Patch:
Murtuza Zabuawala), and Unique column control for backform (Harshal
Dhumal).

Also, includes some fixes for the model, & collection handling.
2015-12-17 18:30:42 +05:30
Ashesh Vashi
ca0b1f20df Fixed the issue while parsing, and assigning the data properly in the Node. 2015-12-17 16:13:36 +05:30
Ashesh Vashi
2f1eac1243 Removed the undo manager from the node implementation, as it is causing some issue, which rendering some code, which requires detailed attention. 2015-12-16 13:37:49 +05:30
Ashesh Vashi
8611e29c60 Pass on the browser tree events by generating node specific 'browser-node' events.
Added a test event in test.js
2015-12-16 13:27:08 +05:30
Murtuza Zabuawala
c3b517cb91 Using bootstrap-swtich for creating a custom backform control for
boolean values. (Modified quite a lot by Ashesh, before committing).

This patch also allow to set the header class in the backgrid through
setting  'cellHeaderClass' property of the schema object for any of the
node. It will allow us to set the different behaviour of the cell in the
list. One of the test case for it is: this will allow us to set the
different width of each column in the list using CSS class(es).
2015-12-04 17:16:49 +05:30
Ashesh Vashi
57d6c3b406 Do validation before enabling the Save button. 2015-12-04 15:33:16 +05:30
Ashesh Vashi
537df154fe Fixing few issues with context menu icon missing.
Introduced a new ajax function to return the HTTP Status code 410 (GONE).
Changed the location of the javascript from each modules, it loads.

Added .swp, .swo files in the .gitignore file
2015-12-04 14:47:18 +05:30
Ashesh Vashi
b36e264fd3 Load collection.js along with the node.js from browser.js 2015-11-28 20:19:29 +05:30
Ashesh Vashi
6d46dfbfba Added new url rules for each node by change NodeView class:
- Renamed the URL 'nodes' to 'children', because - we'll return the
  children for the current node.
- Using the URL 'nodes' to fetch all nodes of its type, when not
  specified the node-id, otherwise regenerate that node info using the
  node-id (it will be used by the refresh function).

- Added the URL 'msql' for fetching modified SQL for the modified
  objects.
- Separated the URL 'deps' (GET/POST methods) to 'dependency' and
  'dependent', because - it will be used to fetch the properties of the
  object, not manipulate it. (as suggested by Dave).

This commit includes the changes related to it in the specific nodes.
(i.e. server-group, and server).

Also, includes a javascript change to ask the user (if they really want
to leave the page, and it is not an accidental navigation by keyboard
shortcuts).
2015-11-23 13:57:43 +05:30
Ashesh Vashi
9bc9025075 Issues resolved related to connection management and collection nodes:
- Allow to release connection using the database OID (did).
- Generate correct url for the collection nodes.
- Removed the server-type from the collection node module, from the
  generate_browser_collection_node(...) function.
- Show version string, and not version integer in the server properties
  (when connected).
2015-11-20 14:55:55 +05:30
Ashesh Vashi
5ff09223a2 Allow to generate events from the nodes, whenever some any events.
i.e.
'server-connect' and 'server-disconnected' events will be generated
while server gets connected and disconnected respectively.

For demo purpose - listening to the server connection from the test
script.
2015-11-19 23:42:01 +05:30
Ashesh Vashi
77834ccdda Changed the logic to identify the PostgreSQL server variant, when we
connect to the database server. Also, added modified the way, we do
check the node is supported by the server.

Instead of creating separate blueprint for the server types, they will
be independently works. In order to add different variant of the
PostgreSQL, we need to extend the ServerType class, and override the
'instanceOf' function for identification using version string. Please
take a look at the ppas.py for the example.

During checking the back-end support for the node, we will also check
the server type (variant) along with the version within the range of
maximum and minimum version for the node. And, the same support added
for the schema attributes in front-end (JavaScript).

Really thankful to Khushboo Vashi for her initial work in front-end. I
took it further from there.
2015-11-19 23:18:00 +05:30
Ashesh Vashi
3077da0062 Resolved an issue when refreshing any browser node 2015-11-17 11:54:32 +05:30
Khushboo Vashi
ed8600ef89 Adding support for collection browser node. 2015-11-17 11:53:14 +05:30
Ashesh Vashi
cbab08aaaf Do not set focus to the properties container, when selected any node.
As discussed with Khushboo, we need a negate function of disabled in the
backgrid cell.
2015-11-03 12:36:34 +05:30
Ashesh Vashi
45596dffa0 Resolved few undo action on UI tabs - tabs were not getting activated
during undo-redo action. Also, resolved the focus losing issue, which
closing the subnode editor using undo action.

Also, resolved an issue related to 'beforeopen' failed on server node,
due to api changes on tree events.
2015-10-30 13:07:12 +05:30
Ashesh Vashi
30c560f33b Added undo action on some of the UI changes too.
i.e. Switch between the tabs, opening/closing the subnode in edit mode.

Also, removed the Save, Cancel buttons from the subnode editor, it was
looking very redudant. Ctrl+Z for undo, Ctrl+Shift+Z/Ctrl+Y for Redo
shortcut will be good enough for undoing all the changes in the
properties panel.
2015-10-30 02:03:29 +05:30
Ashesh Vashi
c1db54b2c2 Allow to save only the partial model changes, undo-redo operation
within the edit/create dialog/panel using the backbone.undo.js.
2015-10-28 22:54:30 +05:30
Khushboo Vashi
c1503ade47 Introducing the infrastructure for colleciton of the subnodes listing,
creation, and editing within the properties panel infrastructure.

We do use the backgrid.js for listing the subnode collection, and for
editing/creating new object for the subnode, we do use the same
infrastructure using the backform.
2015-10-28 22:36:09 +05:30
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
4e5e0c125f Resolved an issue related enabling the menus for the selected node 2015-09-21 10:15:41 +05:30
Ashesh Vashi
798398dba5 Fixed few bugs and changed the node create/edit view to use the dialog
(tabbed) UI.

Also, fixed few bugs pointed by Dave:
* Open the URL in separate browser tab/window.
* Fixed few CSS changes for look and feel for the dialog view
* Some of the panels were not listed in the context menu for the
  wcDocker.
2015-08-11 19:19:29 +05:30
Ashesh Vashi
b0b964dd55 Adding the module.js route for each in the NodeView class. 2015-07-30 16:17:34 +05:30
Ashesh Vashi
146e901327 Show the disabled control in view only mode of properties 2015-07-22 22:27:32 +05:30
Ashesh Vashi
8a8c8bbae4 Try to make the look and feel of the UI same as it was earlier for consitency. 2015-07-22 09:46:11 +05:30
Ashesh Vashi
9d372a4555 Updated wcDocker to the latest version 2015-07-20 16:06:17 +05:30
Ashesh Vashi
59e87183a1 Resolved a bug introduced in last commit 2015-07-17 11:22:14 +05:30
Ashesh Vashi
dee3185bae Resolved a bug with the menu enable/disble logic.
Also, do not generate list disabled menu in the context menu
2015-07-17 10:06:04 +05:30
Ashesh Vashi
605f9aba32 Removed the readonly mode from the properties panel for any object.
Changed UI as per feedback from Dave
2015-07-14 13:15:59 +05:30
Ashesh Vashi
6ef2384e7f Allow to make change the behaviour of backform control based on other
attribute value.
2015-07-14 09:29:49 +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
Ashesh Vashi
35d01bea3e Introduced a class - NodeView to achieve REST API required by the
PostgreSQL node(s).

Browser Tree Node (PostgreSQL object) requires more than just CRUD.
i.e.
   - CRUD (Create, Read, Update & Delete)
    - Reversed Engineered SQL for the object
    - Modified Query in edit mode
      i.e. ALTER TABLE ...
    - Statistics
    - List of dependents
    - List of dependencies
    - Children node list

This class can be inherited to achieve the different routes for each of
the object types/collections.

    OPERATION      |              URL       | Method
    ---------------+------------------------+--------
    List           | /obj/[Parent URL]/     | GET
    Properties     | /obj/[Parent URL]/id   | GET
    Create         | /obj/[Parent URL]/     | POST
    Delete         | /obj/[Parent URL]/id   | DELETE
    Update         | /obj/[Parent URL]/id   | PUT

    SQL (Reversed  | /sql/[Parent URL]/id   | GET
    Engineering)   |
    SQL (Modified  | /sql/[Parent URL]/id   | POST
    Properties)    |

    Statistics     | /stats/[Parent URL]/id | GET
    Dependencies   | /deps/[Parent URL]/id  | GET
    Dependents     | /deps/[Parent URL]/id  | POST

    Children Nodes | /nodes/[Parent URL]/id | GET

    NOTE:
    Parent URL can be seen as the path to identify the particular node.

    i.e.
     In order to identify the TABLE object, we requires information
     about the server -> database -> schema objects.

     Hence, the Parent URL for the TABLE object will be something like
     this as below:
     <int:sid>/<str:database>/<str:schema>

Inherited a new classes ServerGroupView and ServerView, which are
inherited from the NodeView for the implementation of above operations.
2015-06-29 13:41:56 +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
Ronan Dunklau
9e0b011ec8 Fixed the letter case of the javascript file names.
Also, JSON data should be returned to the client using an
application/json MIME-TYPE using flask's jsonify function.
2015-06-29 12:23:11 +05:30
Dave Page
751f8383fa Handle standard menu items defined by Nodes in the browser.
The File menu now includes a "Create" submenu, and Delete/Rename
options. Nodes can offer Delete/Rename functionality, and the
options on the menu are automatically enabled/disabled based on
the selected node. Each node can also offer Create functionality,
and specify a list of node types (including itself) from which the
option should be made available. The menu is dynamically generated
based on the selected node.

The Context menu on the treeview works in a similar way, except that
nodes can offer any context menu items (we don't allow this on the
top menu, as that should stay consistent to avoid user confusion).
2015-03-13 10:35:12 +00:00
Dave Page
e451ad5ddc Make the SQL Pane "just another tab". This allows the user to position it
as required, and by default makes the UI less cluttered.
2015-03-10 14:31:49 +00:00
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
c9b0273a14 Fix iFrame panels on Firefox. 2015-03-09 09:57:51 +00:00
Dave Page
caff78053b Update to use the new skeleton CSS from wcDocker, and restore a default
layout if the saved one fails for any reason.
2015-03-05 11:13:15 +00:00
Dave Page
7441d98c49 Allow modules to create browser panels. 2015-03-03 16:23:19 +00:00
Dave Page
527620d34e Update wcDocker to enable properly translation of the context menu options. 2015-03-03 11:11:15 +00:00
Dave Page
cd059aaea3 Fix i18n for the docking system. 2015-03-03 10:51:29 +00:00
Dave Page
eef0a48823 Fix placeholder text. 2015-03-03 09:45:53 +00:00
Dave Page
06be3d39be Replace the browser layout code with a new system based on wcDocker.
This is far more powerful, giving us tearable tabsets, versatile docking
and various other features.
2015-02-27 13:47:48 +00:00
Dave Page
83cbe87040 i18n support. 2015-02-25 17:06:00 +00:00
Dave Page
39089cca21 Add a Sphinx based help system, and include some initial docs on development. 2015-02-23 10:51:47 +00:00
Dave Page
bedaa52693 Fix the about menu option, only display menus if they have items on them,
and add a management menu for future use.
2015-02-20 10:43:50 -05:00
Dave Page
7179b79b8c Add an ID to main menu options. 2015-02-20 10:26:25 -05:00
Dave Page
a36cb5ae10 Make context menu items hookable. 2015-02-20 09:56:02 -05:00
Dave Page
37be918074 Move the JS code for the main browser out of the HTML template
and into the browser.js view.
2015-02-20 09:37:42 -05:00
Dave Page
b43580a19e Add a context menu to the treeview, with options to delete and rename server nodes.
TODO: Make the menu items hook in.
2015-02-18 22:06:12 -05: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
e2832351ed Miscellaneous fixes and cleanups. 2015-02-13 15:19:08 +00:00
Dave Page
b5abf2c640 Cleanup the way stylesheets and scripts are injected into pages by modules. 2015-02-13 14:48:31 +00:00
Dave Page
45d536f524 Remove "vendor" from the global JS path. 2015-02-13 13:36:00 +00:00
Dave Page
b09c1b6c68 Fix the gutter height of the editor when the parent is resized. 2015-02-13 13:13:36 +00:00
Dave Page
f4982efb19 Oh look, a syntax highlighting, line numbering, block folding, auto-complete-capable editor. 2015-02-13 11:57:23 +00:00
Dave Page
075bce2b40 Fix the navbar so it's responsive 2015-02-12 14:59:28 +00:00
Dave Page
4c29f4385f Render browser settings into the template rather than using synchronous AJAX calls to get them. 2015-02-12 10:46:21 +00:00
Dave Page
afb029e284 Factor out client side settings functions into their own JS file,
and add additional variations for getting ints, floats and bools.
2015-02-11 15:50:36 +00:00
Dave Page
adeb2f9e84 Allow multiple settings to be stored at once to avoid multiple requests. 2015-02-11 12:50:45 +00:00
Dave Page
e995104000 Initial cut at saving/retrieving the main browser layout.
Still needs some work to:

- Minimise AJAX calls by writing multiple settings at once.
- Move the settings storage/retrieval JS code into a global file
- Avoid using synchronous AJAX calls in the main thread
2015-02-11 10:00:57 +00:00
Thom Brown
506dd6437f Various HTML 5 fixes. 2015-02-06 13:15:36 +00:00
Dave Page
1b6d7edd01 Add the core of the main browser layout. 2015-02-05 14:06:20 +00:00
Dave Page
53d649de70 Add support for creating dialogs, and add an About dialog.
This adds bootstrap-dialog to help with creation of nice dialogs,
and adds the ability for modules to render Javascript into the
browser, and specify onclick handlers in the menu system.

Also add a basic About dialog, using the new infrastructure and
showing some useful info about the application.
2015-01-27 16:54:39 +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