From 4317440b94623a21b2bcdb56c25e420091dd8e2e Mon Sep 17 00:00:00 2001 From: leonardomeireles55 Date: Thu, 16 Jan 2025 14:42:53 -0300 Subject: [PATCH] feat: update API base URLs for development and production; add level selection to analytics table --- .env.development | 4 ++-- .github/workflows/docker-image-ci.yml | 29 +++++++++++++++++++++++++++ src/pages/analytics-table.tsx | 26 +++++++++++++++++++++++- 3 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/docker-image-ci.yml diff --git a/.env.development b/.env.development index 84eb668..d88fa22 100644 --- a/.env.development +++ b/.env.development @@ -1,6 +1,6 @@ NODE_ENV=development -# NEXT_PUBLIC_API_BASE_URL=http://localhost:8080 -NEXT_PUBLIC_API_BASE_URL=https://leomeireles-dev.xyz/backend-api +NEXT_PUBLIC_API_BASE_URL=http://localhost:8080 +# NEXT_PUBLIC_API_BASE_URL=https://leomeireles-dev.xyz/backend-api NEXT_PUBLIC_API_BASE_URL_REPORTS=date-range? diff --git a/.github/workflows/docker-image-ci.yml b/.github/workflows/docker-image-ci.yml new file mode 100644 index 0000000..685d5fa --- /dev/null +++ b/.github/workflows/docker-image-ci.yml @@ -0,0 +1,29 @@ +name: Docker Image CI + +on: + push: + branches: [ "feature/actions" ] + pull_request: + branches: [ "feature/actions" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Log in to Docker Hub + run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin + - name: Build and push Docker image + run: | + docker-compose build + docker-compose push \ No newline at end of file diff --git a/src/pages/analytics-table.tsx b/src/pages/analytics-table.tsx index de44eb2..a443437 100644 --- a/src/pages/analytics-table.tsx +++ b/src/pages/analytics-table.tsx @@ -29,11 +29,16 @@ const AnalyticsTable = () => { const [analyticsType, setAnalyticsType] = useState('biochemistry-analytics'); + const [level, setLevel] = useState('1'); + + const [isFiltered, setFiltered] = useState(true); + const [dataFetched, setDataFetched] = useState([]); + const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(null); - const url = `${process.env.NEXT_PUBLIC_API_BASE_URL}/${analyticsType}/date-range?startDate=${formatDateWithTime(startYear, startMonth, startDay)}&endDate=${formatEndDateWithTime(endYear, endMonth, endDay)}`; + const url = isFiltered ? `${process.env.NEXT_PUBLIC_API_BASE_URL}/${analyticsType}/level-date-range?level=${level}&startDate=${formatDateWithTime(startYear, startMonth, startDay)}&endDate=${formatEndDateWithTime(endYear, endMonth, endDay)}` : `${process.env.NEXT_PUBLIC_API_BASE_URL}/${analyticsType}/date-range?startDate=${formatDateWithTime(startYear, startMonth, startDay)}&endDate=${formatEndDateWithTime(endYear, endMonth, endDay)}`; useEffect(() => { const fetchData = async () => { @@ -73,6 +78,12 @@ const AnalyticsTable = () => { { value: 'coagulation-analytics', label: 'COAGULATION' }, ]; + const levelOptions = [ + { value: 'PCCC1', label: 'PCCC1' }, + { value: '2', label: 'Level 2' }, + { value: '3', label: 'Level 3' }, + ] + return (
@@ -115,6 +126,19 @@ const AnalyticsTable = () => { ))} +