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' into vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
soyombo-baterdene committed Nov 2, 2023
2 parents 3068c22 + 6fb1b3a commit d0389a2
Show file tree
Hide file tree
Showing 223 changed files with 7,301 additions and 4,487 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/plugin-chats-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- dev
- staging
- build-test
- exm-improve
paths:
- 'packages/api-utils/**'
- 'packages/api-plugin-template.erxes/**'
Expand All @@ -17,7 +16,6 @@ on:
- dev
- staging
- build-test
- exm-improve
paths:
- 'packages/api-utils/**'
- 'packages/api-plugin-template.erxes/**'
Expand Down Expand Up @@ -60,9 +58,9 @@ jobs:
cd dist/main/.erxes/src
- name: Build docker image
if: github.event_name == 'push' && ( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/exm-improve' )
if: github.event_name == 'push' && ( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/build-test' )
run: |
cd dist/plugin-chats-api/.erxes
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
docker build -t erxes/plugin-chats-api:dev -f Dockerfile .
docker push erxes/plugin-chats-api:dev
docker build -t erxes/plugin-chats-api:${GITHUB_REF#refs/heads/} -f Dockerfile .
docker push erxes/plugin-chats-api:${GITHUB_REF#refs/heads/}
4 changes: 2 additions & 2 deletions .github/workflows/plugin-timeclock-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ jobs:
run: |
cd dist/plugin-timeclock-api/.erxes
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
docker build -t erxes/plugin-timeclock-api:community -f Dockerfile .
docker push erxes/plugin-timeclock-api:community
docker build -t erxes/plugin-timeclock-api:${GITHUB_REF#refs/heads/} -f Dockerfile .
docker push erxes/plugin-timeclock-api:${GITHUB_REF#refs/heads/}
2 changes: 1 addition & 1 deletion .github/workflows/plugin-timeclock-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ jobs:
tar -cf build.tar --directory=packages/plugin-timeclock-ui/.erxes/dist .
cp build.tar packages/plugin-timeclock-ui/.erxes/dist
rm -rf packages/plugin-timeclock-ui/.erxes/dist/*.js
aws s3 sync packages/plugin-timeclock-ui/.erxes/dist s3://erxes-community-plugins/uis/plugin-timeclock-ui --delete
aws s3 sync packages/plugin-timeclock-ui/.erxes/dist s3://erxes-${GITHUB_REF#refs/heads/}-plugins/uis/plugin-timeclock-ui --delete
2 changes: 0 additions & 2 deletions exm-web/modules/chat/hooks/useChatMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ export const useChatMessages = (): IUseChats => {

newData.list = [chatMessageAdd, ...newData.list]

console.log(chatMessageAdd)

return { chatMessages: newData }
})
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion packages/api-plugin-template.erxes/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ async function startServer() {
exporter,
documentPrintHook,
readFileHook,
payment
payment,
reports
} = configs.meta;

const { consumeRPCQueue, consumeQueue } = messageBrokerClient;
Expand Down Expand Up @@ -568,6 +569,18 @@ async function startServer() {
}
}

if (reports) {
if (reports.getChartResult) {
consumeRPCQueue(
`${configs.name}:reports.getChartResult`,
async args => ({
status: 'success',
data: await reports.getChartResult(args)
})
);
}
}

if (initialSetup) {
if (initialSetup.generate) {
initialSetup.generateAvailable = true;
Expand Down Expand Up @@ -704,3 +717,5 @@ async function startServer() {
}

startServer();

// conflict test
95 changes: 87 additions & 8 deletions packages/api-utils/src/automations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,26 +145,71 @@ export const OPERATORS = {
ALL: ['set', 'concat', 'add', 'subtract', 'multiply', 'divide', 'percent']
};

const convertOp1 = (relatedItem, field) => {
if (
['customFieldsData', 'trackedData'].some(complexField =>
field.includes(complexField)
)
) {
const [complexFieldKey, nestedComplexFieldKey] = field.split('.');
return (relatedItem[complexFieldKey] || []).find(
nestedObj => nestedObj.field === nestedComplexFieldKey
)?.value;
}

return relatedItem[field];
};

const getPerValue = async (args: {
models;
subdomain;
relatedItem;
rule;
target;
getRelatedValue;
triggerType?;
serviceName?;
sendCommonMessage;
}) => {
const {
models,
subdomain,
relatedItem,
rule,
target,
getRelatedValue
getRelatedValue,
serviceName,
triggerType,
sendCommonMessage
} = args;
const { field, operator, value } = rule;
const op1Type = typeof relatedItem[field];
let { field, operator, value } = rule;

const op1Type = typeof convertOp1(relatedItem, field);

// replace placeholder if value has attributes from related service
if (
value.match(/\{\{\s*([^}]+)\s*\}\}/g) &&
!(triggerType || '').includes(serviceName)
) {
const [relatedServiceName] = triggerType.split(':');

value =
(
await sendCommonMessage({
serviceName: relatedServiceName,
subdomain,
action: 'automations.replacePlaceHolders',
data: {
target,
config: { value }
},
isRPC: true,
defaultValue: {}
})
)?.value || value;
}

let op1 = relatedItem[field];
let op1 = convertOp1(relatedItem, field);

let updatedValue = (
await replacePlaceHolders({
Expand Down Expand Up @@ -252,7 +297,18 @@ export const setProperty = async ({
execution,
getRelatedValue,
relatedItems,
sendCommonMessage
sendCommonMessage,
triggerType
}: {
models;
subdomain;
module;
rules;
execution;
getRelatedValue;
relatedItems;
sendCommonMessage;
triggerType?;
}) => {
const { target } = execution;
const [serviceName, collectionType] = module.split(':');
Expand All @@ -262,6 +318,7 @@ export const setProperty = async ({
for (const relatedItem of relatedItems) {
const setDoc = {};
const pushDoc = {};
const selectorDoc = {};
const servicesToForward: string[] = [];

for (const rule of rules) {
Expand All @@ -271,7 +328,10 @@ export const setProperty = async ({
relatedItem,
rule,
target,
getRelatedValue
getRelatedValue,
triggerType,
serviceName,
sendCommonMessage
});

if (rule.forwardTo) {
Expand All @@ -290,7 +350,7 @@ export const setProperty = async ({
if (rule.field.includes(complexFieldKey)) {
const fieldId = rule.field.replace(`${complexFieldKey}.`, '');

pushDoc[complexFieldKey] = await sendCommonMessage({
const complexFieldData = await sendCommonMessage({
subdomain,
serviceName: 'forms',
action: 'fields.generateTypedItem',
Expand All @@ -300,6 +360,25 @@ export const setProperty = async ({
},
isRPC: true
});

if (
(relatedItem[complexFieldKey] || []).find(
obj => obj.field === fieldId
)
) {
selectorDoc[`${complexFieldKey}.field`] = fieldId;

const complexFieldDataKeys = Object.keys(complexFieldData).filter(
key => key !== 'field'
);

for (const complexFieldDataKey of complexFieldDataKeys) {
setDoc[`${complexFieldKey}.$.${complexFieldDataKey}`] =
complexFieldData[complexFieldDataKey];
}
} else {
pushDoc[complexFieldKey] = complexFieldData;
}
}
}
}
Expand All @@ -318,7 +397,7 @@ export const setProperty = async ({
subdomain,
serviceName,
action: `${pluralFormation(collectionType)}.updateMany`,
data: { selector: { _id: relatedItem._id }, modifier },
data: { selector: { _id: relatedItem._id, ...selectorDoc }, modifier },
isRPC: true
});

Expand Down
3 changes: 2 additions & 1 deletion packages/core-ui/cypress/integration/erxes/settings/tags.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "cypress-file-upload";

import { SignIn } from "../utils";

SignIn;
Expand All @@ -16,7 +17,7 @@ context("Tags", () => {
.children()
.eq(2)
.click();
cy.url().should("include", "/tags/conversation");
cy.url().should("include", "/settings/tags/conversation");

cy.get("#AddTagButton").click();
cy.get("input[name=name]").type("name");
Expand Down
8 changes: 7 additions & 1 deletion packages/core-ui/public/locales/mn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2462,5 +2462,11 @@
"Income Transaction":"Орлогын гүйлгээ",
"Outcome Transaction":"Зарлагын гүйлгээ",
"Give Transaction":"Олголтын гүйлгээ",
"Given Amount":"Олгосон дүн"
"Given Amount":"Олгосон дүн",
"Saving stored interest":"Хуримтлагдсан үр шим",
"Close interest Rate":"Цуцлах үеийн хүү",
"Is allow outcome":"Зарлага зөвшөөрөх эсэх",
"Is Deposit":"Депозит эсэх",
"Is allow income":"Орлого зөвшөөрөх эсэх",
"Deposit account":"Депозит данс"
}
75 changes: 42 additions & 33 deletions packages/core-ui/src/modules/settings/team/components/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { ControlLabel, FormControl } from '@erxes/ui/src/components/form';
import { FilterContainer, InputBar } from '@erxes/ui-settings/src/styles';
import {
FilterContainer,
InputBar,
Title
} from '@erxes/ui-settings/src/styles';
import { FlexItem, FlexRow } from '@erxes/ui-settings/src/styles';
import React, { useState } from 'react';

Expand Down Expand Up @@ -100,10 +104,34 @@ export default function Home(props: Props) {
);
};

const renderFilter = (
const title = (
<Title capitalize={true}>
{__('Team Members')}&nbsp;
{`(${totalCount || 0})`}
</Title>
);

const renderInvitationForm = formProps => {
const { usersGroups, renderButton } = props;

return (
<UserInvitationForm
closeModal={formProps.closeModal}
usersGroups={usersGroups}
renderButton={renderButton}
/>
);
};

const trigger = (
<Button btnStyle="success" icon="plus-circle">
Invite team members
</Button>
);

const righActionBar = (
<FilterContainer>
<FlexRow>
<ControlLabel>#{totalCount} members&nbsp;&nbsp;</ControlLabel>
{renderBrandChooser()}
<InputBar type="searchBar">
<Icon icon="search-1" size={20} />
Expand Down Expand Up @@ -139,43 +167,22 @@ export default function Home(props: Props) {
/>
</FlexItem>
</InputBar>
<ModalTrigger
content={renderInvitationForm}
size="xl"
title="Invite team members"
autoOpenKey="showMemberInviteModal"
trigger={trigger}
/>
</FlexRow>
</FilterContainer>
);

const renderInvitationForm = formProps => {
const { usersGroups, renderButton } = props;

return (
<UserInvitationForm
closeModal={formProps.closeModal}
usersGroups={usersGroups}
renderButton={renderButton}
/>
);
};

const trigger = (
<Button btnStyle="success" icon="plus">
Invite team members
</Button>
);

const righActionBar = (
<ModalTrigger
content={renderInvitationForm}
size="xl"
title="Invite team members"
autoOpenKey="showMemberInviteModal"
trigger={trigger}
/>
);

const actionBar = (
<Wrapper.ActionBar
hasFlex={true}
right={righActionBar}
left={renderFilter}
left={title}
wideSpacing={true}
/>
);
Expand All @@ -189,7 +196,9 @@ export default function Home(props: Props) {
breadcrumb={[{ title: 'Team members' }]}
/>
}
leftSidebar={<Sidebar loadingMainQuery={loading} />}
leftSidebar={
<Sidebar loadingMainQuery={loading} queryParams={queryParams} />
}
actionBar={actionBar}
content={<UserList history={history} queryParams={queryParams} />}
transparent={true}
Expand Down
Loading

0 comments on commit d0389a2

Please sign in to comment.