Skip to content

Commit

Permalink
feat: Products by brand and multi erkhet (#4718)
Browse files Browse the repository at this point in the history
  • Loading branch information
munkhsaikhan committed Nov 26, 2023
1 parent fd63ef2 commit bbf4fd8
Show file tree
Hide file tree
Showing 106 changed files with 11,035 additions and 52 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/plugin-multierkhet-api.yaml
@@ -0,0 +1,64 @@
name: Plugin multierkhet Api CI

on:
push:
branches:
- dev
- master
- staging
- build-test
paths:
- 'packages/api-utils/**'
- 'packages/plugin-multierkhet-api/**'
- '.github/workflows/plugin-multierkhet-api.yaml'
pull_request:
branches:
- dev
- master
- staging
- build-test
paths:
- 'packages/api-utils/**'
- 'packages/plugin-multierkhet-api/**'
- '.github/workflows/plugin-multierkhet-api.yaml'

jobs:
api:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Use Node.js 18.17.x
uses: actions/setup-node@v3
with:
node-version: 18.17.x

# https://github.com/actions/cache/blob/main/examples.md#node---yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-api-plugin-multierkhet
restore-keys: |
${{ runner.os }}-yarn-api-
${{ runner.os }}-yarn-
- name: Build
run: |
cp -r builder dist
cd dist
yarn install
yarn build plugin multierkhet
- name: Build docker image
if: github.event_name == 'push' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/build-test' )
run: |
cd dist/erxes
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
docker buildx build -t erxes/plugin-multierkhet-api:${GITHUB_REF#refs/heads/} -f Dockerfile .
docker push erxes/plugin-multierkhet-api:${GITHUB_REF#refs/heads/}
99 changes: 99 additions & 0 deletions .github/workflows/plugin-multierkhet-ui.yaml
@@ -0,0 +1,99 @@
name: Plugin multierkhet UI CI

on:
push:
branches:
- dev
- master
- staging
- build-test
paths:
- 'packages/erxes-ui/**'
- 'packages/ui-plugin-template/**'
- 'packages/ui-cards/**'
- 'packages/ui-forms/**'
- 'packages/ui-inbox/**'
- 'packages/ui-knowledgebase/**'
- 'packages/ui-leads/**'
- 'packages/ui-log/**'
- 'packages/ui-notifications/**'
- 'packages/ui-products/**'
- 'packages/ui-segments/**'
- 'packages/ui-settings/**'
- 'packages/ui-team/**'
- 'packages/ui-tags/**'
- 'packages/ui-multierkhet/**'
- 'packages/plugin-multierkhet-ui/**'
- '.github/workflows/plugin-multierkhet-ui.yaml'
pull_request:
branches:
- dev
- master
- staging
- build-test
paths:
- 'packages/erxes-ui/**'
- 'packages/ui-plugin-template/**'
- 'packages/ui-cards/**'
- 'packages/ui-forms/**'
- 'packages/ui-inbox/**'
- 'packages/ui-knowledgebase/**'
- 'packages/ui-leads/**'
- 'packages/ui-log/**'
- 'packages/ui-notifications/**'
- 'packages/ui-products/**'
- 'packages/ui-segments/**'
- 'packages/ui-settings/**'
- 'packages/ui-team/**'
- 'packages/ui-tags/**'
- 'packages/ui-multierkhet/**'
- 'packages/plugin-multierkhet-ui/**'
- '.github/workflows/plugin-multierkhet-ui.yaml'

jobs:
ui:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Use Node.js 18.17.x
uses: actions/setup-node@v3
with:
node-version: 18.17.x

# https://github.com/actions/cache/blob/main/examples.md#node---yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn # since the yarn install runs at workspace level
restore-keys: |
${{ runner.os }}-yarn
- name: Build
run: |
yarn install --frozen-lockfile
cd packages/plugin-multierkhet-ui
yarn build
cp -r ./src/locales/ ./dist/locales 2>/dev/null || true
- name: Configure AWS credentials
if: github.event_name == 'push' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/build-test')
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2

- name: Deploy
if: github.event_name == 'push' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/build-test')
run: |
tar -cf build.tar --directory=packages/plugin-multierkhet-ui/dist .
cp build.tar packages/plugin-multierkhet-ui/dist
rm -rf packages/plugin-multierkhet-ui/dist/*.js
aws s3 sync packages/plugin-multierkhet-ui/dist s3://erxes-${GITHUB_REF#refs/heads/}-plugins/uis/plugin-multierkhet-ui --delete
4 changes: 3 additions & 1 deletion packages/erxes-ui/src/brands/containers/SelectBrands.tsx
Expand Up @@ -22,6 +22,7 @@ export default ({
initialValue,
multi = true,
label,
customOption,
name
}: {
queryParams?: IQueryParams;
Expand All @@ -46,6 +47,7 @@ export default ({
generateOptions={generateBrandOptions}
onSelect={onSelect}
multi={multi}
customOption={customOption}
/>
);
};
};
9 changes: 8 additions & 1 deletion packages/erxes-ui/src/components/filter/Filter.tsx
Expand Up @@ -133,7 +133,14 @@ function Filter({ queryParams = {}, filterTitle, history }: IProps) {
{renderFilterParam('status', false)}
{renderFilterParam('state', false)}
{renderFilterParam('categoryApprovalState', false)}
{renderFilterWithData('categoryId', 'forum')}
{location.href.includes('forum') &&
renderFilterWithData('categoryId', 'forum')}
{location.href.includes('product') &&
renderFilterWithData(
'categoryId',
'productCategory',
'_id, code, name'
)}
{renderFilterParam('participating', true)}
{renderFilterParam('unassigned', true)}
{renderFilterParam('awaitingResponse', true, 'Awaiting Response')}
Expand Down
4 changes: 3 additions & 1 deletion packages/erxes-ui/src/components/filter/createChipText.tsx
Expand Up @@ -16,6 +16,7 @@ const ChipText = (props: any) => {
const branch = query.branchDetail;
const department = query.departmentDetail;
const unit = query.unitDetail;
const productCategory = query.productCategoryDetail;

return (
(brand && brand.name) ||
Expand All @@ -26,7 +27,8 @@ const ChipText = (props: any) => {
(forum && forum.name) ||
(branch && branch.title) ||
(department && department.title) ||
(unit && unit.title)
(unit && unit.title) ||
(productCategory && `${productCategory.code} - ${productCategory.name}`)
);
};

Expand Down
25 changes: 25 additions & 0 deletions packages/plugin-multierkhet-api/.env.sample
@@ -0,0 +1,25 @@
# general
NODE_ENV=development
PORT=4015

ENABLED_SERVICES_PATH=

# public urls
MAIN_API_DOMAIN=http://localhost:3300

# MongoDB
MONGO_URL=mongodb://localhost/erxes_tags
TEST_MONGO_URL=mongodb://localhost/erxes-tags-test
API_MONGO_URL=mongodb://localhost/erxes

# RabbitMQ
RABBITMQ_HOST=amqp://localhost

# Redis
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=123

ERKHET_URL=https://erkhet.biz
ERKHET_RABBITMQ_HOST=amqp://localhost
ERKHET_MESSAGE_BROKER_PREFIX=1
11 changes: 11 additions & 0 deletions packages/plugin-multierkhet-api/package.json
@@ -0,0 +1,11 @@
{
"name": "@erxes/plugin-multierkhet-api",
"version": "1.0.0",
"scripts": {
"dev": "nodemon src/index.ts",
"build" : "tsc"
},
"dependencies": {
"@erxes/api-utils": "*"
}
}

0 comments on commit bbf4fd8

Please sign in to comment.