in gui/frontend/src/modules/db-editor/DocumentSideBar/DocumentSideBar.tsx [550:866]
private renderConnectionTreeContextMenus(): ComponentChild {
const optionalMenuItems: ComponentChild[] = [];
if (webSession.runMode !== RunMode.SingleServer) {
optionalMenuItems.push(
<MenuItem command={{ title: "Edit DB Connection", command: "msg.editConnection" }} />,
<MenuItem command={{ title: "Duplicate this DB Connection", command: "msg.duplicateConnection" }} />,
<MenuItem command={{ title: "Delete DB Connection...", command: "msg.removeConnection" }} />,
<MenuItem command={{ title: "-", command: "" }} disabled />,
<MenuItem
id="showSystemSchemas"
command={{
title: "Show MySQL System Schemas", command: "msg.showSystemSchemasOnConnection",
}}
altCommand={{
title: "Hide MySQL System Schemas", command: "msg.hideSystemSchemasOnConnection",
}}
/>,
<MenuItem command={{ title: "-", command: "" }} disabled />,
<MenuItem command={{ title: "Load SQL Script from Disk...", command: "msg.loadScriptFromDisk" }} />,
<MenuItem command={{ title: "Load Dump from Disk...", command: "msg.loadDumpFromDisk" }} disabled />,
<MenuItem command={{ title: "-", command: "" }} disabled />,
<MenuItem
command={{
title: "Open New MySQL Shell Console for this Connection",
command: "msg.newSessionUsingConnection",
}} />,
<MenuItem command={{ title: "-", command: "" }} disabled />,
);
}
return (
<>
<Menu
id="connectionContextMenu"
ref={this.cdmTypeToMenuRefMap.get(CdmEntityType.Connection)}
placement={ComponentPlacement.BottomLeft}
onItemClick={this.handleConnectionTreeContextMenuItemClick}
isItemDisabled={this.isConnectionMenuItemDisabled}
>
<MenuItem command={{ title: "Open New Database Connection", command: "msg.openConnection" }} />
<MenuItem command={{ title: "-", command: "" }} disabled />
{optionalMenuItems}
<MenuItem
command={{ title: "Browse the MySQL REST Service Documentation", command: "msg.mrs.docs" }}
/>
<MenuItem
command={{
title: "Configure Instance for MySQL REST Service Support",
command: "msg.mrs.configureMySQLRestService",
}}
/>
</Menu>
<Menu
id="schemaContextMenu"
ref={this.cdmTypeToMenuRefMap.get(CdmEntityType.Schema)}
placement={ComponentPlacement.BottomLeft}
onItemClick={this.handleConnectionTreeContextMenuItemClick}
>
<MenuItem
command={{ title: "Set As Current Database Schema", command: "setCurrentSchemaMenuItem" }}
/>
<MenuItem command={{ title: "Filter to this Schema", command: "filterMenuItem" }} disabled />
<MenuItem command={{ title: "Show Schema Inspector", command: "inspectorMenuItem" }} disabled />
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem command={{ title: "Dump Schema To Disk..", command: "msg.dumpSchemaToDisk" }} disabled />
<MenuItem
command={{
title: "Dump Schema to Disk for MySQL Database Service...",
command: "msg.dumpSchemaToDiskForMds",
}}
disabled
/>
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem command={{ title: "Copy to Clipboard", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToClipboard" }} />
<MenuItem
command={{ title: "Create Statement", command: "msg.copyCreateStatementToClipboard" }}
/>
</MenuItem>
<MenuItem command={{ title: "Send to SQL Editor", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToEditor" }} />
<MenuItem command={{ title: "Create Statement", command: "msg.copyCreateStatementToEditor" }} />
</MenuItem >
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem
command={{ title: "Load Data to HeatWave Cluster...", command: "msg.mds.loadToHeatWave" }}
disabled />
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem command={{ title: "Add Schema to REST Service...", command: "msg.mrs.addSchema" }} />
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem command={{ title: "Create Schema...", command: "msg.createSchema" }} disabled />
<MenuItem command={{ title: "Alter Schema...", command: "msg.alterSchema" }} disabled />
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem command={{ title: "Drop Schema...", command: "msg.dropSchema" }} disabled />
</Menu >
<Menu
id="tableContextMenu"
ref={this.cdmTypeToMenuRefMap.get(CdmEntityType.Table)}
placement={ComponentPlacement.BottomLeft}
onItemClick={this.handleConnectionTreeContextMenuItemClick}
>
<MenuItem command={{ title: "Select Rows", command: "msg.selectRows" }} />
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem command={{ title: "Copy to Clipboard", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToClipboard" }} />
<MenuItem
command={{ title: "Create Statement", command: "msg.copyCreateStatementToClipboard" }}
/>
</MenuItem>
<MenuItem command={{ title: "Send to SQL Editor", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToEditor" }} />
<MenuItem command={{ title: "Create Statement", command: "msg.copyCreateStatementToEditor" }} />
</MenuItem >
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem
command={{ title: "Add Database Object to REST Service...", command: "msg.mrs.addDbObject" }}
/>
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem command={{ title: "Create Table...", command: "msg.createTable" }} disabled />
<MenuItem command={{ title: "Alter Table...", command: "msg.alterTable" }} disabled />
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem command={{ title: "Drop Table...", command: "msg.dropTable" }} disabled />
<MenuItem command={{ title: "Truncate Table...", command: "msg.truncateTable" }} disabled />
</Menu >
<Menu
id="columnContextMenu"
ref={this.cdmTypeToMenuRefMap.get(CdmEntityType.Column)}
placement={ComponentPlacement.BottomLeft}
onItemClick={this.handleConnectionTreeContextMenuItemClick}
>
<MenuItem command={{ title: "Select Rows", command: "msg.selectRows" }} />
<MenuItem command={{ title: "Copy to Clipboard", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToClipboard" }} />
<MenuItem
command={{ title: "Insert Statement", command: "clipboardInsertStatementMenuItem" }}
disabled
/>
<MenuItem
command={{ title: "Update Statement", command: "clipboardUpdateStatementMenuItem" }}
disabled
/>
</MenuItem>
<MenuItem command={{ title: "Send to SQL Editor", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToEditor" }} disabled />
<MenuItem
command={{ title: "Insert Statement", command: "editorInsertStatementMenuItem" }}
disabled
/>
<MenuItem
command={{ title: "Update Statement", command: "editorUpdateStatementMenuItem" }}
disabled
/>
</MenuItem >
</Menu >
<Menu
id="viewContextMenu"
ref={this.cdmTypeToMenuRefMap.get(CdmEntityType.View)}
placement={ComponentPlacement.BottomLeft}
onItemClick={this.handleConnectionTreeContextMenuItemClick}
>
<MenuItem command={{ title: "Select Rows", command: "msg.selectRows" }} />
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem command={{ title: "Copy to Clipboard", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToClipboard" }} />
<MenuItem
command={{ title: "Create Statement", command: "msg.copyCreateStatementToClipboard" }}
/>
</MenuItem>
<MenuItem command={{ title: "Send to SQL Editor", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToEditor" }} />
<MenuItem command={{ title: "Create Statement", command: "msg.copyCreateStatementToEditor" }} />
</MenuItem >
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem
command={{ title: "Add Database Object to REST Service...", command: "msg.mrs.addDbObject" }}
/>
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem command={{ title: "Create View ...", command: "msg.createProcedure" }} disabled />
<MenuItem command={{ title: "Alter View ...", command: "alterViewMenuItem" }} disabled />
<MenuItem command={{ title: "Drop View ...", command: "dropViewMenuItem" }} disabled />
</Menu >
<Menu
id="eventContextMenu"
ref={this.cdmTypeToMenuRefMap.get(CdmEntityType.Event)}
placement={ComponentPlacement.BottomLeft}
onItemClick={this.handleConnectionTreeContextMenuItemClick}
>
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem command={{ title: "Copy to Clipboard", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToClipboard" }} />
<MenuItem
command={{ title: "Create Statement", command: "msg.copyCreateStatementToClipboard" }}
/>
</MenuItem>
<MenuItem command={{ title: "Send to SQL Editor", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToEditor" }} />
<MenuItem command={{ title: "Create Statement", command: "msg.copyCreateStatementToEditor" }} />
</MenuItem >
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem command={{ title: "Create Event ...", command: "msg.createEvent" }} disabled />
<MenuItem command={{ title: "Alter Event ...", command: "msg.alterEvent" }} disabled />
<MenuItem command={{ title: "Drop Event ...", command: "msg.dropEvent" }} disabled />
</Menu >
<Menu
id="procedureContextMenu"
ref={this.cdmTypeToMenuRefMap.get(CdmEntityType.StoredProcedure)}
placement={ComponentPlacement.BottomLeft}
onItemClick={this.handleConnectionTreeContextMenuItemClick}
>
<MenuItem command={{ title: "Copy to Clipboard", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToClipboard" }} disabled />
<MenuItem
command={{ title: "Create Statement", command: "msg.copyCreateStatementToClipboard" }}
/>
</MenuItem>
<MenuItem command={{ title: "Send to SQL Editor", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToEditor" }} />
<MenuItem command={{ title: "Create Statement", command: "msg.copyCreateStatementToEditor" }} />
</MenuItem >
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem
command={{ title: "Add Database Object to REST Service...", command: "msg.mrs.addDbObject" }}
/>
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem command={{ title: "Create Procedure ...", command: "msg.createProcedure" }} disabled />
<MenuItem command={{ title: "Alter Procedure ...", command: "alterViewMenuItem" }} disabled />
<MenuItem command={{ title: "Drop Procedure ...", command: "dropViewMenuItem" }} disabled />
</Menu >
<Menu
id="functionContextMenu"
ref={this.cdmTypeToMenuRefMap.get(CdmEntityType.StoredFunction)}
placement={ComponentPlacement.BottomLeft}
onItemClick={this.handleConnectionTreeContextMenuItemClick}
>
<MenuItem command={{ title: "Copy to Clipboard", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToClipboard" }} disabled />
<MenuItem
command={{ title: "Create Statement", command: "msg.copyCreateStatementToClipboard" }}
/>
</MenuItem>
<MenuItem command={{ title: "Send to SQL Editor", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToEditor" }} />
<MenuItem command={{ title: "Create Statement", command: "msg.copyCreateStatementToEditor" }} />
</MenuItem >
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem
command={{ title: "Add Database Object to REST Service...", command: "msg.mrs.addDbObject" }}
/>
<MenuItem command={{ title: "-", command: "" }} disabled />
<MenuItem command={{ title: "Create Function ...", command: "msg.createFunction" }} disabled />
<MenuItem command={{ title: "Alter Function ...", command: "msg.alterFunction" }} disabled />
<MenuItem command={{ title: "Drop Function ...", command: "msg.dropFunction" }} disabled />
</Menu >
<Menu
id="indexContextMenu"
ref={this.cdmTypeToMenuRefMap.get(CdmEntityType.Index)}
placement={ComponentPlacement.BottomLeft}
onItemClick={this.handleConnectionTreeContextMenuItemClick}
>
<MenuItem command={{ title: "Copy to Clipboard", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToClipboard" }} />
<MenuItem
command={{ title: "Create Statement", command: "msg.copyCreateStatementToClipboard" }}
/>
</MenuItem>
<MenuItem command={{ title: "Send to SQL Editor", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToEditor" }} />
<MenuItem command={{ title: "Create Statement", command: "msg.copyCreateStatementToEditor" }} />
</MenuItem >
</Menu >
<Menu
id="triggerContextMenu"
ref={this.cdmTypeToMenuRefMap.get(CdmEntityType.Trigger)}
placement={ComponentPlacement.BottomLeft}
onItemClick={this.handleConnectionTreeContextMenuItemClick}
>
<MenuItem command={{ title: "Copy to Clipboard", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToClipboard" }} />
<MenuItem
command={{ title: "Create Statement", command: "msg.copyCreateStatementToClipboard" }}
/>
</MenuItem>
<MenuItem command={{ title: "Send to SQL Editor", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToEditor" }} />
<MenuItem command={{ title: "Create Statement", command: "msg.copyCreateStatementToEditor" }} />
</MenuItem >
</Menu>
<Menu
id="fkContextMenu"
ref={this.cdmTypeToMenuRefMap.get(CdmEntityType.ForeignKey)}
placement={ComponentPlacement.BottomLeft}
onItemClick={this.handleConnectionTreeContextMenuItemClick}
>
<MenuItem command={{ title: "Copy to Clipboard", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToClipboard" }} />
<MenuItem
command={{ title: "Create Statement", command: "msg.copyCreateStatementToClipboard" }}
/>
</MenuItem>
<MenuItem command={{ title: "Send to SQL Editor", command: "" }} >
<MenuItem command={{ title: "Name", command: "msg.copyNameToEditor" }} />
<MenuItem command={{ title: "Create Statement", command: "msg.copyCreateStatementToEditor" }} />
</MenuItem >
</Menu>
</>
);
}