perf(logs): remove console.log
This commit is contained in:
@@ -27,7 +27,9 @@ NODE_ENV=production REACT_APP_ENV=test pnpm run build
|
|||||||
```
|
```
|
||||||
|
|
||||||
- `config/proxy_prod.ts` resolves targets dynamically based on the current hostname; adjust rules there if deployment hosts change.
|
- `config/proxy_prod.ts` resolves targets dynamically based on the current hostname; adjust rules there if deployment hosts change.
|
||||||
- `config/request_prod.ts` prepends the API base URL from `ApiConfigService`, while the dev file leaves relative paths untouched.
|
- Request pipelines differ per mode:
|
||||||
|
- `config/request_dev.ts` keeps relative URLs so calls pass through the dev proxy setup (use when mocking/pointing to LAN services).
|
||||||
|
- `config/request_prod.ts` builds absolute URLs from `ApiConfigService` so static builds call the correct host without relying on the proxy.
|
||||||
|
|
||||||
## Verifying Builds
|
## Verifying Builds
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const getCurrentIP = () => {
|
|||||||
hostname.startsWith('192.168.') ||
|
hostname.startsWith('192.168.') ||
|
||||||
hostname.startsWith('10.')
|
hostname.startsWith('10.')
|
||||||
) {
|
) {
|
||||||
console.log('Host name: ', hostname);
|
// console.log('Host name: ', hostname);
|
||||||
|
|
||||||
return hostname;
|
return hostname;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export const handleRequestConfig: RequestConfig = {
|
|||||||
errorConfig: {
|
errorConfig: {
|
||||||
// Error throwing
|
// Error throwing
|
||||||
errorThrower: (res: any) => {
|
errorThrower: (res: any) => {
|
||||||
console.log('Response from backend:', res);
|
// console.log('Response from backend:', res);
|
||||||
const { success, data, errorCode, errorMessage, showType } = res;
|
const { success, data, errorCode, errorMessage, showType } = res;
|
||||||
if (!success) {
|
if (!success) {
|
||||||
const error: any = new Error(errorMessage);
|
const error: any = new Error(errorMessage);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export const handleRequestConfig: RequestConfig = {
|
|||||||
errorConfig: {
|
errorConfig: {
|
||||||
// Error throwing
|
// Error throwing
|
||||||
errorThrower: (res: any) => {
|
errorThrower: (res: any) => {
|
||||||
console.log('Response from backend:', res);
|
// console.log('Response from backend:', res);
|
||||||
const { success, data, errorCode, errorMessage, showType } = res;
|
const { success, data, errorCode, errorMessage, showType } = res;
|
||||||
if (!success) {
|
if (!success) {
|
||||||
const error: any = new Error(errorMessage);
|
const error: any = new Error(errorMessage);
|
||||||
@@ -68,7 +68,7 @@ export const handleRequestConfig: RequestConfig = {
|
|||||||
// Request interceptors
|
// Request interceptors
|
||||||
requestInterceptors: [
|
requestInterceptors: [
|
||||||
(url: string, options: any) => {
|
(url: string, options: any) => {
|
||||||
console.log('URL Request:', url, options);
|
// console.log('URL Request:', url, options);
|
||||||
|
|
||||||
// Nếu URL không phải absolute URL, thêm base URL
|
// Nếu URL không phải absolute URL, thêm base URL
|
||||||
let finalUrl = url;
|
let finalUrl = url;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default function useAlarmModel() {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const res = await queryAlarms(); // đổi URL cho phù hợp
|
const res = await queryAlarms(); // đổi URL cho phù hợp
|
||||||
console.log('Alarm Data fetched:', res);
|
// console.log('Alarm Data fetched:', res);
|
||||||
|
|
||||||
setAlarmData(res || []);
|
setAlarmData(res || []);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -163,10 +163,10 @@ class MapManager {
|
|||||||
this.initZoomListener();
|
this.initZoomListener();
|
||||||
this.isInitialized = true;
|
this.isInitialized = true;
|
||||||
|
|
||||||
console.log(
|
// console.log(
|
||||||
'Map initialized successfully at',
|
// 'Map initialized successfully at',
|
||||||
new Date().toLocaleTimeString(),
|
// new Date().toLocaleTimeString(),
|
||||||
);
|
// );
|
||||||
|
|
||||||
this.map.on('singleclick', (evt: any) => {
|
this.map.on('singleclick', (evt: any) => {
|
||||||
const featuresAtPixel: {
|
const featuresAtPixel: {
|
||||||
@@ -188,12 +188,12 @@ class MapManager {
|
|||||||
if (this.features.includes(feature)) {
|
if (this.features.includes(feature)) {
|
||||||
this.onFeatureClick(feature);
|
this.onFeatureClick(feature);
|
||||||
this.onFeatureSelect(feature, evt.pixel);
|
this.onFeatureSelect(feature, evt.pixel);
|
||||||
console.log(
|
// console.log(
|
||||||
'Feature clicked at',
|
// 'Feature clicked at',
|
||||||
new Date().toLocaleTimeString(),
|
// new Date().toLocaleTimeString(),
|
||||||
':',
|
// ':',
|
||||||
feature.getProperties(),
|
// feature.getProperties(),
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.onFeaturesClick(featuresAtPixel.map((f) => f.feature));
|
this.onFeaturesClick(featuresAtPixel.map((f) => f.feature));
|
||||||
@@ -366,7 +366,7 @@ class MapManager {
|
|||||||
strokeColor = 'rgba(255, 0, 0, 0.8)',
|
strokeColor = 'rgba(255, 0, 0, 0.8)',
|
||||||
strokeWidthBase = 0.25,
|
strokeWidthBase = 0.25,
|
||||||
} = config;
|
} = config;
|
||||||
console.log('Starting animatedMarker with config:', config);
|
// console.log('Starting animatedMarker with config:', config);
|
||||||
|
|
||||||
const flashGeom = feature.getGeometry()?.clone() as Point | undefined;
|
const flashGeom = feature.getGeometry()?.clone() as Point | undefined;
|
||||||
if (!flashGeom || !this.featureLayer) {
|
if (!flashGeom || !this.featureLayer) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ const ShipInfo: React.FC<ShipInfoProps> = ({ isOpen, setIsOpen }) => {
|
|||||||
const fetchShipData = async () => {
|
const fetchShipData = async () => {
|
||||||
try {
|
try {
|
||||||
const resp = await getShipInfo();
|
const resp = await getShipInfo();
|
||||||
console.log('Ship Info Response:', resp);
|
// console.log('Ship Info Response:', resp);
|
||||||
return resp;
|
return resp;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching ship data:', error);
|
console.error('Error fetching ship data:', error);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ const SosButton: React.FC<SosButtonProps> = ({ onRefresh }) => {
|
|||||||
console.error('Failed to delete SOS:', error);
|
console.error('Failed to delete SOS:', error);
|
||||||
message.error(t('sos.cancelError'));
|
message.error(t('sos.cancelError'));
|
||||||
}
|
}
|
||||||
console.log('Sending SOS without message');
|
// console.log('Sending SOS without message');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ const SosButton: React.FC<SosButtonProps> = ({ onRefresh }) => {
|
|||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
onFinish={async (values) => {
|
onFinish={async (values) => {
|
||||||
console.log('Form Values: ', values);
|
// console.log('Form Values: ', values);
|
||||||
|
|
||||||
// Nếu chọn "Khác" thì lấy messageOther, ngược lại lấy message
|
// Nếu chọn "Khác" thì lấy messageOther, ngược lại lấy message
|
||||||
const finalMessage =
|
const finalMessage =
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const VietNamMap: React.FC<VietNamMapProps> = React.memo(
|
|||||||
const mapRef = useRef<HTMLDivElement>(null);
|
const mapRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('useEffect in VietNamMap triggered');
|
// console.log('useEffect in VietNamMap triggered');
|
||||||
let manager = mapManager;
|
let manager = mapManager;
|
||||||
|
|
||||||
if (!manager) {
|
if (!manager) {
|
||||||
@@ -38,10 +38,10 @@ const VietNamMap: React.FC<VietNamMapProps> = React.memo(
|
|||||||
manager!.mapRef = mapRef;
|
manager!.mapRef = mapRef;
|
||||||
if (!manager!.map) {
|
if (!manager!.map) {
|
||||||
manager!.initializeMap();
|
manager!.initializeMap();
|
||||||
console.log(
|
// console.log(
|
||||||
'Initialized new MapManager instance at',
|
// 'Initialized new MapManager instance at',
|
||||||
new Date().toLocaleTimeString(),
|
// new Date().toLocaleTimeString(),
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
} else if (retryCount < maxRetries) {
|
} else if (retryCount < maxRetries) {
|
||||||
console.error('mapRef.current is not ready, retrying...');
|
console.error('mapRef.current is not ready, retrying...');
|
||||||
@@ -55,7 +55,7 @@ const VietNamMap: React.FC<VietNamMapProps> = React.memo(
|
|||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
console.log('Cleanup in VietNamMap triggered');
|
// console.log('Cleanup in VietNamMap triggered');
|
||||||
// Không gọi destroy ở đây để tránh phá hủy bản đồ không cần thiết
|
// Không gọi destroy ở đây để tránh phá hủy bản đồ không cần thiết
|
||||||
};
|
};
|
||||||
}, [mapManager, onFeatureClick, onFeatureSelect, onFeaturesClick, onError]);
|
}, [mapManager, onFeatureClick, onFeatureSelect, onFeaturesClick, onError]);
|
||||||
|
|||||||
@@ -63,12 +63,12 @@ const HomePage: React.FC = () => {
|
|||||||
const hasCenteredRef = useRef(false);
|
const hasCenteredRef = useRef(false);
|
||||||
const onFeatureClick = useCallback((feature: any) => {
|
const onFeatureClick = useCallback((feature: any) => {
|
||||||
console.log('OnClick Feature: ', feature);
|
console.log('OnClick Feature: ', feature);
|
||||||
console.log(
|
// console.log(
|
||||||
'Clicked ship at',
|
// 'Clicked ship at',
|
||||||
new Date().toLocaleTimeString(),
|
// new Date().toLocaleTimeString(),
|
||||||
'Properties:',
|
// 'Properties:',
|
||||||
feature.getProperties(),
|
// feature.getProperties(),
|
||||||
);
|
// );
|
||||||
}, []);
|
}, []);
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const onFeaturesClick = useCallback((features: any[]) => {
|
const onFeaturesClick = useCallback((features: any[]) => {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const CreateNewHaulOrTrip: React.FC<CreateNewHaulOrTripProps> = ({
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const gpsData = await getGPS();
|
const gpsData = await getGPS();
|
||||||
console.log('GPS Data:', gpsData);
|
// console.log('GPS Data:', gpsData);
|
||||||
|
|
||||||
const body: API.NewFishingLogRequest = {
|
const body: API.NewFishingLogRequest = {
|
||||||
trip_id: trips?.id || '',
|
trip_id: trips?.id || '',
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ const CreateOrUpdateFishingLog: React.FC<CreateOrUpdateFishingLogProps> = ({
|
|||||||
try {
|
try {
|
||||||
const resp = await getFishSpecies();
|
const resp = await getFishSpecies();
|
||||||
setFishDatas(resp);
|
setFishDatas(resp);
|
||||||
console.log('Fetched fish species:', resp);
|
// console.log('Fetched fish species:', resp);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching fish species:', error);
|
console.error('Error fetching fish species:', error);
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ const CreateOrUpdateFishingLog: React.FC<CreateOrUpdateFishingLogProps> = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getAllFish();
|
getAllFish();
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
console.log('Modal opened with fishingLogs:', fishingLogs);
|
// console.log('Modal opened with fishingLogs:', fishingLogs);
|
||||||
|
|
||||||
if (fishingLogs?.info && fishingLogs.info.length > 0) {
|
if (fishingLogs?.info && fishingLogs.info.length > 0) {
|
||||||
const dataWithKeys: FishingLogInfoWithKey[] = fishingLogs.info.map(
|
const dataWithKeys: FishingLogInfoWithKey[] = fishingLogs.info.map(
|
||||||
@@ -158,8 +158,8 @@ const CreateOrUpdateFishingLog: React.FC<CreateOrUpdateFishingLogProps> = ({
|
|||||||
async function createOrCreateOrUpdateFishingLog(
|
async function createOrCreateOrUpdateFishingLog(
|
||||||
fishingLog: FishingLogInfoWithKey[],
|
fishingLog: FishingLogInfoWithKey[],
|
||||||
) {
|
) {
|
||||||
console.log('Is finished:', isFinished);
|
// console.log('Is finished:', isFinished);
|
||||||
console.log('Trip:', trip);
|
// console.log('Trip:', trip);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const gpsData = await getGPS();
|
const gpsData = await getGPS();
|
||||||
@@ -167,8 +167,8 @@ const CreateOrUpdateFishingLog: React.FC<CreateOrUpdateFishingLogProps> = ({
|
|||||||
if (isFinished === false) {
|
if (isFinished === false) {
|
||||||
// Tạo mẻ mới
|
// Tạo mẻ mới
|
||||||
const logStatus0 = trip.fishing_logs?.find((log) => log.status === 0);
|
const logStatus0 = trip.fishing_logs?.find((log) => log.status === 0);
|
||||||
console.log('ok', logStatus0);
|
// console.log('ok', logStatus0);
|
||||||
console.log('ok', fishingLog);
|
// console.log('ok', fishingLog);
|
||||||
const body: API.FishingLog = {
|
const body: API.FishingLog = {
|
||||||
fishing_log_id: logStatus0?.fishing_log_id || '',
|
fishing_log_id: logStatus0?.fishing_log_id || '',
|
||||||
trip_id: trip.id,
|
trip_id: trip.id,
|
||||||
@@ -192,8 +192,8 @@ const CreateOrUpdateFishingLog: React.FC<CreateOrUpdateFishingLogProps> = ({
|
|||||||
})),
|
})),
|
||||||
sync: true,
|
sync: true,
|
||||||
};
|
};
|
||||||
const resp = await updateFishingLogs(body);
|
await updateFishingLogs(body);
|
||||||
console.log('Resp', resp);
|
// console.log('Resp', resp);
|
||||||
|
|
||||||
onFinished?.(true);
|
onFinished?.(true);
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
@@ -223,8 +223,8 @@ const CreateOrUpdateFishingLog: React.FC<CreateOrUpdateFishingLogProps> = ({
|
|||||||
};
|
};
|
||||||
// console.log('Update body:', body);
|
// console.log('Update body:', body);
|
||||||
|
|
||||||
const resp = await updateFishingLogs(body);
|
await updateFishingLogs(body);
|
||||||
console.log('Resp', resp);
|
// console.log('Resp', resp);
|
||||||
|
|
||||||
onFinished?.(true);
|
onFinished?.(true);
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ const HaulTable: React.FC<HaulTableProps> = ({ hauls, trip }) => {
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
console.log('Rendering action column for record:', record);
|
// console.log('Rendering action column for record:', record);
|
||||||
return (
|
return (
|
||||||
<Flex align="center" justify="center" gap={5}>
|
<Flex align="center" justify="center" gap={5}>
|
||||||
{/* Nút Edit */}
|
{/* Nút Edit */}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ const TripCostTable: React.FC<TripCostTableProps> = ({ tripCosts }) => {
|
|||||||
);
|
);
|
||||||
const trip_cost_columns: ProColumns<API.TripCost>[] = [
|
const trip_cost_columns: ProColumns<API.TripCost>[] = [
|
||||||
{
|
{
|
||||||
|
key: 'type',
|
||||||
title: (
|
title: (
|
||||||
<div style={{ textAlign: 'center' }}>
|
<div style={{ textAlign: 'center' }}>
|
||||||
{intl.formatMessage({ id: 'trip.cost.type' })}
|
{intl.formatMessage({ id: 'trip.cost.type' })}
|
||||||
@@ -34,6 +35,7 @@ const TripCostTable: React.FC<TripCostTableProps> = ({ tripCosts }) => {
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
key: 'amount',
|
||||||
title: (
|
title: (
|
||||||
<div style={{ textAlign: 'center' }}>
|
<div style={{ textAlign: 'center' }}>
|
||||||
{intl.formatMessage({ id: 'trip.cost.amount' })}
|
{intl.formatMessage({ id: 'trip.cost.amount' })}
|
||||||
@@ -43,6 +45,7 @@ const TripCostTable: React.FC<TripCostTableProps> = ({ tripCosts }) => {
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
key: 'unit',
|
||||||
title: (
|
title: (
|
||||||
<div style={{ textAlign: 'center' }}>
|
<div style={{ textAlign: 'center' }}>
|
||||||
{intl.formatMessage({ id: 'trip.cost.unit' })}
|
{intl.formatMessage({ id: 'trip.cost.unit' })}
|
||||||
@@ -52,6 +55,7 @@ const TripCostTable: React.FC<TripCostTableProps> = ({ tripCosts }) => {
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
key: 'cost_per_unit',
|
||||||
title: (
|
title: (
|
||||||
<div style={{ textAlign: 'center' }}>
|
<div style={{ textAlign: 'center' }}>
|
||||||
{intl.formatMessage({ id: 'trip.cost.price' })}
|
{intl.formatMessage({ id: 'trip.cost.price' })}
|
||||||
@@ -62,6 +66,7 @@ const TripCostTable: React.FC<TripCostTableProps> = ({ tripCosts }) => {
|
|||||||
render: (val: any) => (val ? Number(val).toLocaleString() : ''),
|
render: (val: any) => (val ? Number(val).toLocaleString() : ''),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
key: 'total_cost',
|
||||||
title: (
|
title: (
|
||||||
<div style={{ textAlign: 'center' }}>
|
<div style={{ textAlign: 'center' }}>
|
||||||
{intl.formatMessage({ id: 'trip.cost.total' })}
|
{intl.formatMessage({ id: 'trip.cost.total' })}
|
||||||
@@ -79,6 +84,7 @@ const TripCostTable: React.FC<TripCostTableProps> = ({ tripCosts }) => {
|
|||||||
];
|
];
|
||||||
return (
|
return (
|
||||||
<ProTable<API.TripCost>
|
<ProTable<API.TripCost>
|
||||||
|
rowKey="trip-cost-table"
|
||||||
columns={trip_cost_columns}
|
columns={trip_cost_columns}
|
||||||
dataSource={tripCosts}
|
dataSource={tripCosts}
|
||||||
search={false}
|
search={false}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const DetailTrip = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
console.log('Rendering with tripInfo:', data),
|
// console.log('Rendering with tripInfo:', data),
|
||||||
(
|
(
|
||||||
<PageContainer
|
<PageContainer
|
||||||
header={{
|
header={{
|
||||||
@@ -140,13 +140,6 @@ const DetailTrip = () => {
|
|||||||
<MainTripBody
|
<MainTripBody
|
||||||
trip_id={data?.id}
|
trip_id={data?.id}
|
||||||
tripInfo={data || null}
|
tripInfo={data || null}
|
||||||
onReload={(isReload) => {
|
|
||||||
console.log('Nhanaj dduowcj hàm, onReload:', isReload);
|
|
||||||
|
|
||||||
// if (isReload) {
|
|
||||||
// fetchTrip();
|
|
||||||
// }
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</ProCard>
|
</ProCard>
|
||||||
</ProCard>
|
</ProCard>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { API_PATH_LOGIN } from '@/constants';
|
|||||||
import { request } from '@umijs/max';
|
import { request } from '@umijs/max';
|
||||||
|
|
||||||
export async function login(body: API.LoginRequestBody) {
|
export async function login(body: API.LoginRequestBody) {
|
||||||
console.log('Login request body:', body);
|
// console.log('Login request body:', body);
|
||||||
|
|
||||||
return request<API.LoginResponse>(API_PATH_LOGIN, {
|
return request<API.LoginResponse>(API_PATH_LOGIN, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
Reference in New Issue
Block a user