Skip to content

Commit

Permalink
feat: update API base URLs for development and production; add level …
Browse files Browse the repository at this point in the history
…selection to analytics table
  • Loading branch information
LeonardoMeireles55 committed Jan 16, 2025
1 parent 81761c6 commit 4317440
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .env.development
Original file line number Diff line number Diff line change
@@ -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?
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/docker-image-ci.yml
Original file line number Diff line number Diff line change
@@ -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
26 changes: 25 additions & 1 deletion src/pages/analytics-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ const AnalyticsTable = () => {

const [analyticsType, setAnalyticsType] = useState<string>('biochemistry-analytics');

const [level, setLevel] = useState<string>('1');

const [isFiltered, setFiltered] = useState<boolean>(true);

const [dataFetched, setDataFetched] = useState<ListingItem[]>([]);

const [isLoading, setIsLoading] = useState<boolean>(false);
const [error, setError] = useState<string | null>(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 () => {
Expand Down Expand Up @@ -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 (
<div className='min-h bg-background'>
<div className='min-h flex flex-col content-center items-center justify-center'>
Expand Down Expand Up @@ -115,6 +126,19 @@ const AnalyticsTable = () => {
</option>
))}
</select>
<label htmlFor='level' className='text-textSecondary'>
<select
id='level'
className='mt-1 rounded border border-borderColor bg-background text-textSecondary md:px-2 md:py-1 md:text-sm focus:outline-none focus:ring-2 focus:ring-borderColor/30'
value={level}
onChange={(e) => setLevel(e.target.value)}>
{levelOptions.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</select>
</label>
</div>
</div>
</div>
Expand Down

0 comments on commit 4317440

Please sign in to comment.