Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…o issues/8759/breadcrumbs-consultation
  • Loading branch information
shauryag2002 committed Nov 19, 2024
2 parents 18141a8 + ea713df commit af1a663
Show file tree
Hide file tree
Showing 560 changed files with 10,826 additions and 13,670 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
{
"name": "care_fe",
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-18-bullseye",
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm",
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"moby": true,
Expand Down
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ ESLINT_NO_DEV_ERRORS=true
CARE_CDN_URL="https://egov-s3-facility-10bedicu.s3.amazonaws.com https://egov-s3-patient-data-10bedicu.s3.amazonaws.com http://localhost:4566"
REACT_ALLOWED_LOCALES="en,hi,ta,ml,mr,kn"

REACT_ENABLED_APPS="ohcnetwork/care_livekit_fe@main"
REACT_ENABLED_APPS=""
2 changes: 0 additions & 2 deletions .envrc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/auto-testing-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
}
if (isChangesRequired) {
await github.issues.createComment({
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Cypress Tests

on:
schedule:
- cron: "30 22 * * *"
pull_request:
branches:
- develop
Expand All @@ -17,9 +15,11 @@ jobs:
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5, 6, 7, 8]
containers: [1, 2, 3, 4]
env:
REACT_CARE_API_URL: http://localhost:9000
REACT_ENABLED_APPS: "ohcnetwork/care_hcx_fe@main"
REACT_ENABLE_HCX: true
steps:
- name: Checkout 📥
uses: actions/checkout@v3
Expand Down Expand Up @@ -116,7 +116,6 @@ jobs:
group: "UI-Chrome"
env:
CYPRESS_SPLIT_TESTS: "true"
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: --max_old_space_size=4096
COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}}
Expand All @@ -133,7 +132,7 @@ jobs:

- name: Upload cypress videos 📹
uses: actions/upload-artifact@v3
if: steps.pr_origin.outputs.is_forked == 'true'
if: ${{ failure() && steps.pr_origin.outputs.is_forked == 'true' }}
with:
name: cypress-videos
path: cypress/videos
path: cypress/videos
87 changes: 87 additions & 0 deletions .github/workflows/notify-non-core-qn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Notify Core Team on Non-Core Questions
on:
issue_comment:
types: [created]
permissions:
issues: write
pull-requests: write
jobs:
notify_core_team:
runs-on: ubuntu-latest
env:
ALLOWED_USERNAMES: ${{ vars.ALLOWED_USERNAMES }}
QUESTION_KEYWORDS: ${{ vars.QUESTION_KEYWORDS }}
QUESTION_LABELS: ${{ vars.QUESTION_LABELS }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
steps:
- name: Check and Notify
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
console.log('Script started');
const isOrgMember = (commenter, allowedUsers) => {
return allowedUsers.split(',').map(u => u.trim()).includes(commenter);
};
const containsQuestionKeywords = (text, keywords) => {
return keywords.split(',').map(k => k.trim()).some(keyword =>
text.toLowerCase().includes(keyword.toLowerCase())
);
};
const addLabelsToIssue = async (github, context, labelsString) => {
const labels = labelsString.split(',').map(label => label.trim()).filter(label => label);
if (labels.length > 0) {
console.log('Adding labels:', labels);
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
labels: labels
});
}
};
const sendSlackNotification = async (webhook, payload) => {
const response = await fetch(webhook, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
};
const commenter = context.payload.comment.user.login;
console.log('Commenter:', commenter);
if (!isOrgMember(commenter, process.env.ALLOWED_USERNAMES)) {
const commentBody = context.payload.comment.body;
const sanitizedComment = commentBody
?.replace(/[^\w\s?]/gi, '')
.toLowerCase();
console.log('Comment body:', sanitizedComment);
if (containsQuestionKeywords(sanitizedComment, process.env.QUESTION_KEYWORDS)) {
try {
console.log('Adding labels to the issue');
await addLabelsToIssue(github, context, process.env.QUESTION_LABELS);
console.log('Labels added successfully');
const issueUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/issues/${context.payload.issue.number}`;
const issueTitle = context.payload.issue.title;
const issueNumber = context.payload.issue.number;
console.log('Issue URL:', issueUrl);
console.log('Issue Title:', issueTitle);
console.log('Issue Number:', issueNumber);
const payload = {
link: issueUrl,
Question: commentBody,
"issue-number": issueNumber,
title: issueTitle,
user: commenter
};
await sendSlackNotification(process.env.SLACK_WEBHOOK, payload);
console.log('Slack notification sent successfully');
} catch (error) {
console.error('Workflow failed:', error.message);
core.setFailed(`Workflow failed: ${error.message}`);
}
}
}
console.log('Script ended');
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ cypress/fixtures/token.json
# Care Apps
/apps/*
src/pluginMap.ts
/apps_backup/*
36 changes: 0 additions & 36 deletions .husky/_/husky.sh

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20
v22
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

7 changes: 5 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
"jsxSingleQuote": false,
"arrowParens": "always",
"tailwindFunctions": ["classNames"],
"plugins": ["prettier-plugin-tailwindcss"]
}
"importOrder": ["<THIRD_PARTY_MODULES>", "^@/lib/(.*)$", "^@/CAREUI/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/hooks/(.*)$", "^@/common/(.*)$", "^@/(.*)$", "^[./]"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"plugins": ["prettier-plugin-tailwindcss", "@trivago/prettier-plugin-sort-imports"]
}
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
#build-stage
FROM --platform=$BUILDPLATFORM node:20-buster-slim as build-stage
FROM --platform=$BUILDPLATFORM node:22-bookworm-slim as build-stage

WORKDIR /app

ENV NODE_OPTIONS="--max-old-space-size=4096"

RUN apt-get update && apt-get install -y git

RUN if [ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "arm64" ]; then apt-get install -y python3-dev make g++; fi


COPY package.json package-lock.json ./

RUN npm install
Expand Down
3 changes: 1 addition & 2 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from "cypress";
import fs from "fs";
import cypressSplit from "cypress-split";
import fs from "fs";

export default defineConfig({
projectId: "wf7d2m",
Expand Down Expand Up @@ -30,7 +30,6 @@ export default defineConfig({
baseUrl: "http://localhost:4000",
retries: 2,
requestTimeout: 15000,
excludeSpecPattern: "**/*roles.cy.ts",
},
env: {
API_URL: process.env.REACT_CARE_API_URL ?? "http://localhost:9000",
Expand Down
18 changes: 10 additions & 8 deletions cypress/e2e/assets_spec/AssetHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import { AssetQRScanPage } from "../../pageobject/Asset/AssetQRScan";
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";
import { advanceFilters } from "pageobject/utils/advanceFilterHelpers";
import { v4 as uuidv4 } from "uuid";

import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
import { AssetQRScanPage } from "../../pageobject/Asset/AssetQRScan";
import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import LoginPage from "../../pageobject/Login/LoginPage";
import { v4 as uuidv4 } from "uuid";

describe("Asset Tab", () => {
const assetSearchPage = new AssetSearchPage();
Expand All @@ -18,7 +20,7 @@ describe("Asset Tab", () => {
const serialNumber = Math.floor(Math.random() * 10 ** 10).toString();

before(() => {
loginPage.loginAsDisctrictAdmin();
loginPage.loginAsDistrictAdmin();
cy.saveLocalStorage();
});

Expand Down Expand Up @@ -64,13 +66,13 @@ describe("Asset Tab", () => {
"ONVIF Camera",
"Camera Loc",
);
assetFilters.clickadvancefilter();
advanceFilters.clickAdvancedFiltersButton();
assetFilters.clickslideoverbackbutton(); // to verify the back button doesn't clear applied filters
assetFilters.assertFacilityText("Dummy Facility 40");
assetFilters.assertAssetClassText("ONVIF");
assetFilters.assertStatusText("ACTIVE");
assetFilters.assertLocationText("Camera Loc");
assetFilters.clickadvancefilter();
advanceFilters.clickAdvancedFiltersButton();
assetFilters.clearFilters();
});

Expand Down
7 changes: 4 additions & 3 deletions cypress/e2e/assets_spec/AssetsCreation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import { v4 as uuidv4 } from "uuid";
import LoginPage from "../../pageobject/Login/LoginPage";

import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import LoginPage from "../../pageobject/Login/LoginPage";

describe("Asset", () => {
const assetPage = new AssetPage();
Expand All @@ -11,7 +12,7 @@ describe("Asset", () => {
const serialNumber = Math.floor(Math.random() * 10 ** 10).toString();

before(() => {
loginPage.loginAsDisctrictAdmin();
loginPage.loginAsDistrictAdmin();
cy.saveLocalStorage();
});

Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/assets_spec/AssetsManage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import LoginPage from "../../pageobject/Login/LoginPage";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";
import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";
import LoginPage from "../../pageobject/Login/LoginPage";

function addDaysToDate(numberOfDays: number) {
const inputDate = new Date();
Expand All @@ -22,7 +22,7 @@ describe("Asset", () => {
const initiallocationName = "Camera Location";

before(() => {
loginPage.loginAsDisctrictAdmin();
loginPage.loginAsDistrictAdmin();
cy.saveLocalStorage();
});

Expand Down
17 changes: 0 additions & 17 deletions cypress/e2e/auth_spec/ForgotPassword.cy.ts

This file was deleted.

23 changes: 0 additions & 23 deletions cypress/e2e/auth_spec/auth.cy.ts

This file was deleted.

Loading

0 comments on commit af1a663

Please sign in to comment.