From 5ed3bdf561998e20119b12ff60d9491b9679a37b Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 <rushikesh.sonawane@tekditechnologies.com> Date: Mon, 11 Nov 2024 00:26:20 +0530 Subject: [PATCH 01/10] Issue #PS-2416 chore: Resolved option dispay issue and restricted direct route hit to redirect centers page --- src/pages/course-planner/index.tsx | 6 +++++- src/pages/play/content/[identifier].tsx | 6 +++++- src/store/store.js | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pages/course-planner/index.tsx b/src/pages/course-planner/index.tsx index 51a2719f..afd162ef 100644 --- a/src/pages/course-planner/index.tsx +++ b/src/pages/course-planner/index.tsx @@ -25,11 +25,14 @@ import coursePlannerStore from "@/store/coursePlannerStore"; import taxonomyStore from "@/store/tanonomyStore"; import { telemetryFactory } from "@/utils/telemetry"; import { TelemetryEventType } from "@/utils/app.constant"; +import useStore from "@/store/store"; const Foundation = () => { const router = useRouter(); const { t } = useTranslation(); const theme = useTheme(); + const userStore = useStore(); + const isActiveYear = userStore.isActiveYearSelected; const isSmallScreen = useMediaQuery(theme.breakpoints.down("sm")); const isMediumScreen = useMediaQuery(theme.breakpoints.between("sm", "md")); const store = coursePlannerStore(); @@ -116,7 +119,8 @@ const Foundation = () => { if (userStateName) { getFrameworkDetails(); } - }, [userStateName]); + !isActiveYear && router.push("/centers"); + }, [userStateName, isActiveYear]); const handleCardClick = (id: any) => { router.push(`/stateDetails?cardId=${id}`); diff --git a/src/pages/play/content/[identifier].tsx b/src/pages/play/content/[identifier].tsx index aec8fae7..3512b38a 100644 --- a/src/pages/play/content/[identifier].tsx +++ b/src/pages/play/content/[identifier].tsx @@ -17,6 +17,7 @@ import { import { V1PlayerConfig, V2PlayerConfig } from "../../../data/player-config"; import Loader from "@/components/Loader"; import { useTranslation } from "react-i18next"; +import useStore from "@/store/store"; // @ts-ignore const SunbirdPlayers = dynamic(() => import("editor/SunbirdPlayers"), { @@ -34,6 +35,8 @@ const Players: React.FC<SunbirdPlayerProps> = () => { const { t } = useTranslation(); const { identifier } = router.query; const [loading, setLoading] = useState(true); + const store = useStore(); + const isActiveYear = store.isActiveYearSelected; useEffect(() => { const loadContent = async () => { @@ -66,7 +69,8 @@ const Players: React.FC<SunbirdPlayerProps> = () => { } }; loadContent(); - }, [identifier]); + !isActiveYear && router.push("/centers"); + }, [identifier, isActiveYear]); return ( <Box> diff --git a/src/store/store.js b/src/store/store.js index f05efc7c..6a81a140 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -8,7 +8,7 @@ const useStore = create( // state: "", // district: "", // block: "", - isActiveYearSelected: '', + isActiveYearSelected: true, // setPid: (newPid) => set((state) => ({ pid: newPid })), // setPid: (newPid) => set((state) => ({ pid: newPid })), // setPid: (newPid) => set((state) => ({ pid: newPid })), From 0079121a486bad46461df8dd54b944b63cb4f0f5 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 <rushikesh.sonawane@tekditechnologies.com> Date: Mon, 11 Nov 2024 12:34:28 +0530 Subject: [PATCH 02/10] Issue #PS-000 chore: Fixed academic year refresh issue --- src/components/layouts/header/Header.tsx | 7 ++++--- src/pages/login.tsx | 3 ++- src/store/store.js | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/layouts/header/Header.tsx b/src/components/layouts/header/Header.tsx index f715db87..7325738a 100644 --- a/src/components/layouts/header/Header.tsx +++ b/src/components/layouts/header/Header.tsx @@ -54,14 +54,15 @@ const Header = ({ sx, customClass, toggleMobileSidebar, position }: any) => { setSelectedSessionId(event.target.value); console.log("selected academic year id", event.target.value); localStorage.setItem("academicYearId", event.target.value); - // Check if the selected academic year is active - const selectedYear = academicYearList?.find( + // Check if the selected academic year is active + const selectedYear = academicYearList?.find( (year) => year.id === event.target.value ); const isActive = selectedYear ? selectedYear.isActive : false; // localStorage.setItem('isActiveYearSelected', JSON.stringify(isActive)); setIsActiveYearSelected(isActive); - window.location.reload(); + // window.location.reload(); + window.location.href = "/centers"; }; const handleChange = (event: SelectChangeEvent) => { diff --git a/src/pages/login.tsx b/src/pages/login.tsx index c6033604..850e2aa3 100644 --- a/src/pages/login.tsx +++ b/src/pages/login.tsx @@ -148,7 +148,8 @@ const LoginPage = () => { localStorage.setItem("academicYearId", activeSessionId); if (activeSessionId){ setIsActiveYearSelected(true); - router.push("/centers"); + // router.push("/centers"); + window.location.href = "/centers"; } } }; diff --git a/src/store/store.js b/src/store/store.js index 6a81a140..f05efc7c 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -8,7 +8,7 @@ const useStore = create( // state: "", // district: "", // block: "", - isActiveYearSelected: true, + isActiveYearSelected: '', // setPid: (newPid) => set((state) => ({ pid: newPid })), // setPid: (newPid) => set((state) => ({ pid: newPid })), // setPid: (newPid) => set((state) => ({ pid: newPid })), From 4decaae3c24b7b0d2beda2a6f2b0ce8cdd605f2c Mon Sep 17 00:00:00 2001 From: Akshata Katwal <akshata.katwal@tekditechnologies.com> Date: Mon, 11 Nov 2024 13:16:42 +0530 Subject: [PATCH 03/10] Issue bug:Add no data found according to changed userlist api response --- src/components/UserTable.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/components/UserTable.tsx b/src/components/UserTable.tsx index b9c3f7fa..399872b4 100644 --- a/src/components/UserTable.tsx +++ b/src/components/UserTable.tsx @@ -897,8 +897,11 @@ console.log(code[0]) resp = await userList({ limit, filters, sort, offset, fields }); } - console.log(resp?.getUserDetails); - const result = enableCenterFilter?resp?.userDetails:resp?.getUserDetails; + if (!resp?.getUserDetails) { + setData([]); + //showToastMessage("No data found", "info"); + } + const result = enableCenterFilter?resp?.userDetails:resp?.getUserDetails; console.log(result) console.log(resp?.totalCount) if (resp?.totalCount >= 15) { @@ -1029,7 +1032,7 @@ console.log(code[0]) } console.log(finalResult) - if (filters?.name) { + if (filters?.name && resp?.getUserDetails) { const prioritizedResult = finalResult.sort((a: any, b: any) => { const aStartsWith = a.name.toLowerCase().startsWith(filters?.name); const bStartsWith = b.name.toLowerCase().startsWith(filters?.name); @@ -1040,9 +1043,14 @@ console.log(code[0]) }); setData(prioritizedResult); - } else { + } else if (resp?.getUserDetails){ setData(finalResult); } + else + { + setData([]); + + } setLoading(false); setCohortsFetched(false); @@ -1508,6 +1516,9 @@ console.log(selectedBlockStore) </Typography> </Box> ); + + + console.log("data-----------------------------", data) const userProps = { userType: userType, searchPlaceHolder: searchPlaceholder, From 4f5701245bf6384b8ad281aa30b8b15bea8cbe7a Mon Sep 17 00:00:00 2001 From: Akshata Katwal <akshata.katwal@tekditechnologies.com> Date: Mon, 11 Nov 2024 16:30:31 +0530 Subject: [PATCH 04/10] add --- .env | 22 +++++-- .../workflows/prod-pratham-deployment.yaml | 61 +++++++++++++++++++ 2 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/prod-pratham-deployment.yaml diff --git a/.env b/.env index 446fc325..ac9c9a91 100644 --- a/.env +++ b/.env @@ -1,7 +1,17 @@ -# NEXT_PUBLIC_BASE_URL=https://qa.prathamteacherapp.tekdinext.com/user/v1 -NEXT_PUBLIC_BASE_URL=https://backend.prathamdigital.org/user/v1 -NEXT_PUBLIC_TELEMETRY_URL=https://qa.prathamteacherapp.tekdinext.com -NEXT_PUBLIC_NOTIFICATION_BASE_URL=https://notification.prathamdigital.org -# NEXT_PUBLIC_NOTIFICATION_BASE_URL=https://qa.prathamteacherapp.tekdinext.com/notification-service -NEXT_PUBLIC_COURSE_PLANNER_API_URL=https://courseplan.tekdinext.com/project/v1 +#NEXT_PUBLIC_BASE_URL=https://backend.prathamdigital.org/user/v1 +NEXT_PUBLIC_TELEMETRY_URL=https://telemetry.prathamdigital.org +NEXT_PUBLIC_MEASUREMENT_ID=G-GNMQZ8Z65Z +#NEXT_PUBLIC_TRACKING_API_URL=https://tracking.prathamdigital.org +#NEXT_PUBLIC_EVENT_BASE_URL=https://event.prathamdigital.org/event-service/event/v1 +#NEXT_PUBLIC_NOTIFICATION_BASE_URL=https://notification.prathamdigital.org +NEXT_PUBLIC_COURSE_PLANNER_API_URL=https://project.prathamdigital.org/project/v1 NEXT_PUBLIC_SUNBIRDSAAS_API_URL=https://sunbirdsaas.com +NEXT_PUBLIC_SURVEY_URL=https://survey.prathamdigital.org/survey/v1 +NEXT_PUBLIC_RESET_PASSWORD_URL=https://dev-reset-password.prathamdigital.org +NEXT_PUBLIC_MIDDLEWARE_URL=https://middleware.prathamdigital.org +#NEXT_PUBLIC_ATTENDANCE_URL=https://middleware.prathamdigital.org/api/v1 +NEXT_PRIVATE_LOCAL_WEBPACK=true +WORKSPACE_BASE_URL=https://dev-workspace.prathamdigital.org +NEXT_PUBLIC_WORKSPACE_BASE_URL=https://dev-workspace.prathamdigital.org +NEXT_PUBLIC_FCM_API_KEY=AIzaSyCmhNz-HMkkf42QNmnf7pnZm49FP5g4INw +NEXT_PUBLIC_VAPID_KEY=BOZ_JkC62vr767LoC7APU26ZdGYW5htBkfqIEtsVX6zmE3Fi-XgcN_TggSaXKh5rGKcaa4vuQxaYiRPU2B955GI diff --git a/.github/workflows/prod-pratham-deployment.yaml b/.github/workflows/prod-pratham-deployment.yaml new file mode 100644 index 00000000..5f36b7a0 --- /dev/null +++ b/.github/workflows/prod-pratham-deployment.yaml @@ -0,0 +1,61 @@ +name: PROD FRONTEND DEPLOYMENT WITH TAG +on: + push: + tags: + - 'v*' + +jobs: + PROD-FRONTEND-TAG-BASE-DEPLOYMENT: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set TAG environment variable + id: get_tag + run: | + # Extract the tag from the ref and set it as an environment variable + echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - name: Debug TAG value + run: | + # Print the TAG value to ensure the correct tag is being used + echo "TAG value - ${{ env.TAG }}" + + - name: Deploy Stack + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST_NAME_PROD }} + username: ${{ secrets.USERNAME_PROD }} + key: ${{ secrets.SSH_KEY_PROD }} + port: ${{ secrets.PORT_PROD }} + script: | + # Assign the TAG value from the environment variable + TAG="${{ env.TAG }}" + + # Define the target directory and environment file + TARGET_DIR="${{ secrets.TARGET_DIR_PROD }}" + ENVIRONMENT="$TARGET_DIR/.env" + + # Remove the existing .env file if it exists + if [ -f "$ENVIRONMENT" ]; then + rm "$ENVIRONMENT" + fi + + # Create the target directory if it doesn't exist and write environment variables to .env + mkdir -p "$TARGET_DIR" + cat << EOF > "$ENVIRONMENT" + ${{ secrets.PROD_ENV }} + EOF + + # Navigate to the target directory + cd ${{ secrets.TARGET_DIR_PROD }} + + # List the contents of the directory for verification + ls -ltra + + # Run the deployment script with the correct TAG + ./deploy.sh $TAG \ No newline at end of file From 0ea8ef612e3d08f314d8c1500bbb50bcf38bbd8a Mon Sep 17 00:00:00 2001 From: Akshata Katwal <akshata.katwal@tekditechnologies.com> Date: Mon, 11 Nov 2024 16:45:02 +0530 Subject: [PATCH 05/10] Issue feat: Integrate notifications for learner and facilitator --- src/components/CommonUserModal.tsx | 11 ++++-- src/components/ReassignCenterModal.tsx | 54 ++++++++++++++++++++++++-- src/components/UserTable.tsx | 7 ++++ src/hooks/useNotification.tsx | 3 +- src/utils/useLocationState.tsx | 1 + 5 files changed, 68 insertions(+), 8 deletions(-) diff --git a/src/components/CommonUserModal.tsx b/src/components/CommonUserModal.tsx index f8fc23e1..c9f31875 100644 --- a/src/components/CommonUserModal.tsx +++ b/src/components/CommonUserModal.tsx @@ -51,6 +51,7 @@ interface UserModalProps { userId?: string; onSubmit: (submitValue: boolean) => void; userType: string; + userName?:string; } @@ -63,8 +64,9 @@ const CommonUserModal: React.FC<UserModalProps> = ({ userId, onSubmit, userType, + userName }) => { - console.log(userType); + console.log(userName); const [schema, setSchema] = React.useState<any>(); const [uiSchema, setUiSchema] = React.useState<any>(); const [openModal, setOpenModal] = React.useState(false); @@ -383,8 +385,11 @@ const CommonUserModal: React.FC<UserModalProps> = ({ getNotification(userId, "FACILITATOR_PROFILE_UPDATE"); } if( userType === FormContextType.STUDENT){ - getNotification(userId, "LEARNER_PROFILE_UPDATE_ALERT"); - getNotification(userId, "LEARNER_PROFILE_UPDATE_BY_ADMIN_TL_FC"); + const replacements = { + "{learnerName}":userName + } + getNotification(userId, "LEARNER_PROFILE_UPDATE_ALERT", replacements); + getNotification(userId, "LEARNER_PROFILE_UPDATE_BY_ADMIN_TL_FC", replacements); } diff --git a/src/components/ReassignCenterModal.tsx b/src/components/ReassignCenterModal.tsx index 561b71ed..767ff3a3 100644 --- a/src/components/ReassignCenterModal.tsx +++ b/src/components/ReassignCenterModal.tsx @@ -38,6 +38,8 @@ interface ReassignCohortModalProps { districtCode?: any; cohortId?: any; centers: any; + userName?:any + } interface Cohort { @@ -67,8 +69,8 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({ districtName, districtCode, centers, + userName }) => { - console.log(userId); const { t } = useTranslation(); const theme = useTheme<any>(); const roleType = userType; @@ -140,6 +142,7 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({ useState(""); const [selectedTLUserID, setSelectedTLUserID] = useState(userId); + // const [reassignOpen, setReassignOpen] = useState(false); //const [selectedBlockId, setselectedBlockId] = useState(blockName); @@ -186,6 +189,8 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({ const { getNotification } = useNotification(); const handleReassign = async () => { + console.log("TL_DISTRICT_UPDATE",selectedDistrict[0] , districtName) + try { let selectedData; let unSelectedData: string[]; @@ -232,6 +237,8 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({ if (selectedBlock[0] !== blockName) { + console.log("TL_DISTRICT_UPDATE",selectedDistrict[0] , districtName) + const userDetails = await getUserDetailsInfo(userId); if(userType === Role.FACILITATORS){ @@ -252,12 +259,15 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({ ]; - + if (selectedDistrict[0] !== districtName) { + console.log("TL_DISTRICT_UPDATE",selectedDistrict[0] , districtName) const userDetails = await getUserDetailsInfo(userId); if(userType === Role.TEAM_LEADERS){ getNotification(selectedTLUserID, "TL_DISTRICT_UPDATE"); + getNotification(selectedTLUserID, "TL_BLOCK_REASSIGNMENT"); + } const blockField = userDetails?.userData?.customFields.find( @@ -275,6 +285,7 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({ ]; } else { + console.log("TL_BLOCK_REASSIGNMENT") getNotification(selectedTLUserID, "TL_BLOCK_REASSIGNMENT"); } } @@ -297,10 +308,24 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({ "success" ); if( userType === Role.FACILITATORS) { + if (selectedDistrict[0] !== districtName) + { + if (selectedBlock[0] !== blockName) { + getNotification(userId, "FACILITATOR_BLOCK_UPDATE"); + + } + console.log("TL_DISTRICT_UPDATE",selectedDistrict[0] , districtName) + getNotification(userId, "FACILITATOR_DISTRICT_UPDATE"); + + } getNotification(userId, "FACILITATOR_CENTER_REASSIGNMENT"); } + if(userType === Role.LEARNERS) { - getNotification(selectedTLUserID, "LEARNER_REASSIGNMENT_NOTIFICATION"); + const replacements = { + "{learnerName}":userName + } + getNotification(selectedTLUserID, "LEARNER_REASSIGNMENT_NOTIFICATION", replacements); } } else { const reassignBlockObject = { @@ -421,7 +446,24 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({ reassignButtonStatus ? setReassignButtonStatus(false) : setReassignButtonStatus(true); + + if (selectedDistrict[0] !== districtName) { + console.log("TL_DISTRICT_UPDATE",selectedDistrict[0] , districtName) + if(userType === Role.TEAM_LEADERS){ + + getNotification(selectedTLUserID, "TL_DISTRICT_UPDATE"); getNotification(selectedTLUserID, "TL_BLOCK_REASSIGNMENT"); + + } + + } + else{ + getNotification(selectedTLUserID, "TL_BLOCK_REASSIGNMENT"); + + } + + + } } } catch (error) { @@ -541,10 +583,13 @@ console.log(formattedBlocks) value: selectedCenterCode, }, ]; - if ( selectedDistrict[0] !== districtName) { + if ( selectedDistrict[0] && selectedDistrict[0] !== districtName) { if(userType === Role.TEAM_LEADERS){ getNotification(selectedTLUserID, "TL_DISTRICT_UPDATE"); + getNotification(selectedTLUserID, "TL_BLOCK_REASSIGNMENT"); + + } customFields = [ { @@ -635,6 +680,7 @@ console.log(formattedBlocks) stateDefaultValue={stateDefaultValue} reAssignModal={true} userType={userType} + // setSelectedDistrict={ setSelectedDistrict} // selectedState={selectedState} districtDefaultValue={districtName} diff --git a/src/components/UserTable.tsx b/src/components/UserTable.tsx index 399872b4..88723abb 100644 --- a/src/components/UserTable.tsx +++ b/src/components/UserTable.tsx @@ -183,6 +183,7 @@ const UserTable: React.FC<UserTableProps> = ({ const [loading, setLoading] = useState<boolean | undefined>(undefined); const [openAddLearnerModal, setOpenAddLearnerModal] = React.useState(false); const [userId, setUserId] = useState(); + const [submitValue, setSubmitValue] = useState<boolean>(false); console.log(selectedBlockCode) const reassignButtonStatus = useSubmittedButtonStore( @@ -738,6 +739,7 @@ console.log(code[0]) const handleEdit = async (rowData: any) => { submitValue ? setSubmitValue(false) : setSubmitValue(true); + setUserName(rowData?.name) console.log("Edit row:", rowData); @@ -799,6 +801,8 @@ console.log(code[0]) // setIsDeleteModalOpen(true); console.log(rowData) setSelectedUserId(rowData?.userId ); + setUserName(rowData?.name) + setCohortId(rowData?.cohortIds); setBlock(rowData?.blocks) console.log(rowData?.districtValue) @@ -1650,6 +1654,8 @@ console.log(selectedBlockStore) districtCode={districtCode} cohortId={cohortId} centers={assignedCenters} + userName={userName} + /> @@ -1660,6 +1666,7 @@ console.log(selectedBlockStore) isEditModal={true} userId={userId} onSubmit={handleModalSubmit} + userName={userName} userType={ userType === Role.LEARNERS ? FormContextType.STUDENT diff --git a/src/hooks/useNotification.tsx b/src/hooks/useNotification.tsx index 04e05cb1..c6928373 100644 --- a/src/hooks/useNotification.tsx +++ b/src/hooks/useNotification.tsx @@ -3,7 +3,7 @@ import { getUserDetailsInfo } from "@/services/UserList"; import { useCallback } from "react"; const useNotification = () => { - const getNotification = useCallback(async (userId: any, key: any) => { + const getNotification = useCallback(async (userId: any, key: any, replacements?:any) => { try { // const userId = localStorage.getItem("userId"); @@ -26,6 +26,7 @@ const useNotification = () => { isQueue: false, context: "USER", key: key, + replacements: replacements, push: { receipients: [deviceId], }, diff --git a/src/utils/useLocationState.tsx b/src/utils/useLocationState.tsx index c938c1ec..d7a93d79 100644 --- a/src/utils/useLocationState.tsx +++ b/src/utils/useLocationState.tsx @@ -321,6 +321,7 @@ export const useLocationState = ( useEffect(() => { if (!open) { setSelectedBlock([]); + if(!reAssignModal) setSelectedDistrict([]); setSelectedState([]); setSelectedCenter([]); From 68b7e1b80f643c71b4f996512415ba52dfd6baba Mon Sep 17 00:00:00 2001 From: Akshata Katwal <akshata.katwal@tekditechnologies.com> Date: Mon, 11 Nov 2024 16:51:00 +0530 Subject: [PATCH 06/10] update pr --- .env | 24 +++---- .../workflows/prod-pratham-deployment.yaml | 62 ++++--------------- 2 files changed, 19 insertions(+), 67 deletions(-) diff --git a/.env b/.env index ac9c9a91..3e8ea4bd 100644 --- a/.env +++ b/.env @@ -1,17 +1,7 @@ -#NEXT_PUBLIC_BASE_URL=https://backend.prathamdigital.org/user/v1 -NEXT_PUBLIC_TELEMETRY_URL=https://telemetry.prathamdigital.org -NEXT_PUBLIC_MEASUREMENT_ID=G-GNMQZ8Z65Z -#NEXT_PUBLIC_TRACKING_API_URL=https://tracking.prathamdigital.org -#NEXT_PUBLIC_EVENT_BASE_URL=https://event.prathamdigital.org/event-service/event/v1 -#NEXT_PUBLIC_NOTIFICATION_BASE_URL=https://notification.prathamdigital.org -NEXT_PUBLIC_COURSE_PLANNER_API_URL=https://project.prathamdigital.org/project/v1 -NEXT_PUBLIC_SUNBIRDSAAS_API_URL=https://sunbirdsaas.com -NEXT_PUBLIC_SURVEY_URL=https://survey.prathamdigital.org/survey/v1 -NEXT_PUBLIC_RESET_PASSWORD_URL=https://dev-reset-password.prathamdigital.org -NEXT_PUBLIC_MIDDLEWARE_URL=https://middleware.prathamdigital.org -#NEXT_PUBLIC_ATTENDANCE_URL=https://middleware.prathamdigital.org/api/v1 -NEXT_PRIVATE_LOCAL_WEBPACK=true -WORKSPACE_BASE_URL=https://dev-workspace.prathamdigital.org -NEXT_PUBLIC_WORKSPACE_BASE_URL=https://dev-workspace.prathamdigital.org -NEXT_PUBLIC_FCM_API_KEY=AIzaSyCmhNz-HMkkf42QNmnf7pnZm49FP5g4INw -NEXT_PUBLIC_VAPID_KEY=BOZ_JkC62vr767LoC7APU26ZdGYW5htBkfqIEtsVX6zmE3Fi-XgcN_TggSaXKh5rGKcaa4vuQxaYiRPU2B955GI +# NEXT_PUBLIC_BASE_URL=https://qa.prathamteacherapp.tekdinext.com/user/v1 +NEXT_PUBLIC_BASE_URL=https://backend.prathamdigital.org/user/v1 +NEXT_PUBLIC_TELEMETRY_URL=https://qa.prathamteacherapp.tekdinext.com +NEXT_PUBLIC_NOTIFICATION_BASE_URL=https://notification.prathamdigital.org +# NEXT_PUBLIC_NOTIFICATION_BASE_URL=https://qa.prathamteacherapp.tekdinext.com/notification-service +NEXT_PUBLIC_COURSE_PLANNER_API_URL=https://courseplan.tekdinext.com/project/v1 +NEXT_PUBLIC_SUNBIRDSAAS_API_URL=https://sunbirdsaas.com \ No newline at end of file diff --git a/.github/workflows/prod-pratham-deployment.yaml b/.github/workflows/prod-pratham-deployment.yaml index 5f36b7a0..044b898b 100644 --- a/.github/workflows/prod-pratham-deployment.yaml +++ b/.github/workflows/prod-pratham-deployment.yaml @@ -1,61 +1,23 @@ -name: PROD FRONTEND DEPLOYMENT WITH TAG +name: Deployment on the Pratham-dev Frontend Server on: - push: - tags: - - 'v*' - + workflow_dispatch: jobs: - PROD-FRONTEND-TAG-BASE-DEPLOYMENT: + PRATHAM-DEV-DEPLOYMENT: runs-on: ubuntu-latest timeout-minutes: 15 steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set TAG environment variable - id: get_tag - run: | - # Extract the tag from the ref and set it as an environment variable - echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - - - name: Debug TAG value - run: | - # Print the TAG value to ensure the correct tag is being used - echo "TAG value - ${{ env.TAG }}" - - name: Deploy Stack uses: appleboy/ssh-action@master with: - host: ${{ secrets.HOST_NAME_PROD }} - username: ${{ secrets.USERNAME_PROD }} - key: ${{ secrets.SSH_KEY_PROD }} - port: ${{ secrets.PORT_PROD }} + host: ${{ secrets.HOST_NAME_DEV }} + username: ${{ secrets.USERNAME_DEV }} + key: ${{ secrets.EC2_SSH_KEY_DEV }} + port: ${{ secrets.PORT_DEV }} script: | - # Assign the TAG value from the environment variable - TAG="${{ env.TAG }}" - - # Define the target directory and environment file - TARGET_DIR="${{ secrets.TARGET_DIR_PROD }}" - ENVIRONMENT="$TARGET_DIR/.env" - - # Remove the existing .env file if it exists - if [ -f "$ENVIRONMENT" ]; then - rm "$ENVIRONMENT" + cd ${{ secrets.TARGET_DIR_DEV }} + if [ -f .env ]; then + rm .env fi - - # Create the target directory if it doesn't exist and write environment variables to .env - mkdir -p "$TARGET_DIR" - cat << EOF > "$ENVIRONMENT" - ${{ secrets.PROD_ENV }} - EOF - - # Navigate to the target directory - cd ${{ secrets.TARGET_DIR_PROD }} - - # List the contents of the directory for verification + echo "${{ secrets.DEV_ENV }}" > .env ls -ltra - - # Run the deployment script with the correct TAG - ./deploy.sh $TAG \ No newline at end of file + ./deploy.sh \ No newline at end of file From cd6ca6c8bee4f6d0a042e9887872f41fd96df6d2 Mon Sep 17 00:00:00 2001 From: Akshata Katwal <akshata.katwal@tekditechnologies.com> Date: Mon, 11 Nov 2024 16:55:35 +0530 Subject: [PATCH 07/10] update pr: remove unwanted file --- .../workflows/prod-pratham-deployment.yaml | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 .github/workflows/prod-pratham-deployment.yaml diff --git a/.github/workflows/prod-pratham-deployment.yaml b/.github/workflows/prod-pratham-deployment.yaml deleted file mode 100644 index 044b898b..00000000 --- a/.github/workflows/prod-pratham-deployment.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: Deployment on the Pratham-dev Frontend Server -on: - workflow_dispatch: -jobs: - PRATHAM-DEV-DEPLOYMENT: - runs-on: ubuntu-latest - timeout-minutes: 15 - steps: - - name: Deploy Stack - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.HOST_NAME_DEV }} - username: ${{ secrets.USERNAME_DEV }} - key: ${{ secrets.EC2_SSH_KEY_DEV }} - port: ${{ secrets.PORT_DEV }} - script: | - cd ${{ secrets.TARGET_DIR_DEV }} - if [ -f .env ]; then - rm .env - fi - echo "${{ secrets.DEV_ENV }}" > .env - ls -ltra - ./deploy.sh \ No newline at end of file From 2a1e266f0db7e508352c8a2abb1bed8cd6297107 Mon Sep 17 00:00:00 2001 From: suvarnakale <suvarna.kale@tekditechnologies.com> Date: Mon, 11 Nov 2024 18:21:27 +0530 Subject: [PATCH 08/10] Issue #PS-2326 feat : Tracking for content consumption activated in admin app --- next.config.mjs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/next.config.mjs b/next.config.mjs index 409f16cb..f845750b 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -77,6 +77,10 @@ const nextConfig = { source: "/action/asset/:path*", // Match other /action/asset routes destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/action/asset/:path*`, // Forward other /action/asset requests to proxy.js }, + { + source: "/action/v1/telemetry", // Match any URL starting with /workspace/content/assets/ + destination: `${process.env.NEXT_PUBLIC_TELEMETRY_URL}/v1/telemetry`, // Serve the assets from the public folder + }, { source: "/action/content/:path*", // Match other /action/asset routes destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/action/content/:path*`, // Forward other /action/asset requests to proxy.js From 767948a3b17dbc9f4f103804d65916824a734a71 Mon Sep 17 00:00:00 2001 From: suvarnakale <suvarna.kale@tekditechnologies.com> Date: Mon, 11 Nov 2024 18:23:28 +0530 Subject: [PATCH 09/10] Issue #PS-2326 feat : comments removed --- next.config.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index f845750b..0e649762 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -78,8 +78,8 @@ const nextConfig = { destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/action/asset/:path*`, // Forward other /action/asset requests to proxy.js }, { - source: "/action/v1/telemetry", // Match any URL starting with /workspace/content/assets/ - destination: `${process.env.NEXT_PUBLIC_TELEMETRY_URL}/v1/telemetry`, // Serve the assets from the public folder + source: "/action/v1/telemetry", + destination: `${process.env.NEXT_PUBLIC_TELEMETRY_URL}/v1/telemetry`, }, { source: "/action/content/:path*", // Match other /action/asset routes From cc6bf216aef9330cd3075a668b34bad3285d88f6 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 <rushikesh.sonawane@tekditechnologies.com> Date: Mon, 11 Nov 2024 19:52:57 +0530 Subject: [PATCH 10/10] Issue #PS-2321 chore: Added active text for active academic year in dropdown --- src/components/layouts/header/Header.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/layouts/header/Header.tsx b/src/components/layouts/header/Header.tsx index 7325738a..3e4f88e4 100644 --- a/src/components/layouts/header/Header.tsx +++ b/src/components/layouts/header/Header.tsx @@ -39,7 +39,14 @@ const Header = ({ sx, customClass, toggleMobileSidebar, position }: any) => { setLanguage(lang); const storedList = localStorage.getItem("academicYearList"); try { - setAcademicYearList(storedList ? JSON.parse(storedList) : []); + const parsedList = storedList ? JSON.parse(storedList) : []; + const modifiedList = parsedList.map((item: { isActive: any; session: any; }) => { + if (item.isActive) { + return { ...item, session: `${item.session} (${t('COMMON.ACTIVE')})` }; + } + return item; + }); + setAcademicYearList(modifiedList); const selectedAcademicYearId = localStorage.getItem("academicYearId"); setSelectedSessionId(selectedAcademicYearId ?? ""); } catch (error) {