MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / showErdTool

Method showErdTool

web/pgadmin/tools/erd/static/js/ERDModule.js:90–158  ·  view source on GitHub ↗
(_data, treeIdentifier, gen=false, connectionInfo=null, toolDataId=null)

Source from the content-addressed store, hash-verified

88
89 // Callback to draw ERD Tool for objects
90 showErdTool(_data, treeIdentifier, gen=false, connectionInfo=null, toolDataId=null) {
91 let parentData = null;
92 let panelTitle = null;
93 if(connectionInfo){
94 panelTitle = connectionInfo.title;
95
96 parentData = {
97 server_group: {
98 _id: connectionInfo.sgid || 0
99 },
100 server: {
101 _id: connectionInfo.sid,
102 server_type: connectionInfo.server_type,
103 label: connectionInfo.server_name,
104 user: {
105 name: connectionInfo.user
106 }
107 },
108 database: {
109 _id: connectionInfo.did,
110 label: connectionInfo.db_name
111 },
112 schema: {
113 _id: connectionInfo.scid || null,
114
115 },
116 table: {
117 _id: connectionInfo.tid || null,
118 }
119 };
120
121 }else{
122 if (treeIdentifier === undefined) {
123 pgAdmin.Browser.notifier.alert(
124 gettext('ERD Error'),
125 gettext('No object selected.')
126 );
127 return;
128 }
129 parentData = this.pgBrowser.tree.getTreeNodeHierarchy(treeIdentifier);
130
131 if(_.isUndefined(parentData.database)) {
132 pgAdmin.Browser.notifier.alert(
133 gettext('ERD Error'),
134 gettext('Please select a database/database object.')
135 );
136 return;
137 }
138 panelTitle = getPanelTitle(this.pgBrowser, treeIdentifier);
139 }
140
141 const transId = getRandomInt(1, 9999999);
142 const panelUrl = this.getPanelUrl(transId, parentData, gen);
143 const open_new_tab = usePreferences.getState().getPreferencesForModule('browser').new_browser_tab_open;
144
145 // Extract bgcolor and fgcolor from server icon
146 const { bgcolor, fgcolor } = getServerColors(parentData?.server?.icon);
147

Callers 3

database.jsFile · 0.80
schema.jsFile · 0.80
table.jsFile · 0.80

Calls 9

getPanelUrlMethod · 0.95
getPanelTitleFunction · 0.90
getRandomIntFunction · 0.90
getServerColorsFunction · 0.90
gettextFunction · 0.85
alertMethod · 0.80
triggerMethod · 0.80
escapeMethod · 0.80
getTreeNodeHierarchyMethod · 0.45

Tested by

no test coverage detected