Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/campaign' into dockerUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
ashish-egov committed Jun 17, 2024
2 parents 0c8f19a + 913275c commit c2f6df7
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 7 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/buildWorkbenchUI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Digit Admin Console Build workflow
on:
push:
branches:
- campaign
pull_request:
branches:
- campaign
workflow_dispatch:
jobs:
docker_image-build:
outputs:
run_job_digit_ui: ${{ steps.check_files.outputs.run_job_digit_ui }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Setup Docker
uses: docker/setup-buildx-action@v1
- name: check modified files
id: check_files
run: |
echo "=============== list modified files ==============="
git diff --name-only HEAD^ HEAD
echo "========== check paths of modified files =========="
git diff --name-only HEAD^ HEAD > files.txt
run_job_digit_ui=false
while IFS= read -r file
do
if [[ $file == micro-ui/* ]]; then
echo "This modified file is under the 'digit_ui' folder."
run_job_digit_ui=true
fi
done < files.txt
# Set the output based on whether the job should run
echo "::set-output name=run_job_digit_ui::$run_job_digit_ui"
echo "ACTION_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
echo "COMMIT_ID=${GITHUB_SHA: -8}" >> $GITHUB_ENV # Extract last 8 characters of SHA
echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Login to egovio docker Container Registry
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
# Authenticate with Docker Hub
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- name: Build and Push Docker image for digit-ui
if: ${{ steps.check_files.outputs.run_job_digit_ui == 'true' }}
run: |
docker build -t workbench-ui:${{ env.BRANCH_NAME }}-${{ env.COMMIT_ID }}-${{ env.ACTION_NUMBER }} -f web/workbench/Dockerfile .
docker tag workbench-ui:${{ env.BRANCH_NAME }}-${{ env.COMMIT_ID }}-${{ env.ACTION_NUMBER }} egovio/workbench-ui:${{ env.BRANCH_NAME }}-${{ env.COMMIT_ID }}-${{ env.ACTION_NUMBER }}
docker push egovio/workbench-ui:${{ env.BRANCH_NAME }}-${{ env.COMMIT_ID }}-${{ env.ACTION_NUMBER }}
working-directory: micro-ui
3 changes: 1 addition & 2 deletions micro-ui/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# workbench ui
# DIGIT ui

A React App built on top of DIGIT UI Core.

Expand Down Expand Up @@ -136,5 +136,4 @@ Start the server
yarn start
```


![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png)
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,35 @@ function SelectingBoundaries({ onSelect, formData, ...props }) {
}, [params?.hierarchyType]);

useEffect(() => {
setHierarchyTypeDataresult(params?.hierarchy);
if (params?.hierarchy) {
const sortHierarchy = (hierarchy) => {
const boundaryMap = new Map();
hierarchy.forEach(item => {
boundaryMap.set(item.boundaryType, item);
});

const sortedHierarchy = [];
let currentType = null;

while (sortedHierarchy.length < hierarchy.length) {
for (let i = 0; i < hierarchy.length; i++) {
if (hierarchy[i].parentBoundaryType === currentType) {
sortedHierarchy.push(hierarchy[i]);
currentType = hierarchy[i].boundaryType;
break;
}
}
}

return sortedHierarchy;
};

const sortedHierarchy = sortHierarchy(params.hierarchy.boundaryHierarchy);
setHierarchyTypeDataresult({
...params.hierarchy,
boundaryHierarchy: sortedHierarchy
});
}
}, [params?.hierarchy]);

useEffect(() => {
Expand Down
13 changes: 9 additions & 4 deletions utilities/project-factory/src/server/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ if (!HOST) {
console.log("You need to set the HOST variable");
process.exit(1);
}


const getDBSchemaName = (dbSchema = "") => {
return dbSchema ? (dbSchema == "egov" ? "public" : dbSchema) : "public";
}
// Configuration object containing various environment variables
const config = {
masterNameForSchemaOfColumnHeaders: "adminSchema",
Expand Down Expand Up @@ -53,10 +58,10 @@ const config = {
DB_NAME: process.env.DB_NAME || "postgres",
DB_PASSWORD: process.env.DB_PASSWORD || "postgres",
DB_PORT: process.env.DB_PORT || "5432",
DB_CAMPAIGN_DETAILS_TABLE_NAME: `${process.env.DB_SCHEMA || "health"}.eg_cm_campaign_details`,
DB_CAMPAIGN_PROCESS_TABLE_NAME: `${process.env.DB_SCHEMA || "health"}.eg_cm_campaign_process`,
DB_GENERATED_RESOURCE_DETAILS_TABLE_NAME: `${process.env.DB_SCHEMA || "health"}.eg_cm_generated_resource_details`,
DB_RESOURCE_DETAILS_TABLE_NAME: `${process.env.DB_SCHEMA || "health"}.eg_cm_resource_details`
DB_CAMPAIGN_DETAILS_TABLE_NAME: `${getDBSchemaName(process.env.DB_SCHEMA)}.eg_cm_campaign_details`,
DB_CAMPAIGN_PROCESS_TABLE_NAME: `${getDBSchemaName(process.env.DB_SCHEMA)}.eg_cm_campaign_process`,
DB_GENERATED_RESOURCE_DETAILS_TABLE_NAME: `${getDBSchemaName(process.env.DB_SCHEMA)}.eg_cm_generated_resource_details`,
DB_RESOURCE_DETAILS_TABLE_NAME: `${getDBSchemaName(process.env.DB_SCHEMA)}.eg_cm_resource_details`
},
// Application configuration
app: {
Expand Down

0 comments on commit c2f6df7

Please sign in to comment.