Commit Graph

191 Commits (3bbfd8a19f20d19551bab037c4b15bb05a8031ce)

Author SHA1 Message Date
Ashesh Vashi 944bdbb96c Improvised the 'transform/options' function usage with the Select2Cell.
The current implementaton binds the cell/control object, and the ajax
data in the asychronous Cells/Controls with the 'options' functions
extended from the Select2Cell.

The problem starts when we try to fetch the current model from that
options/transform/filter function to do some operation, which does not
require in most of the cases. Except the privileges control - where we
needed the current model for omitting the existing selected object
during transformation, and filtering.

In order resolved the issue, we need a common object, which is shared
among the Cell. In backgrid, the 'Column' object is mong the cell,
hence - implementation logic has been changed to bid the 'Column' object
with the 'options' function and, passed the 'Cell' object as an
arguments.

Because - we do use the common function 'transform' between 'Control'
and 'Cell', we needed make changes in the Select2Control to pass the
Control object as an arguments.

And, make the changes in the privileges control to use the new
implementation. The same logic is also required in some of the
operations, we will be/are working on the table/column nodes.
2016-04-08 11:10:34 +05:30
Dave Page 4ec4b4f43e Improve dialog title bar colouring. 2016-04-07 22:05:55 +01:00
Arun Kollan 22841f8664 Cleanup styling of wcDocker tab control buttons. 2016-04-07 13:40:16 +01:00
Murtuza Zabuawala 3914f5095a Fix sub-node error display. 2016-04-07 11:51:16 +01:00
Dave Page 01d6b46838 Minor adjustment to the menu font sizing. 2016-04-05 17:10:12 +01:00
Dave Page 34ef5790ba Revert style change introduced in commit f7e4e8bea0 as it's removing padding from all grids. 2016-04-05 16:45:38 +01:00
Murtuza Zabuawala f7e4e8bea0 Use separate editor for Select2Cell.
This allows us to use the Backgrid key navigation as expected.

This has also resulted into an issue - related unresponsive scrollbar
issue in the SubNodeControl.
2016-04-04 15:36:31 +05:30
Khushboo Vashi 35a1390251 Resolved few issues in the collection controls. UniqueCollectionControl
was not honouring the change events after execution of the function -
'render' more than one time. Change the label of the Add button to make
it consistent with the Unique Collection Control.
2016-04-01 15:26:15 +05:30
Ashesh Vashi 0654bae816 Adding the font used by jQuery-contextmenu (v2.1.0) 2016-04-01 11:57:55 +05:30
Ashesh Vashi d70535385b Upgraded the jQuery-contextMenu to v2.1.0 (latest stable version) in
order to fix the issue rendering the context menu for longer text.

Needs to do some modification in the existing pgAdmin4 CSS theme to make
it looks like/near the existing look and feel.
2016-03-30 19:08:27 +05:30
Ashesh Vashi a28df1e0a2 Allow to show help string in each of the contorl. 2016-03-24 13:00:15 +05:30
Dave Page a6e96c5576 Set appropriate default values for the boolean switch control. 2016-03-23 10:24:19 +00:00
Harshal Dhumal 219f208317 Evaluate the disabled option in SwitchControl.
Also - for consistency reason use the same evaluation logic in each of
the control.
2016-03-23 12:51:29 +05:30
Harshal Dhumal 709311b77c Fix issues with multiple subnode forms being open at once when adding rows to a grid. 2016-03-22 17:04:46 +00:00
Harshal Dhumal ddd4768937 Backform control for selecting multiple columns.
Usage:

{
  id: 'columns', label: '{{ _('Columns') }}',
  type: 'collection', group: '{{ _('Definition') }}', editable:true,
  canDelete: true, canAdd: true, control: Backform.MultiColumnSelectControl,
  deps: ['index'], node: 'column',
  model: pgBrowser.Node.Model.extend({
    keys: ['column'],
    defaults: {
      column: undefined
    }
  })
}

Note: When using this control model should have column attribute. And node property should be column.
2016-03-22 16:52:34 +00:00
Surinder Kumar 03349f4af6 Update the backform control to support sql-fields.
Following are the enhancements:
1. Added border to control which was missing earlier.
2. Allows user to provide height to sql-field control by specifying extraClasses field in model schema.
3. Defined new classes for sql-field control height in overrides.css
4. Added scrollbar to the control.

Usage:

{
  id: 'definition', label:'{{ _("Definition") }}', cell: 'string',
  type: 'text', mode: ['create', 'edit'], group: 'Definition',
  control: Backform.SqlFieldControl, extraClasses:['custom_height_css_class']
}
2016-03-22 16:36:54 +00:00
Harshal Dhumal 8189b39b1e Configuration options for switch control from different places should be merged together and not overridden. 2016-03-22 14:28:13 +00:00
Arun Kollan 06c0cf607d Make tabsets look consistent, and square off the properties sections a little. 2016-03-22 13:31:48 +00:00
Murtuza Zabuawala 530f58e66b Add support for inline fieldsets. 2016-03-18 16:54:43 +00:00
Ashesh Vashi 0fcfaa4ff2 Updated the font-awesome to 4.5 (latest) version. 2016-03-18 01:34:45 +05:30
Ashesh Vashi 96b33d1aa8 Updated the jQuery-contextMenu to 1.9.2 (latest stable) version.
Also, added the missing license information about it in the libraries.txt.
2016-03-18 01:11:22 +05:30
Neel Patel 3969e91563 Add support for Foreign data wrappers, servers and user mappings. 2016-03-17 11:39:38 +00:00
Arun Kollan 05e527505d First pass at improving the dialogue borders. 2016-03-16 17:12:41 +00:00
Khushboo Vashi 3df180831f Support textareas in backgrid. 2016-03-16 14:48:09 +00:00
Dave Page 62bd1a21cc Improve message display. 2016-03-15 15:45:40 +00:00
Dave Page 2711d3492d Reduce column header letter spacing a touch. 2016-03-15 14:12:54 +00:00
Ashesh Vashi b52a5736ff Improvements in the form/properties dialog control generation, and data
change events.

- In input & textarea control, call the change event on key up (but -
  not on every key up events, wait for sometime before trigger that
  event, so that - we do not overdo that).
- In unique/subnode control, whenever we create new model object, set
  all the required static fields used by pgAdmin form generation logic.
- In NodeAjaxListCell, we don't need to call the list generation
  operation (ajax operation) for each and every cell. They use the same
  shared column object.
2016-03-15 18:58:22 +05:30
Arun Kollan cdd7a1f637 Subnode collection layout improvements, with additional tweaks from me. 2016-03-15 12:30:01 +00:00
Murtuza Zabuawala 9220dcaa97 Fix an issue with uneditable text fields containing large amounts of data, 2016-03-14 09:31:36 +00:00
Khushboo Vashi 2f334673a3 Fix a couple of issues with the unique-collection control:
- Pass the data to evaluation functions like canEdit, canAdd
- Properly honour the canAdd option.
2016-03-11 09:36:26 +00:00
Dave Page d21e60cc60 Fix default height for text areas. 2016-03-11 09:24:05 +00:00
Arun Kollan 17ed27fbcd Make the dialogue control sizing slightly more compact and properly control textarea resizing. 2016-03-10 15:31:43 +00:00
Khushboo Vashi 3b03c17f2b Allow enabling/disabling of the Edit button of a sub-node collection grid. 2016-03-10 12:03:33 +00:00
Arun Kollan 5d6c5bc74d Improve display of error messages on dialogues. 2016-03-09 16:03:24 +00:00
Dave Page 5ea822f33e Preferences dialogue. Patch by Ashesh and Khushboo Vashi. 2016-03-07 11:48:53 +00:00
Ashesh Vashi 43116750b4 Honor the visible property of the model schema, and show/hide different
custom contorls based on it.
i.e.
UniqueCollectionControl, TabControl, FieldsetControl, etc.
2016-03-07 16:06:18 +05:30
Ashesh Vashi cc08708f23 Allow to specify special type - 'group' in schema for the browser node,
which allows to determine certain group to hide/show the whole
tab/fieldset control in the properties, and create dialog.

Using this functionality in the database for the
'default privileges - types', which is not allowed before PG < 9.2 using
the version check.
2016-03-06 18:50:10 +05:30
Ashesh Vashi ee71cab51e Removed the wrong copyright information in the javascript file, which is
owned by pgAdmin IV.
2016-03-04 17:39:51 +05:30
Murtuza Zabuawala fa97b5635e Enable/disable edit button functionality conditionally in backgrid. 2016-03-04 11:55:50 +00:00
Murtuza Zabuawala 6ed5e7183e Backform control enhancements:
1) Unique collection control: we have added 'Edit' button in grid, earlier it was only delete button.
2) Sql field control: We have added control to disabled & visible functionality which were not available.
2016-03-04 11:00:17 +00:00
Khushboo Vashi 789ece89fb In the current Backgrid implementation, a cell can be made editable through "editable: true/false" settings. It takes only a boolean value.
Add support for a function that can be set as an editable option value.

For Example:

editable: function(m) { return false; }
2016-03-03 14:03:59 +00:00
Ashesh Vashi 18d767b107 Updated the wcDocker to make use of wcSplitter (new functionalities),
which will be used by the debugger tool.

Updating the wcDocker from the repository -
'https://github.com/WebCabin/wcDocker' up to commit-id:
0f5690318ce0bf457fdd374dcec7418d22b72e22
2016-02-29 19:36:51 +05:30
Akshay Joshi b3ff96d2db Add backgrid extensions for use in various tools: select-all, paginator and filter 2016-02-26 11:08:45 +00:00
Dave Page f0e7bd91cb Improve warning message 2016-02-25 11:58:02 +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
Ashesh Vashi db9b5f0e0c Resolved the issue related showing errors in the radio control. 2016-02-22 17:00:17 +05:30
Khushboo Vashi 637a5838a8 Resolved a typo in variable name 'version_compatible' 2016-02-10 12:12:06 +05:30
Harshal Dhumal a0648ed54b Using different strategy to render different type of data based on the
type for the Variable control, instead of using the complex DynamicCell.
2016-02-05 14:35:52 +05:30
Ashesh Vashi 7df9e752bb Adding new control to show SQL query in a control.
It will be used by the nodes like view, which require to show the code
inside as one parameter.

Also, override the events for the Backform.TextareaControl in order
handle some cases, which were not handling the change in textarea
properly in all situations.

Also, we need to show the error message around the input control with
name attribute only.

Author: Surinder Kumar (small twicks by me).
Reviewed by: Ashesh Vashi
2016-02-05 13:37:01 +05:30
Khushboo Vashi e90fef7b5b Fixes an issue in the backform schema generation logic to allow to use
the NodeAjaxOptionsControl in the subnode grid.
2016-02-03 16:27:15 +05:30
Murtuza Zabuawala 14583e68b2 Allow to run the transform to be evaluated as function in the NodeAjaxOptionsControl 2016-02-01 16:37:05 +05:30
Harshal Dhumal 8f18ff04ae Fix border display issue in unique column collection 2016-01-21 09:11:14 +00:00
Ashesh Vashi 0cea682e88 Initialize and parse the neseted schema too.
Renamed the type of the nested schema type to 'nested' from 'uiLayout'
to be more relatevant.
2016-01-19 17:54:39 +05:30
Ashesh Vashi 7e621c9d7f Using the new logic after using generateViewSchema(...) function for
generating schema properly for the collection for rendering the grid.
2016-01-17 22:31:54 +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
Murtuza Zabuawala 45240f3850 Use the same schema parameter 'visible' instead of separate one (i.e.
show) for both control and cell, while generating the columns and field
Schema. And, it was resulting into wrong behaviour because of that.

Also - includes the server changes, which was using 'show' parameter
earlier for showing version, when server was connected.
2016-01-15 19:26:03 +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 3a06758b94 Integrate the new mechanism for the data session management in the
variable control, privilege control, which specifies the keys - which
helps identify the data from the collection. Also, resolved an version
compatibility issue with the variable control.
2016-01-15 16:47:22 +05:30
Ashesh Vashi 185ac442fc Fixes few UI issue with the backform controls.
1. NodeAjaxOtions needs to check 'version_compability' in field, and not
   'ver_in_limit' variable. (Thanks Murtuza for pointing that out.)
2. Override the input control to catch the change properly in it.
3. Updated the UniqueCollectionControl and Variable Control to render
   proper template in the header.
2016-01-12 13:40:36 +05:30
Ashesh Vashi 5b9b55ee8e Passing the version_compability information in the controls, and use
them in the custom controls.

This commit also includes the patch from Harshal regarding the broken
updateInvalidate(..) function.
2016-01-12 12:01:47 +05:30
Ashesh Vashi fc926d7200 Resolved an issue of selection in the Select2Cell, when the value is of
type string and not an array.
2016-01-12 00:09:00 +05:30
Ashesh Vashi c90c673900 Override the updateInvalid function for uniquer-cotrols. 2016-01-11 21:32:09 +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 8f733aabd0 Added support for select2 control for using select2 instead of simple
select input.
2016-01-09 18:08:48 +05:30
Ashesh Vashi 1ba9067c60 Introduced the VariableControl, which will be used in role(s),
database(s), and tablespace(s).

Thanks Harshal Dhumal for sharing the original patch.

I've modified a lot to work by fetching the variables later by giving a
url.

Also,
- Introduced the template macros for SECURITY LABELS and VARIABLES.
- Improvised the Backform.Control with better syntactic approach.
- Introduced a jquery function pgMakeVisible(..) to make it visible
  under any obj which can be identified by unique class.
2016-01-09 18:00:02 +05:30
Murtuza Zabuawala 6062343bf5 Set the value in the model when the value is valid in the
IntegerControl.
2016-01-07 18:50:15 +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
Harshal Dhumal fe05f2d0c6 Resolved an issue setting proper optionsValues for the Select2Cell. 2016-01-07 13:30:46 +05:30
Harshal Dhumal df594d56e5 Resolving issue setting proper value for options in Select2Cell 2016-01-07 10:55:22 +05:30
Ashesh Vashi ee3efc369d Stringify the data only during GET mode. 2016-01-07 08:37:14 +05:30
Harshal Dhumal 67a80ce8dd Adding Select2Cell, which uses select2. 2016-01-07 08:35:20 +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
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 bd3492afdf Pass the model properly, while checking enable/disable for Select control. 2016-01-05 15:02:45 +05:30
Ashesh Vashi 9f8a46c820 Passing the control, and field information along with the model while
rendering the Select control.
2016-01-05 13:18:49 +05:30
Ashesh Vashi 1945872e3f Send ajax request as 'application/json', while fetching the modified sql
from the dialog properties.
2016-01-05 02:17:40 +05:30
Ashesh Vashi 3a261b429a Added select2 as dependency 2016-01-04 23:23:16 +05:30
Ashesh Vashi cd40a07ac3 Resolved a typo in the backform.pgadmin.js, while extending the
Backform.Control.prototype.render(..) function.
2016-01-04 19:27:54 +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
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 109b367fc3 Allow to specify the options as a function, which returns array in form
of (label, value) tuple in the SelectControl.

We will apply the transform function, while rendering the control, and
not during intialization. This will allow us to generate different
options data based on the dependent values.
2016-01-04 11:34:43 +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 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 1391003e03 Added the backgrid cell for bootstrap switch for representing the
boolean properties.
2015-12-17 19:19:59 +05:30
Ashesh Vashi cd34ee6dd7 Switch Control was not honouring the user's options for bootstrap switch 2015-12-17 18:41:36 +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 c796eee2a7 Do not show the properties in property windows, when they're not
applicable. i.e. not supported by that version.
2015-12-16 16:02:17 +05:30
Ashesh Vashi 54d4cdcd51 Fixed few issues with the backform custom controls.
- Fixed the server backend version check for any schema object.
- Fixed the switch control, it was not enable to toggle the values properly.
- Fixed the editableCell to work properly in the collection properties.
2015-12-16 13:43:04 +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 d753374977 Resolved a typo in the version check condition during schema generation.
Also, resolved an issue related showing the correct server variant in
properties dialog, it is a regression introduced by the patch server
version check.
2015-11-20 10:45:35 +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
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
Khushboo Vashi a1170c4c82 Do not allow to edit data from the properties dialog 2015-11-03 11:31:35 +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