1) Fixed an issue where Zoom to fit button only works if the diagram is larger than the canvas. Fixes #6163

2) Ensure that the diagram should not vanish entirely if zooming out too far in ERD. Fixes #6164
3) Fixed an issue where Generate SQL displayed twice in the ERD tool. Fixes #6179
4) Updated missing documentation for the 'Download Image' option in ERD. Fixes #6180
pull/39/head
Aditya Toshniwal 2021-01-29 11:54:50 +05:30 committed by Akshay Joshi
parent 36f76f5e2c
commit 48e257e5af
7 changed files with 44 additions and 8 deletions

View File

@ -62,6 +62,9 @@ Export Options
| *Generate SQL* | Click the *Generate SQL* icon to generate the DDL SQL for the diagram and open a query tool | Option + Ctrl +|
| | with the generated SQL ready for execution. | S |
+----------------------+---------------------------------------------------------------------------------------------------+----------------+
| *Download image* | Click the *Download image* icon to save the ERD diagram in a image formate | Option + Ctrl +|
| | | I |
+----------------------+---------------------------------------------------------------------------------------------------+----------------+
Editing Options
***************

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -19,3 +19,12 @@ Bug fixes
| `Issue #5871 <https://redmine.postgresql.org/issues/5871>`_ - Ensure that username should be visible in the 'Connect to Server' popup when service and user name both specified.
| `Issue #6045 <https://redmine.postgresql.org/issues/6045>`_ - Fixed autocomplete issue where it is not showing any suggestions if the schema name contains escape characters.
| `Issue #6163 <https://redmine.postgresql.org/issues/6163>`_ - Fixed an issue where Zoom to fit button only works if the diagram is larger than the canvas.
| `Issue #6164 <https://redmine.postgresql.org/issues/6164>`_ - Ensure that the diagram should not vanish entirely if zooming out too far in ERD.
| `Issue #6179 <https://redmine.postgresql.org/issues/6179>`_ - Fixed an issue where Generate SQL displayed twice in the ERD tool.
| `Issue #6180 <https://redmine.postgresql.org/issues/6180>`_ - Updated missing documentation for the 'Download Image' option in ERD.
. Documentation missing for 'Download Image' option in ERD. Fixes #6180.
2. Generate SQL displayed twice in ERD tool. Fixes #6179.
3. Zooming out too far makes the diagram vanish entirely. Fixes #6164.
4. Zoom to fit button only works if the diagram is larger than the canvas. Fixes #6163.

View File

@ -144,6 +144,24 @@ class ERDModule(PgAdminModule):
fields=shortcut_fields
)
self.preference.register(
'keyboard_shortcuts',
'download_image',
gettext('Download image'),
'keyboardshortcut',
{
'alt': True,
'shift': False,
'control': True,
'key': {
'key_code': 73,
'char': 'i'
}
},
category_label=PREF_LABEL_KEYBOARD_SHORTCUTS,
fields=shortcut_fields
)
self.preference.register(
'keyboard_shortcuts',
'add_table',

View File

@ -355,14 +355,15 @@ export default class ERDCore {
zoomOut() {
let model = this.getEngine().getModel();
if(model) {
model.setZoomLevel(model.getZoomLevel() - 25);
let zoomLevel = model.getZoomLevel();
if(model && zoomLevel > 25) {
model.setZoomLevel(zoomLevel - 25);
this.repaint();
}
}
zoomToFit() {
this.getEngine().zoomToFit();
this.getEngine().zoomToFitNodes();
}
// Sample call: this.fireAction({ type: 'keydown', ctrlKey: true, code: 'KeyN' });

View File

@ -158,6 +158,7 @@ export default class BodyWidget extends React.Component {
[this.state.preferences.save_project, this.onSaveDiagram],
[this.state.preferences.save_project_as, this.onSaveAsDiagram],
[this.state.preferences.generate_sql, this.onSQLClick],
[this.state.preferences.download_image, this.onImageClick],
[this.state.preferences.add_table, this.onAddNewNode],
[this.state.preferences.edit_table, this.onEditNode],
[this.state.preferences.clone_table, this.onCloneNode],
@ -556,9 +557,13 @@ export default class BodyWidget extends React.Component {
link.click();
}).catch((err)=>{
console.error(err);
let msg = gettext('Unknown error. Check console logs');
if(err.name) {
msg = `${err.name}: ${err.message}`;
}
this.props.alertify.alert()
.set('title', gettext('Error'))
.set('message', err).show();
.set('message', msg).show();
}).then(()=>{
/* Revert back to the original CSS styles */
this.canvasEle.classList.remove('html2canvas-reset');
@ -738,8 +743,8 @@ export default class BodyWidget extends React.Component {
<ButtonGroup>
<IconButton id="save-sql" icon="fa fa-file-code" onClick={this.onSQLClick} title={gettext('Generate SQL')}
shortcut={this.state.preferences.generate_sql}/>
<IconButton id="save-image" icon="fa fa-file-image" onClick={this.onImageClick} title={gettext('Generate SQL')}
shortcut={this.state.preferences.generate_sql}/>
<IconButton id="save-image" icon="fa fa-file-image" onClick={this.onImageClick} title={gettext('Download image')}
shortcut={this.state.preferences.download_image}/>
</ButtonGroup>
<ButtonGroup>
<IconButton id="add-node" icon="fa fa-plus-square" onClick={this.onAddNewNode} title={gettext('Add table')}

View File

@ -37,7 +37,7 @@ describe('ERDCore', ()=>{
'registerListener': null,
}),
'repaintCanvas': null,
'zoomToFit': null,
'zoomToFitNodes': null,
'fireEvent': null,
});
@ -352,7 +352,7 @@ describe('ERDCore', ()=>{
it('zoomToFit', ()=>{
erdCoreObj.zoomToFit();
expect(erdEngine.zoomToFit).toHaveBeenCalled();
expect(erdEngine.zoomToFitNodes).toHaveBeenCalled();
});
it('fireAction', ()=>{