}
@@ -323,6 +328,16 @@ export function MainToolBar({preferences, eventBus, fillColor, textColor}) {
>
{gettext('With DROP Table')}
+
+ {gettext('Crow\'s Foot Notation')}
+ {gettext('Chen Notation')}
+
>
);
}
@@ -332,6 +347,8 @@ MainToolBar.propTypes = {
eventBus: PropTypes.object,
fillColor: PropTypes.string,
textColor: PropTypes.string,
+ notation: PropTypes.string,
+ onNotationChange: PropTypes.func,
};
const ColorButton = withColorPicker(PgIconButton);
diff --git a/web/pgadmin/tools/erd/static/js/erd_tool/links/OneToManyLink.jsx b/web/pgadmin/tools/erd/static/js/erd_tool/links/OneToManyLink.jsx
index 50c1bfea0..bb9e307e8 100644
--- a/web/pgadmin/tools/erd/static/js/erd_tool/links/OneToManyLink.jsx
+++ b/web/pgadmin/tools/erd/static/js/erd_tool/links/OneToManyLink.jsx
@@ -7,7 +7,7 @@
//
//////////////////////////////////////////////////////////////
-import React, { forwardRef } from 'react';
+import React, { forwardRef, useContext } from 'react';
import {
RightAngleLinkModel,
RightAngleLinkWidget,
@@ -21,6 +21,7 @@ import _ from 'lodash';
import PropTypes from 'prop-types';
import { makeStyles } from '@material-ui/core';
import clsx from 'clsx';
+import { ERDCanvasSettings } from '../components/ERDTool';
export const POINTER_SIZE = 30;
@@ -81,6 +82,7 @@ export class OneToManyLinkModel extends RightAngleLinkModel {
const useStyles = makeStyles((theme)=>({
svgLink: {
stroke: theme.palette.text.primary,
+ fontSize: '0.8em',
},
'@keyframes svgLinkSelected': {
'from': { strokeDashoffset: 24},
@@ -99,15 +101,37 @@ const useStyles = makeStyles((theme)=>({
}
}));
-const CustomLinkEndWidget = props => {
+function ChenNotation({rotation, type}) {
+ const classes = useStyles();
+ const textX = Math.sign(rotation) > 0 ? -14 : 8;
+ const textY = -5;
+ return (
+ <>
+
+ {type == 'one' ? '1' : 'N'}
+
+
+ >
+ );
+}
+ChenNotation.propTypes = {
+ rotation: PropTypes.number,
+ type: PropTypes.string,
+};
+
+function CustomLinkEndWidget(props) {
const { point, rotation, tx, ty, type } = props;
const classes = useStyles();
+ const settings = useContext(ERDCanvasSettings);
const svgForType = (itype) => {
+ if(settings.cardinality_notation == 'chen') {
+ return ;
+ }
if(itype == 'many') {
return (
<>
-
+
>
);
@@ -127,7 +151,7 @@ const CustomLinkEndWidget = props => {
);
-};
+}
CustomLinkEndWidget.propTypes = {
point: PropTypes.instanceOf(PointModel).isRequired,
diff --git a/web/pgadmin/tools/erd/static/js/erd_tool/nodes/TableNode.jsx b/web/pgadmin/tools/erd/static/js/erd_tool/nodes/TableNode.jsx
index cc7751240..3e37393d7 100644
--- a/web/pgadmin/tools/erd/static/js/erd_tool/nodes/TableNode.jsx
+++ b/web/pgadmin/tools/erd/static/js/erd_tool/nodes/TableNode.jsx
@@ -202,6 +202,17 @@ const styles = (theme)=>({
padding: '0.125rem 0.25rem',
display: 'flex',
},
+ columnSection: {
+ display:'flex',
+ width: '100%' ,
+ ...theme.mixins.panelBorder.bottom,
+ },
+ columnName: {
+ display:'flex',
+ width: '100%' ,
+ padding: '0.125rem 0.25rem',
+ wordBreak: 'break-all',
+ },
tableToolbar: {
background: theme.otherVars.editorToolbarBg,
borderTopLeftRadius: 'inherit',
@@ -269,11 +280,11 @@ class TableNodeWidgetRaw extends React.Component {
const {classes} = this.props;
return (
-
+
{this.generatePort(leftPort)}
-
+
{col.name}
@@ -284,7 +295,7 @@ class TableNodeWidgetRaw extends React.Component {
{this.generatePort(rightPort)}
-
+
);
}
diff --git a/web/regression/javascript/erd/erd_core_spec.js b/web/regression/javascript/erd/erd_core_spec.js
index 7a0d6f2ab..faed0e85e 100644
--- a/web/regression/javascript/erd/erd_core_spec.js
+++ b/web/regression/javascript/erd/erd_core_spec.js
@@ -291,13 +291,6 @@ describe('ERDCore', ()=>{
]));
});
- it('dagreDistributeNodes', ()=>{
- spyOn(erdCoreObj.dagre_engine, 'redistribute');
- erdCoreObj.dagreDistributeNodes();
- expect(erdEngine.getLinkFactories().getFactory().calculateRoutingMatrix).toHaveBeenCalled();
- expect(erdCoreObj.dagre_engine.redistribute).toHaveBeenCalledWith(erdEngine.getModel());
- });
-
it('zoomIn', ()=>{
spyOn(erdEngine.getModel(), 'getZoomLevel').and.returnValue(100);
spyOn(erdCoreObj, 'repaint');