Compare commits
10 Commits
58472e1707
...
33da34151d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33da34151d | ||
|
|
283eb1de25 | ||
|
|
5c3c1a8761 | ||
|
|
41edea6176 | ||
|
|
42f52faeba | ||
|
|
4f0f075e32 | ||
|
|
c1009cca64 | ||
|
|
f7c1fa9d20 | ||
|
|
62f81936d5 | ||
|
|
99c079cdea |
23
.env.mini
Normal file
23
.env.mini
Normal file
@@ -0,0 +1,23 @@
|
||||
REACT_APP_AUTH_CALLBACK_URL=https://ota-admin.mini.cloud.fiskerinc.com
|
||||
REACT_APP_AUTH_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/compute_auth
|
||||
REACT_APP_CERT_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/certificate
|
||||
REACT_APP_ENV=mini
|
||||
REACT_APP_MAGNA_PROVIDER=Magna
|
||||
REACT_APP_MAGNA_GROUP_ID=68273225-9da4-4fa7-aea5-38e16ec471fe
|
||||
REACT_APP_OTA_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/ota_update
|
||||
REACT_APP_SECURITY_DLL_URL=https://assets.fiskerdps.com/cloud-supplier/fisker_security_32.dll
|
||||
REACT_APP_SECURITY_DLL_64_URL=https://assets.fiskerdps.com/cloud-supplier/fisker_security_64.dll
|
||||
REACT_APP_SUPERSET_URL=https://dev-superset.cloud.fiskerinc.com
|
||||
REACT_APP_ROLE_CREATE=efcc3025-e2d8-4212-8227-805c7be39d2c
|
||||
REACT_APP_ROLE_READ_ONLY=a729bbd4-2038-4649-9127-16782bb1e701
|
||||
REACT_APP_ROLE_DELETE=8f78dce7-f5f9-4033-a10c-c9c7408bfcfe
|
||||
REACT_APP_ROLE_GENERATE_CERTIFICATE=746f34b0-9ba0-4b5d-8d84-0256a9c8e390
|
||||
REACT_APP_ROLE_MANUFACTURE=3412e11a-a2d1-4355-be3e-ef9aa5065b69
|
||||
REACT_APP_ROLE_SUPPLIER_APPROVER=a6c9805e-80b2-42b2-bfbb-9df52e5504d8
|
||||
REACT_APP_ROLE_MANIFEST_MIGRATION=42798c8a-9fa7-4fb4-82c0-9582cabe364f
|
||||
REACT_APP_ROLE_CAR_DIAGNOSTIC=2914e67f-fb85-4b78-b79d-656f4f37faa1
|
||||
REACT_APP_ROLE_UPDATE_DEPLOY=3590ec3f-1c05-428b-81a4-40b00baf83de
|
||||
REACT_APP_ECCKEY_ENV=stage,prod
|
||||
REACT_APP_HOME_MAP_DEFAULT_LOCATION={"lat":37.0902,"lng":-95.7129,"zoom":4.5}
|
||||
REACT_APP_ENABLE_DEBUGMASK=1
|
||||
REACT_APP_SHOW_AFTERSALES_EU_CERT_BUTTON=1
|
||||
4
.github/workflows/deploy.yml
vendored
4
.github/workflows/deploy.yml
vendored
@@ -135,7 +135,7 @@ jobs:
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
build-args: ENVIRONMENT=prd
|
||||
build-args: ENVIRONMENT=preprod
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-prd
|
||||
cache-from: type=gha
|
||||
@@ -177,7 +177,7 @@ jobs:
|
||||
--set image.registry=$REGISTRY \
|
||||
--set image.name=$PROJECT \
|
||||
--set image.tag=$TAG-prd \
|
||||
--wait -i -f k8s/values-prd.yaml $PROJECT k8s/
|
||||
--wait -i -f k8s/values-preprod.yaml $PROJECT k8s/
|
||||
|
||||
- name: Deploy Response
|
||||
run: echo "Response was ${{ steps.deploy.outputs.response }}"
|
||||
|
||||
@@ -2,12 +2,12 @@ apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||||
cert-manager.io/cluster-issuer: {{ .Values.ingress.clusterIssuer | default "letsencrypt-prod" }}
|
||||
labels:
|
||||
app: {{ .Chart.Name }}
|
||||
name: {{ .Chart.Name }}
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
ingressClassName: {{ .Values.ingress.className | default "nginx" }}
|
||||
rules:
|
||||
- host: {{ .Values.ingress.hostname }}
|
||||
http:
|
||||
|
||||
17
k8s/values-mini.yaml
Normal file
17
k8s/values-mini.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
ingress:
|
||||
hostname: ota-admin.mini.cloud.fiskerinc.com
|
||||
className: traefik
|
||||
|
||||
image:
|
||||
registry: gitea.mini.cloud.fiskerinc.com
|
||||
name: admin/ota-admin-portal
|
||||
tag: latest
|
||||
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
memory: 256Mi
|
||||
|
||||
replicas: 1
|
||||
@@ -51,9 +51,10 @@
|
||||
"build": "env-cmd -f .env.local react-scripts build",
|
||||
"build:dev": "env-cmd -f .env.dev react-scripts build",
|
||||
"build:stg": "env-cmd -f .env.stg react-scripts build",
|
||||
"build:prd": "env-cmd -f .env.prd react-scripts build",
|
||||
"build:preprod": "env-cmd -f .env.prd react-scripts build",
|
||||
"build:cec-prd": "env-cmd -f .env.cec-prd react-scripts build",
|
||||
"build:cec-euprd": "env-cmd -f .env.cec-euprd react-scripts build",
|
||||
"build:mini": "env-cmd -f .env.mini react-scripts build",
|
||||
"build:local": "env-cmd -f .env.local react-scripts build",
|
||||
"test": "env-cmd -f .env.local react-scripts test --no-cache",
|
||||
"test:debug": "react-scripts --inspect-brk test --runInBand --no-cache",
|
||||
|
||||
@@ -4,6 +4,8 @@ jest.mock("../../Contexts/UserContext");
|
||||
jest.mock("@material-ui/core/utils/unstable_useId", () =>
|
||||
jest.fn().mockReturnValue("mui-test-id")
|
||||
);
|
||||
jest.useFakeTimers();
|
||||
jest.setSystemTime(new Date(2024, 6, 18, 6, 30, 45, 100));
|
||||
|
||||
import { BrowserRouter } from "react-router-dom";
|
||||
import { VehicleProvider } from "../../Contexts/VehicleContext";
|
||||
|
||||
@@ -105,7 +105,7 @@ const transformLogs = (logs) =>
|
||||
})
|
||||
.flat()
|
||||
|
||||
const fromatDateForRequest = (date) => {
|
||||
const formatDateForRequest = (date) => {
|
||||
const getYear = date.toLocaleString("default", { year: "numeric" });
|
||||
const getMonth = date.toLocaleString("default", { month: "2-digit" });
|
||||
const getDay = date.toLocaleString("default", { day: "2-digit" });
|
||||
@@ -120,7 +120,7 @@ const TRexLogsTable = ({ vin, token, classes }) => {
|
||||
const [allLogsFetched, setAllLogsFetched] = useState(false)
|
||||
const [blobSize, setBlobSize] = useState(0)
|
||||
const [currentOffset, setCurrentOffset] = useState(0)
|
||||
const [currectLogLevels, setCurrentLogLevels] = useState({
|
||||
const [currentLogLevels, setCurrentLogLevels] = useState({
|
||||
trace: true,
|
||||
debug: true,
|
||||
info: true,
|
||||
@@ -139,7 +139,7 @@ const TRexLogsTable = ({ vin, token, classes }) => {
|
||||
|
||||
let controller = new AbortController()
|
||||
const readBlob = async (offset, count) => {
|
||||
return await api.getTRexLogs(vin, search, fromatDateForRequest(selectedDate), offset, count, "UP", token, controller)
|
||||
return await api.getTRexLogs(vin, search, formatDateForRequest(selectedDate), offset, count, "UP", token, controller)
|
||||
}
|
||||
const getDesiredSize = () => {
|
||||
return pageSize * pageIndex + pageSize
|
||||
@@ -148,7 +148,7 @@ const TRexLogsTable = ({ vin, token, classes }) => {
|
||||
return (currentOffset * 100 / blobSize);
|
||||
}
|
||||
const getFilteredLogs = (logs) => {
|
||||
return logs.filter(log => currectLogLevels[log.level] === true)
|
||||
return logs.filter(log => currentLogLevels[log.level] === true)
|
||||
}
|
||||
const fetchAllLogs = async () => {
|
||||
let fetched = []
|
||||
@@ -167,7 +167,7 @@ const TRexLogsTable = ({ vin, token, classes }) => {
|
||||
fetched = transformLogs(result.data).concat(fetched)
|
||||
setLogs(fetched)
|
||||
if (offset >= result.blobSize) {
|
||||
setMessage(`All log for ${fromatDateForRequest(selectedDate)} fetched`)
|
||||
setMessage(`All T.Rex logs for ${formatDateForRequest(selectedDate)} fetched`)
|
||||
setAllLogsFetched(true)
|
||||
break
|
||||
}
|
||||
@@ -175,12 +175,15 @@ const TRexLogsTable = ({ vin, token, classes }) => {
|
||||
|
||||
if (fetched.length === 0) {
|
||||
if (logs.length !== 0) {
|
||||
setMessage(`No more T.Rex logs for ${fromatDateForRequest(selectedDate)}`)
|
||||
setMessage(`No more T.Rex logs for ${formatDateForRequest(selectedDate)}`)
|
||||
return
|
||||
}
|
||||
setTotal(0)
|
||||
const msg = `Cannot fetch logs for ${fromatDateForRequest(selectedDate)}`
|
||||
setMessage(msg)
|
||||
if (fetched.error) {
|
||||
setMessage(`Error fetching T.Rex logs for ${formatDateForRequest(selectedDate)}`)
|
||||
} else {
|
||||
setMessage(`No T.Rex logs for ${formatDateForRequest(selectedDate)}`)
|
||||
}
|
||||
return
|
||||
}
|
||||
setCurrentOffset(offset)
|
||||
@@ -221,7 +224,7 @@ const TRexLogsTable = ({ vin, token, classes }) => {
|
||||
})();
|
||||
return () => controller?.abort()
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [vin, token, search, pageIndex, pageSize, selectedDate, currectLogLevels]);
|
||||
}, [vin, token, search, pageIndex, pageSize, selectedDate, currentLogLevels]);
|
||||
|
||||
const handleChangePageSize = (event) => {
|
||||
setPageSize(parseInt(event.target.value, 10));
|
||||
@@ -241,13 +244,20 @@ const TRexLogsTable = ({ vin, token, classes }) => {
|
||||
const handleNewFilter = (event) => {
|
||||
setPageIndex(0)
|
||||
setCurrentLogLevels({
|
||||
...currectLogLevels,
|
||||
...currentLogLevels,
|
||||
[event.target.defaultValue]: event.target.checked,
|
||||
});
|
||||
};
|
||||
|
||||
const handleSearch = (query) => {
|
||||
if (query !== search) {
|
||||
setPageIndex(0);
|
||||
setCurrentOffset(0)
|
||||
setLogs([])
|
||||
setAllLogsFetched(false)
|
||||
setBlobSize(0)
|
||||
setSearch(query);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -299,7 +309,7 @@ const TRexLogsTable = ({ vin, token, classes }) => {
|
||||
|
||||
<TableCell align="center">
|
||||
{
|
||||
blobSize === 0 ? `No logs for ${fromatDateForRequest(selectedDate)}` :
|
||||
blobSize === 0 ? `No logs for ${formatDateForRequest(selectedDate)}` :
|
||||
`Read ${getReadPercentage().toFixed(2)}% of logs`
|
||||
}
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user