fix: check env

This commit is contained in:
Vu Khanh Du 2024-02-01 13:19:33 +07:00
parent 29b9595ff9
commit 1a1c546538
8 changed files with 52 additions and 33 deletions

View File

@ -20,6 +20,7 @@
"history": "^5.3.0",
"lodash-es": "^4.17.21",
"mousetrap": "^1.6.5",
"process": "^0.11.10",
"react": "^18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.0",
@ -41,7 +42,7 @@
"@tanstack/react-query-devtools": "^4.20.4",
"@types/babel-plugin-macros": "^2.8.4",
"@types/lodash-es": "^4.17.6",
"@types/node": "^18.11.18",
"@types/node": "^18.19.12",
"@types/react": "^18.0.20",
"@types/react-dom": "^18.0.10",
"@types/uuid": "^9.0.1",
@ -4418,9 +4419,9 @@
}
},
"node_modules/@types/node": {
"version": "18.19.11",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.11.tgz",
"integrity": "sha512-hzdHPKpDdp5bEcRq1XTlZ2ntVjLcHCTV73dEcGg02eSY/+9AZ+jlfz6i00+zOrunMWenjHuI49J8J7Y9uz50JQ==",
"version": "18.19.12",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.12.tgz",
"integrity": "sha512-uLcpWEAvatBEubmgCMzWforZbAu1dT9syweWnU3/DNwbeUBq2miP5nG8Y4JL9MDMKWt+7Yv1CSvA8xELdEl54w==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
@ -9491,6 +9492,14 @@
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
"dev": true
},
"node_modules/process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/prop-types": {
"version": "15.8.1",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",

View File

@ -2,8 +2,8 @@
"name": "sbt-ui",
"version": "0.1.0",
"scripts": {
"start": "npm run extract && npm run compile && vite --host",
"build": "npm run extract && npm run compile && tsc && vite build",
"start": "NODE_ENV=development npm run extract && npm run compile && vite --host",
"build": "NODE_ENV=production npm run extract && npm run compile && tsc && vite build",
"serve": "vite preview",
"extract": "lingui extract --clean",
"compile": "lingui compile",
@ -38,6 +38,7 @@
"history": "^5.3.0",
"lodash-es": "^4.17.21",
"mousetrap": "^1.6.5",
"process": "^0.11.10",
"react": "^18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.0",
@ -59,7 +60,7 @@
"@tanstack/react-query-devtools": "^4.20.4",
"@types/babel-plugin-macros": "^2.8.4",
"@types/lodash-es": "^4.17.6",
"@types/node": "^18.11.18",
"@types/node": "^18.19.12",
"@types/react": "^18.0.20",
"@types/react-dom": "^18.0.10",
"@types/uuid": "^9.0.1",

View File

@ -108,10 +108,10 @@ const columns: TableColumnsType<DataType> = [
key: 'snImeiAAR',
width: '130px',
render: (_, record) => {
const isAbnormal = record.snImeiAAR < 98;
const isAbnormal = record.snImeiAAR * 100 < 98;
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{record.snImeiAAR.toFixed(2)}
{(record.snImeiAAR * 100).toFixed(2)}
</span>
);
},
@ -122,10 +122,10 @@ const columns: TableColumnsType<DataType> = [
key: 'purchaseDateAAR',
width: '130px',
render: (_, record) => {
const isAbnormal = record.purchaseDateAAR < 98;
const isAbnormal = record.purchaseDateAAR * 100 < 98;
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{record.purchaseDateAAR.toFixed(2)}
{(record.purchaseDateAAR * 100).toFixed(2)}
</span>
);
},
@ -136,10 +136,10 @@ const columns: TableColumnsType<DataType> = [
key: 'retailerNameAAR',
width: '130px',
render: (_, record) => {
const isAbnormal = record.retailerNameAAR < 98;
const isAbnormal = record.retailerNameAAR * 100 < 98;
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{record.retailerNameAAR.toFixed(2)}
{(record.retailerNameAAR * 100).toFixed(2)}
</span>
);
},
@ -356,10 +356,10 @@ const ReportOverViewTable: React.FC<ReportOverViewTableProps> = ({
key: 'snImeiAAR',
width: '130px',
render: (_, record) => {
const isAbnormal = record.snImeiAAR < 98;
const isAbnormal = record.snImeiAAR * 100 < 98;
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{record.snImeiAAR.toFixed(2)}
{(record.snImeiAAR * 100).toFixed(2)}
</span>
);
},
@ -370,10 +370,10 @@ const ReportOverViewTable: React.FC<ReportOverViewTableProps> = ({
key: 'purchaseDateAAR',
width: '130px',
render: (_, record) => {
const isAbnormal = record.purchaseDateAAR < 98;
const isAbnormal = record.purchaseDateAAR * 100 < 98;
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{record.purchaseDateAAR.toFixed(2)}
{(record.purchaseDateAAR * 100).toFixed(2)}
</span>
);
},
@ -384,10 +384,10 @@ const ReportOverViewTable: React.FC<ReportOverViewTableProps> = ({
key: 'retailerNameAAR',
width: '130px',
render: (_, record) => {
const isAbnormal = record.retailerNameAAR < 98;
const isAbnormal = record.retailerNameAAR * 100 < 98;
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{record.retailerNameAAR.toFixed(2)}
{(record.retailerNameAAR * 100).toFixed(2)}
</span>
);
},

View File

@ -7,7 +7,6 @@
"Download Report": "Download Report",
"Email format is not correct": "Email format is not correct",
"English": "English",
"Go to Report page": "Go to Report page",
"Language": "Language",
"Login": "Login",
"Logout": "Logout",

View File

@ -7,7 +7,6 @@
"Download Report": "",
"Email format is not correct": "Định dạng email không hợp lệ",
"English": "Tiếng Anh",
"Go to Report page": "",
"Language": "Ngôn ngữ",
"Login": "Đăng nhập",
"Logout": "Đăng xuất",

View File

@ -81,11 +81,11 @@ const columns: TableColumnsType<ReportItemDetail> = [
dataIndex: 'IMEI1 Accuracy',
key: 'IMEI1 Accuracy',
render: (_, record) => {
const isAbnormal = Number(record['IMEI1 Accuracy']) < 25;
const isAbnormal = Number(record['IMEI1 Accuracy']) * 100 < 25;
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{record['IMEI1 Accuracy'] &&
Number(record['IMEI1 Accuracy']).toFixed(2)}
(Number(record['IMEI1 Accuracy']) * 100).toFixed(2)}
</span>
);
},
@ -106,11 +106,12 @@ const columns: TableColumnsType<ReportItemDetail> = [
dataIndex: 'Invoice_Purchase Date Accuracy',
key: 'Invoice_Purchase Date Accuracy',
render: (_, record) => {
const isAbnormal = Number(record['Invoice_Purchase Date Accuracy']) < 25;
const isAbnormal =
Number(record['Invoice_Purchase Date Accuracy']) * 100 < 25;
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{record['Invoice_Purchase Date Accuracy'] &&
Number(record['Invoice_Purchase Date Accuracy']).toFixed(2)}
(Number(record['Invoice_Purchase Date Accuracy']) * 100).toFixed(2)}
</span>
);
},
@ -131,11 +132,11 @@ const columns: TableColumnsType<ReportItemDetail> = [
dataIndex: 'Invoice_Retailer Accuracy',
key: 'Invoice_Retailer Accuracy',
render: (_, record) => {
const isAbnormal = Number(record['Invoice_Retailer Accuracy']) < 25;
const isAbnormal = Number(record['Invoice_Retailer Accuracy']) * 100 < 25;
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{record['Invoice_Retailer Accuracy'] &&
Number(record['Invoice_Retailer Accuracy']).toFixed(2)}
(Number(record['Invoice_Retailer Accuracy']) * 100).toFixed(2)}
</span>
);
},
@ -145,11 +146,11 @@ const columns: TableColumnsType<ReportItemDetail> = [
dataIndex: 'Retailer_Revised Accuracy',
key: 'Retailer_Revised Accuracy',
render: (_, record) => {
const isAbnormal = Number(record['Retailer_Revised Accuracy']) < 25;
const isAbnormal = Number(record['Retailer_Revised Accuracy']) * 100 < 25;
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{record['Retailer_Revised Accuracy'] &&
Number(record['Retailer_Revised Accuracy']).toFixed(2)}
(Number(record['Retailer_Revised Accuracy']) * 100).toFixed(2)}
</span>
);
},
@ -159,11 +160,11 @@ const columns: TableColumnsType<ReportItemDetail> = [
dataIndex: 'OCR Image Accuracy',
key: 'OCR Image Accuracy',
render: (_, record) => {
const isAbnormal = Number(record['OCR Image Accuracy']) < 25;
const isAbnormal = Number(record['OCR Image Accuracy']) * 100 < 25;
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{record['OCR Image Accuracy'] &&
Number(record['OCR Image Accuracy']).toFixed(2)}
(Number(record['OCR Image Accuracy']) * 100).toFixed(2)}
</span>
);
},

View File

@ -3,22 +3,26 @@ import { t } from '@lingui/macro';
import { notification } from 'antd';
import axios, { AxiosError, HttpStatusCode } from 'axios';
import { getLocale } from 'i18n';
import process from 'process';
import { queryClient } from 'queries';
import { ErrorData } from 'utils/error-handler';
const environment = process.env.NODE_ENV;
const AXIOS_TIMEOUT_MS = 30 * 60 * 1000; // This config sastified long-live upload file request
const EXPIRED_PASSWORD_SIGNAL = 'expired_password';
export const API = axios.create({
timeout: AXIOS_TIMEOUT_MS,
baseURL: 'http://42.96.42.13:9000/api',
baseURL:
environment === 'development' ? 'http://42.96.42.13:9000/api' : '/api',
maxContentLength: Number.MAX_SAFE_INTEGER,
maxBodyLength: Number.MAX_SAFE_INTEGER,
});
export const PublicAPI = axios.create({
timeout: AXIOS_TIMEOUT_MS,
baseURL: 'http://42.96.42.13:9000/api',
baseURL:
environment === 'development' ? 'http://42.96.42.13:9000/api' : '/api',
});
// interceptor to handle locale header

6
node_modules/.package-lock.json generated vendored Normal file
View File

@ -0,0 +1,6 @@
{
"name": "sbt-idp",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}