Skip to content

Commit 171ab26

Browse files
Fixed an issue where table node in ERD was not showing geometry details.
1 parent fed17a5 commit 171ab26

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.ui.js

+6
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,9 @@ export default class ColumnSchema extends BaseUISchema {
298298
geometry: null
299299
};
300300
}
301+
},
302+
visible: (state) => {
303+
return (state.cltype == 'geometry' || state.cltype == 'geography');
301304
}
302305
},{
303306
id:'srid', label: gettext('SRID'), deps: ['cltype'],
@@ -314,6 +317,9 @@ export default class ColumnSchema extends BaseUISchema {
314317
disabled: function(state) {
315318
return !(state.cltype == 'geometry' || state.cltype == 'geography');
316319
},
320+
visible: function(state) {
321+
return (state.cltype == 'geometry' || state.cltype == 'geography');
322+
}
317323
},{
318324
id: 'attlen', label: gettext('Length/Precision'),
319325
deps: ['cltype'], type: 'int', group: gettext('Definition'), width: 120, enableResizing: false,

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/utils.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,9 @@ def fetch_length_precision(data):
452452
if 'typname' in data and (data['typname'] in ('geometry', 'geography')):
453453
# If we have geometry column
454454
parmas = parse_params(data['cltype'])
455-
data['geometry'] = parmas[0]
456-
data['srid'] = parmas[1]
455+
if parmas:
456+
data['geometry'] = parmas[0]
457+
data['srid'] = parmas[1]
457458
else:
458459
parmas = parse_params(fulltype)
459460

web/pgadmin/tools/erd/static/js/erd_tool/nodes/TableNode.jsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,11 @@ export class TableNodeWidget extends React.Component {
309309

310310
let cltype = col.cltype;
311311
if(col.attlen) {
312-
cltype += '('+ col.attlen + (col.attprecision ? ',' + col.attprecision : '') +')';
312+
cltype += `(${col.attlen}${col.attprecision ? ','+col.attprecision :''})`;
313+
}
314+
315+
if(col.geometry) {
316+
cltype += `(${col.geometry}${col.srid ? ','+col.srid : ''})`;
313317
}
314318

315319
return (

0 commit comments

Comments
 (0)