Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
Merge branch 'dev' of github.com:erxes/erxes into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
munkhsaikhan committed Oct 11, 2023
2 parents ccd6eae + 3c76fdd commit a47e543
Show file tree
Hide file tree
Showing 39 changed files with 1,225 additions and 231 deletions.
10 changes: 7 additions & 3 deletions cypress/tests/contacts/ui/company.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { CLIENT_RENEG_LIMIT } = require("tls");

describe("Contacts", () => {
beforeEach(() => {
cy.exec('yarn run cypress:seedDB').wait(300);
Cypress.Cookies.debug(true);
cy.visit('/');
cy.clearCookies();
Expand All @@ -14,6 +15,9 @@ describe("Contacts", () => {
const random = Math.random().toString(36).slice(2)

it("add company", () => {
const seed = cy.exec('yarn run cypress:seedDB').wait(300);

console.log(seed);

cy.get('i[icon = "plus-circle"]', { timeout: 300000 }).click();

Expand All @@ -31,7 +35,7 @@ describe("Contacts", () => {
.click();
})

it("set tag company", () => {
it.skip("set tag company", () => {

cy.get("#companiesCheckBox",{ timeout: 300000 }).eq(0).click();

Expand All @@ -46,7 +50,7 @@ describe("Contacts", () => {
cy.get('button[icon="tag-alt"]').click();
})

it("remove company", () => {
it.skip("remove company", () => {

cy.contains(random, { timeout: 300000 })
.parent()
Expand Down
29 changes: 3 additions & 26 deletions cypress/tests/contacts/ui/lead.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("Lead", () => {
.visit("/contacts/lead").wait(300);
});

it("add1", () => {
it("add", () => {

const random = Math.random().toString(36).slice(2)

Expand All @@ -34,30 +34,7 @@ describe("Lead", () => {
}
})

it("add2", () => {

const random2 = Math.random().toString(36).slice(2)

cy.get('button[icon="plus-circle"]',{timeout:300000}).click();

cy.get('input[name="firstName"]').type(random2);

cy.get("div .Select-placeholder")
.contains("Enter an email")
.click()
.type(random2 + "@nmma.co");
cy.waitAndClick("div.Select-menu-outer");

cy.get('button[type="submit"]')
.eq(0)
.click();
if(cy.get('button[type="submit"]')){
cy.get('button[class="close"]')
.click()
}
})

it("tag", () => {
it.skip("tag", () => {

cy.get("#customers>.crow",{timeout: 300000})
.eq(0)
Expand All @@ -80,7 +57,7 @@ describe("Lead", () => {
}
})

it("merge", () => {
it.skip("merge", () => {

cy.get("#customers>.crow",{timeout: 300000})
.eq(0)
Expand Down
42 changes: 22 additions & 20 deletions packages/api-utils/src/messageBroker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,31 +126,33 @@ function splitPluginProcedureName(queueName: string) {
return { pluginName, procedureName };
}

export const createConsumeRPCQueue = (app: Express) => (
export const createConsumeRPCQueue = (app?: Express) => (
queueName,
procedure
) => {
const { procedureName } = splitPluginProcedureName(queueName);
if (app) {
const { procedureName } = splitPluginProcedureName(queueName);

if (procedureName.includes(':')) {
throw new Error(
`${procedureName}. RPC procedure name cannot contain : character. Use dot . instead.`
);
}

const endpoint = `/rpc/${procedureName}`;

app.post(endpoint, async (req, res) => {
try {
const response = await procedure(req.body);
res.json(response);
} catch (e) {
res.json({
status: 'error',
errorMessage: e.message
});
if (procedureName.includes(':')) {
throw new Error(
`${procedureName}. RPC procedure name cannot contain : character. Use dot . instead.`
);
}
});

const endpoint = `/rpc/${procedureName}`;

app.post(endpoint, async (req, res) => {
try {
const response = await procedure(req.body);
res.json(response);
} catch (e) {
res.json({
status: 'error',
errorMessage: e.message
});
}
});
}

consumeRPCQueueMq(queueName, procedure);
};
Expand Down
7 changes: 6 additions & 1 deletion packages/erxes-ui/src/components/DropdownToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
type Props = {
children: React.ReactNode;
onClick?: (e: React.FormEvent) => void;
id?: string;
};

class DropdownToggle extends React.Component<Props> {
Expand All @@ -18,7 +19,11 @@ class DropdownToggle extends React.Component<Props> {
};

render() {
return <div onClick={this.handleClick}>{this.props.children}</div>;
return (
<div onClick={this.handleClick} id={this.props.id && this.props.id}>
{this.props.children}
</div>
);
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/erxes-ui/src/components/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Props = {
style?: any;
color?: string;
isActive?: boolean;
id?: string;
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
};

Expand Down
10 changes: 9 additions & 1 deletion packages/erxes-ui/src/components/ModalTrigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ class ModalTrigger extends React.Component<Props, State> {
})
: null;

const onHideHandler = () => {
this.closeModal();

if (onExit) {
onExit();
}
};

return (
<>
{triggerComponent}
Expand All @@ -113,7 +121,7 @@ class ModalTrigger extends React.Component<Props, State> {
dialogClassName={dialogClassName}
size={size}
show={isOpen}
onHide={this.closeModal}
onHide={onHideHandler}
backdrop={backDrop}
enforceFocus={enforceFocus}
onExit={onExit}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class FilterableList extends React.Component<Props, State> {
}

renderItem(item: any, hasChildren: boolean) {
const { showCheckmark = true } = this.props;
const { showCheckmark = true, treeView } = this.props;
const { key } = this.state;

if (key && item.title.toLowerCase().indexOf(key.toLowerCase()) < 0) {
Expand All @@ -153,14 +153,17 @@ class FilterableList extends React.Component<Props, State> {
return (
<FlexRow key={item._id}>
<li
className={showCheckmark ? item.selectedBy : ''}
className={`${showCheckmark ? item.selectedBy : ''} ${
!treeView ? item.itemClassName : !hasChildren && item.itemClassName
} ${item.itemActiveClass}`}
style={item.style}
onClick={!hasChildren ? onClick : undefined}
tabIndex={1}
>
{this.renderIcons(item, hasChildren, isOpen)}

<i
className={item.iconClass}
className={`${item.iconClass} ${treeView && item.itemClassName}`}
style={{ color: item.iconColor }}
onClick={hasChildren ? onClick : undefined}
/>
Expand Down
10 changes: 10 additions & 0 deletions packages/erxes-ui/src/components/filterableList/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ const FlexRow = styled.div`
> li {
flex: 1;
display: flex !important;
&.active {
color: rgb(55, 55, 55);
background: rgb(240, 240, 240);
outline: 0px;
}
&:focus {
outline: none;
}
}
`;

Expand Down
14 changes: 8 additions & 6 deletions packages/erxes-ui/src/components/subMenu/MenuItem.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React from 'react';
import { NavLink } from 'react-router-dom';
import styled from 'styled-components';
import React from 'react';
import { colors } from '../../styles';
import { rgba } from '../../styles/ecolor';
import styled from 'styled-components';
import styledTS from 'styled-components-ts';

const Item = styled.li`
const Item = styledTS<{ isLast?: boolean }>(styled.li)`
display: inline-block;
color: ${rgba(colors.colorCoreDarkGray, 0.9)};
text-transform: capitalize;
padding-right: 40px;
padding-right: ${props => (props.isLast ? '10px' : '40px')};
> a {
text-decoration: none;
Expand Down Expand Up @@ -37,13 +38,14 @@ type Props = {
children: React.ReactNode;
to: string;
title?: string;
isLast?: boolean;
};

function MenuItem({ to, title, children, ...props }: Props) {
function MenuItem({ to, title, children, isLast, ...props }: Props) {
const linkProps = { to, title };

return (
<Item>
<Item isLast={isLast}>
<NavLink {...props} {...linkProps} exact={true}>
{children}
</NavLink>
Expand Down
21 changes: 12 additions & 9 deletions packages/erxes-ui/src/components/subMenu/Submenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ function Submenu({
items?: IBreadCrumbItem[];
additionalMenuItem?: React.ReactNode;
}) {

const getLink = (url) => {
const getLink = url => {
const storageValue = window.localStorage.getItem('pagination:perPage');

let parsedStorageValue;
Expand All @@ -39,25 +38,29 @@ function Submenu({
if (url.includes('?')) {
const pathname = url.split('?')[0];

if(!url.includes('perPage') && parsedStorageValue[pathname]){
return `${url}&perPage=${parsedStorageValue[pathname]}`;
}
if (!url.includes('perPage') && parsedStorageValue[pathname]) {
return `${url}&perPage=${parsedStorageValue[pathname]}`;
}

return url;
}
}

if (parsedStorageValue[url]) {
return `${url}?perPage=${parsedStorageValue[url]}`;
}

return url;
}
};

if (items) {
return (
<Items>
{items.map(b => (
<MenuItem to={getLink(b.link) || ''} key={b.title}>
{items.map((b, i) => (
<MenuItem
to={getLink(b.link) || ''}
key={b.title}
isLast={items.length === i + 1}
>
{__(b.title)}
</MenuItem>
))}
Expand Down
Loading

0 comments on commit a47e543

Please sign in to comment.