Ensure that content on the DDL comparison panel should get refreshed on selecting the object using the up and down arrow keys. #5747

This commit is contained in:
Akshay Joshi 2023-02-14 17:14:42 +05:30
parent 5303a36ff4
commit d8c5bc4320
2 changed files with 44 additions and 31 deletions

View File

@ -33,7 +33,9 @@ Bug fixes
| `Issue #5269 <https://github.com/pgadmin-org/pgadmin4/issues/5269>`_ - Ensure that the schema diff tool should pick up the change in the column grants.
| `Issue #5685 <https://github.com/pgadmin-org/pgadmin4/issues/5685>`_ - Ensure that Grant column permission to a view is visible in the SQL tab.
| `Issue #5747 <https://github.com/pgadmin-org/pgadmin4/issues/5747>`_ - Ensure that content on the DDL comparison panel should get refreshed on selecting the object using the up and down arrow keys.
| `Issue #5756 <https://github.com/pgadmin-org/pgadmin4/issues/5756>`_ - Fix for query tool prompting for unsaved changes even if no changes have been made.
| `Issue #5758 <https://github.com/pgadmin-org/pgadmin4/issues/5758>`_ - Fixed an issue where lock layout menu was not in sync with preferences.
| `Issue #5764 <https://github.com/pgadmin-org/pgadmin4/issues/5764>`_ - Fix an issue where the maintenance dialog for Materialized View gives an error.
| `Issue #5773 <https://github.com/pgadmin-org/pgadmin4/issues/5773>`_ - Fixed an issue where Clear Saved Password should be disabled if the password is already cleared.
| `Issue #5847 <https://github.com/pgadmin-org/pgadmin4/issues/5847>`_ - Fixed an issue where pgAdmin failed to connect when the Postgres password included special characters.

View File

@ -661,38 +661,49 @@ export function ResultGridComponent({ gridData, allRowIds, filterParams, selecte
}, [filterParams]);
const eventBus = useContext(SchemaDiffEventsContext);
const rowSelectionTimeoutRef = useRef();
const rowSelection = (row) => {
if (row.ddlData != undefined && row.status != FILTER_NAME.IDENTICAL) {
eventBus.fireEvent(SCHEMA_DIFF_EVENT.TRIGGER_CHANGE_RESULT_SQL, row.ddlData);
} else if (row.status == FILTER_NAME.IDENTICAL) {
let url_params = {
'trans_id': transId,
'source_sid': sourceData.sid,
'source_did': sourceData.did,
'source_scid': row.source_scid,
'target_sid': targetData.sid,
'target_did': targetData.did,
'target_scid': row.target_scid,
'comp_status': row.status,
'source_oid': row.source_oid,
'target_oid': row.target_oid,
'node_type': row.itemType,
};
let baseUrl = url_for('schema_diff.ddl_compare', url_params);
schemaDiffToolContext.api.get(baseUrl).then((res) => {
row.ddlData = {
'SQLdiff': res.data.diff_ddl,
'sourceSQL': res.data.source_ddl,
'targetSQL': res.data.target_ddl
};
eventBus.fireEvent(SCHEMA_DIFF_EVENT.TRIGGER_CHANGE_RESULT_SQL, row.ddlData);
}).catch((err) => {
Notifier.alert(err.message);
});
const rowSelection = (rowIdx) => {
if (rowSelectionTimeoutRef.current) {
clearTimeout(rowSelectionTimeoutRef.current);
rowSelectionTimeoutRef.current = null;
}
rowSelectionTimeoutRef.current = setTimeout(()=> {
rowSelectionTimeoutRef.current = null;
const row = rows[rowIdx];
if (row.ddlData != undefined && row.status != FILTER_NAME.IDENTICAL) {
eventBus.fireEvent(SCHEMA_DIFF_EVENT.TRIGGER_CHANGE_RESULT_SQL, row.ddlData);
} else if (row.status == FILTER_NAME.IDENTICAL) {
let url_params = {
'trans_id': transId,
'source_sid': sourceData.sid,
'source_did': sourceData.did,
'source_scid': row.source_scid,
'target_sid': targetData.sid,
'target_did': targetData.did,
'target_scid': row.target_scid,
'comp_status': row.status,
'source_oid': row.source_oid,
'target_oid': row.target_oid,
'node_type': row.itemType,
};
let baseUrl = url_for('schema_diff.ddl_compare', url_params);
schemaDiffToolContext.api.get(baseUrl).then((res) => {
row.ddlData = {
'SQLdiff': res.data.diff_ddl,
'sourceSQL': res.data.source_ddl,
'targetSQL': res.data.target_ddl
};
eventBus.fireEvent(SCHEMA_DIFF_EVENT.TRIGGER_CHANGE_RESULT_SQL, row.ddlData);
}).catch((err) => {
Notifier.alert(err.message);
});
} else {
eventBus.fireEvent(SCHEMA_DIFF_EVENT.TRIGGER_CHANGE_RESULT_SQL, {});
}
}, 250);
};
function rowKeyGetter(row) {
@ -714,7 +725,7 @@ export function ResultGridComponent({ gridData, allRowIds, filterParams, selecte
}}
headerRowHeight={28}
rowHeight={28}
onRowClick={rowSelection}
onItemSelect={rowSelection}
enableCellSelect={false}
rowKeyGetter={rowKeyGetter}
direction={'vertical-lr'}