diff --git a/.env b/.env new file mode 100644 index 0000000..cd20510 --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +VITE_DASHBOARD_API_URL=https://sr-backend-api.takeleap.in +VITE_AUDIT_API_URL=https://sr-audit.takeleap.in diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..89d5901 --- /dev/null +++ b/.env.production @@ -0,0 +1,2 @@ +VITE_DASHBOARD_API_URL=https://python.seekright.com +VITE_AUDIT_API_URL=https://node-audit.seekright.com diff --git a/dist-seekright.zip b/dist-seekright.zip new file mode 100644 index 0000000..8605616 Binary files /dev/null and b/dist-seekright.zip differ diff --git a/src/api/accountService.ts b/src/api/accountService.ts index b318f10..c15cc57 100644 --- a/src/api/accountService.ts +++ b/src/api/accountService.ts @@ -13,7 +13,7 @@ export const accountService = { }, getOrganizations: async () => { - const response = await axiosClient.get('/api/audit/account/organizations'); - return response; + const response = await axiosClient.get('/api/audit/account/organizations'); + return response; } }; diff --git a/src/api/axiosClient.ts b/src/api/axiosClient.ts index 0f85e3d..bbd65d1 100644 --- a/src/api/axiosClient.ts +++ b/src/api/axiosClient.ts @@ -22,6 +22,17 @@ axiosClient.interceptors.request.use( if (user?.db_name) { config.params = { ...config.params, dbName: user.db_name }; } + + // Automatically rewrite local proxy paths to the real URLs from environment variables + // This allows us to remove the Vite/Nginx proxy completely! + if (config.url?.startsWith('/api/dashboard')) { + const dashboardUrl = import.meta.env.VITE_DASHBOARD_API_URL || 'https://sr-backend-api.takeleap.in'; + config.url = config.url.replace('/api/dashboard', dashboardUrl); + } else if (config.url?.startsWith('/api/audit')) { + const auditUrl = import.meta.env.VITE_AUDIT_API_URL || 'https://sr-audit.takeleap.in'; + config.url = config.url.replace('/api/audit', auditUrl); + } + return config; }, (error) => Promise.reject(error) diff --git a/src/components/common/BulkDeleteDialog.tsx b/src/components/common/BulkDeleteDialog.tsx index 59b466d..3dac128 100644 --- a/src/components/common/BulkDeleteDialog.tsx +++ b/src/components/common/BulkDeleteDialog.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import { - Dialog, DialogContent, Typography, Box, IconButton, Button, + Dialog, DialogContent, Typography, Box, Button, TextField, RadioGroup, FormControlLabel, Radio, Checkbox, CircularProgress, Select, MenuItem } from '@mui/material'; @@ -250,7 +250,7 @@ export const BulkDeleteDialog: React.FC = ({ open, onClos sx={{ color: '#64748b', '&.Mui-checked': { color: '#3b82f6' } }} /> } - label={SELECT ALL} + label={SELECT ALL} sx={{ width: '100%', m: 0 }} /> @@ -272,7 +272,7 @@ export const BulkDeleteDialog: React.FC = ({ open, onClos sx={{ color: '#64748b', '&.Mui-checked, &.MuiCheckbox-indeterminate': { color: '#3b82f6' } }} /> } - label={{type.type_name.replace(/_/g, ' ')}} + label={{type.type_name.replace(/_/g, ' ')}} sx={{ width: '100%', m: 0 }} /> diff --git a/src/pages/activity-feeds/GlobalFeed.tsx b/src/pages/activity-feeds/GlobalFeed.tsx index eb7e78f..c74ea24 100644 --- a/src/pages/activity-feeds/GlobalFeed.tsx +++ b/src/pages/activity-feeds/GlobalFeed.tsx @@ -80,6 +80,7 @@ export const GlobalFeed: React.FC = () => { isTrueFalse: isRectActive ? 'both' : (auditStatus === 'False Audits' ? 'true' : 'both'), auto_audit: isRectActive ? '' : (auditStatus === 'Auto Audits' ? 'true' : (auditStatus === 'Manual' ? 'false' : '')), isRectificationEnabled: isRectActive, + sortByDateAsc: false, anomalyIds: searchAnomalyId, plaza: filterPlaza, assetsIds: assetIdsKey, @@ -131,6 +132,7 @@ export const GlobalFeed: React.FC = () => { isTrueFalse: isRectActive ? 'both' : (auditStatus === 'False Audits' ? 'true' : 'both'), auto_audit: isRectActive ? '' : (auditStatus === 'Auto Audits' ? 'true' : (auditStatus === 'Manual' ? 'false' : '')), isRectificationEnabled: isRectActive, + sortByDateAsc: false, anomalyIds: searchAnomalyId, plaza: filterPlaza, assetsIds: assetIdsKey, diff --git a/src/pages/audit-session/AuditSession.tsx b/src/pages/audit-session/AuditSession.tsx index ad013c6..46bae18 100644 --- a/src/pages/audit-session/AuditSession.tsx +++ b/src/pages/audit-session/AuditSession.tsx @@ -141,7 +141,6 @@ export const AuditSession: React.FC = () => { const nextPage = (activeTab.page || 0) + 1; const selectedSiteId = selectedSite?.site_id ?? ''; const assetIdsKey = selectedAssetIds.join(','); - const isReviewMode = location.state?.isReviewMode; const feedPageSize = activeTab.rowsPerPage || 20; const res: any = await activityFeedsService.getHistory({ diff --git a/src/pages/dashboard/Dashboard.tsx b/src/pages/dashboard/Dashboard.tsx index 44a8fed..4d96199 100644 --- a/src/pages/dashboard/Dashboard.tsx +++ b/src/pages/dashboard/Dashboard.tsx @@ -34,6 +34,7 @@ export const Dashboard: React.FC = () => { batchAudited: 0, batchPending: 0, batchAnomaliesFound: 0, + firstPendingIndex: -1, } ); // Only show loading spinner if there's no cached result for these filters @@ -106,7 +107,6 @@ export const Dashboard: React.FC = () => { fetchStats(); }, [currentFilterKey]); // eslint-disable-line react-hooks/exhaustive-deps - const progressPercent = stats.batchTotal > 0 ? Math.round((stats.batchAudited / stats.batchTotal) * 100) : 0; return ( diff --git a/src/store/feedStore.ts b/src/store/feedStore.ts index 01909f5..a792f91 100644 --- a/src/store/feedStore.ts +++ b/src/store/feedStore.ts @@ -32,6 +32,7 @@ interface DashboardCache { batchAudited: number; batchPending: number; batchAnomaliesFound: number; + firstPendingIndex: number; } | null; } diff --git a/vite.config.ts b/vite.config.ts index ff4e70e..96c2044 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,25 +5,10 @@ import react from '@vitejs/plugin-react' export default defineConfig({ plugins: [react()], server: { - proxy: { - '/api/dashboard': { - target: 'https://sr-backend-api.takeleap.in', - changeOrigin: true, - rewrite: (path) => path.replace(/^\/api\/dashboard/, ''), - headers: { - Origin: 'https://auditor-qa.seekright.com', - Referer: 'https://auditor-qa.seekright.com/' - } - }, - '/api/audit': { - target: 'https://sr-audit.takeleap.in', - changeOrigin: true, - rewrite: (path) => path.replace(/^\/api\/audit/, ''), - headers: { - Origin: 'https://auditor-qa.seekright.com', - Referer: 'https://auditor-qa.seekright.com/' - } - }, - }, + allowedHosts: true, + // Reverse proxy is no longer needed since endpoints allow CORS natively + }, + preview: { + allowedHosts: true, }, })