File tree Expand file tree Collapse file tree 4 files changed +16
-8
lines changed
server_groups/servers/databases/schemas/tables/columns/static/js
components/PgTree/FileTreeItem Expand file tree Collapse file tree 4 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -42,14 +42,13 @@ define('pgadmin.node.column', [
4242 sqlAlterHelp : 'sql-altertable.html' ,
4343 sqlCreateHelp : 'sql-altertable.html' ,
4444 dialogHelp : url_for ( 'help.static' , { 'filename' : 'column_dialog.html' } ) ,
45- // Overriding getNodeLabel to add datatype besides column name
46- getNodeLabel : function ( data ) {
45+ // Overriding getNodeInfoLabel to add datatype alongside column name
46+ getNodeInfoLabel : function ( data ) {
4747 let show_column_datatype = usePreferences . getState ( ) . getPreferences ( 'browser' , 'show_column_datatype' ) ;
48- let label = data . label ;
4948 if ( show_column_datatype ?. value && data . datatype && data . displaytypname ) {
50- label += ` ${ data . displaytypname } ` ;
49+ return data . displaytypname ;
5150 }
52- return label ;
51+ return null ;
5352 } ,
5453 canDrop : function ( itemData , item ) {
5554 let node = pgBrowser . tree . findNodeByDomElement ( item ) ;
Original file line number Diff line number Diff line change @@ -99,8 +99,13 @@ define('pgadmin.browser.node', [
9999 // during the copying process of any node.
100100 return d ;
101101 } ,
102- getNodeLabel : function ( data ) {
103- return data . label ;
102+ getNodeInfoLabel : function ( data ) {
103+ // Adds an extra informational label appended to the node label.
104+ // Override this function to return a string to display, or null for no extra label.
105+ if ( data . info_label )
106+ return data . info_label ;
107+ else
108+ return null ;
104109 } ,
105110 hasId : true ,
106111 ///////
Original file line number Diff line number Diff line change @@ -112,6 +112,9 @@ export class FileTreeItem extends React.Component<IItemRendererXProps & IItemRen
112112 < span className = 'file-name' >
113113 { _ . unescape ( this . props . item . getMetadata ( 'data' ) . _label ) }
114114 </ span >
115+ < span className = "text-muted" style = { { fontSize : '0.9em' , whiteSpace : 'nowrap' } } >
116+ { _ . unescape ( this . props . item . getMetadata ( 'data' ) . info_label ) }
117+ </ span >
115118 < span className = 'children-count' > { itemChildren } </ span >
116119 { tags . map ( ( tag ) => (
117120 < div key = { tag . text } className = 'file-tag' style = { { '--tag-color' : tag . color } as React . CSSProperties } >
Original file line number Diff line number Diff line change @@ -59,8 +59,9 @@ export class ManageTreeNodes {
5959
6060 public addNode = ( _parent : string , _path : string , _data : [ ] ) => new Promise ( ( res ) => {
6161 _data . type = _data . inode ? FileType . Directory : FileType . File ;
62+ _data . _label = _data . label ;
6263
63- _data . _label = pgAdmin . Browser . Nodes [ _data . _type ] ?. getNodeLabel ( _data ) ;
64+ _data . info_label = pgAdmin . Browser . Nodes [ _data . _type ] ?. getNodeInfoLabel ( _data ) ;
6465
6566 _data . label = _ . escape ( _data . label ) ;
6667
You can’t perform that action at this time.
0 commit comments