diff --git a/.env.cec-euprd b/.env.cec-euprd index 5fb535f..81bef6f 100644 --- a/.env.cec-euprd +++ b/.env.cec-euprd @@ -8,3 +8,10 @@ REACT_APP_OTA_SERVICE_URL=https://gw.cec-euprd.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://superset.cec-euprd.fiskerinc.com +REACT_APP_ROLE_CREATE=e92f2b3e-1b80-42e5-9483-8ae648224dc6 +REACT_APP_ROLE_READ_ONLY=9af2d8c0-c26d-4d6d-bbd1-ac53cbd37ebc +REACT_APP_ROLE_DELETE=bfd1cccc-213a-4f31-b3d1-6e685976aec8 +REACT_APP_ROLE_GENERATE_CERTIFICATE=9af2d8c0-c26d-4d6d-bbd1-ac53cbd37ebc +REACT_APP_ROLE_MANUFACTURE=3412e11a-a2d1-4355-be3e-ef9aa5065b69 +REACT_APP_ROLE_SUPPLIER_APPROVER=a6c9805e-80b2-42b2-bfbb-9df52e5504d8 +REACT_APP_ECCKEY_ENV= diff --git a/.env.cec-prd b/.env.cec-prd index 67d8f04..2baee03 100644 --- a/.env.cec-prd +++ b/.env.cec-prd @@ -8,3 +8,10 @@ REACT_APP_OTA_SERVICE_URL=https://gw.cec-prd.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://superset.cec-prd.fiskerinc.com +REACT_APP_ROLE_CREATE=e92f2b3e-1b80-42e5-9483-8ae648224dc6 +REACT_APP_ROLE_READ_ONLY=9af2d8c0-c26d-4d6d-bbd1-ac53cbd37ebc +REACT_APP_ROLE_DELETE=bfd1cccc-213a-4f31-b3d1-6e685976aec8 +REACT_APP_ROLE_GENERATE_CERTIFICATE=9af2d8c0-c26d-4d6d-bbd1-ac53cbd37ebc +REACT_APP_ROLE_MANUFACTURE=3412e11a-a2d1-4355-be3e-ef9aa5065b69 +REACT_APP_ROLE_SUPPLIER_APPROVER=a6c9805e-80b2-42b2-bfbb-9df52e5504d8 +REACT_APP_ECCKEY_ENV= diff --git a/.env.dev b/.env.dev index c2e91da..f984f2e 100644 --- a/.env.dev +++ b/.env.dev @@ -8,3 +8,10 @@ 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-new.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_ECCKEY_ENV=stage,prod diff --git a/.env.local b/.env.local index 3656474..94c1a10 100644 --- a/.env.local +++ b/.env.local @@ -8,4 +8,10 @@ REACT_APP_OTA_SERVICE_URL=http://localhost/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-new.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_ECCKEY_ENV=dev,stage,prod diff --git a/.env.prd b/.env.prd index f075c03..11f4e91 100644 --- a/.env.prd +++ b/.env.prd @@ -8,3 +8,10 @@ REACT_APP_OTA_SERVICE_URL=https://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://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_ECCKEY_ENV=stage diff --git a/.env.stg b/.env.stg index ad05398..41c4529 100644 --- a/.env.stg +++ b/.env.stg @@ -8,3 +8,10 @@ REACT_APP_OTA_SERVICE_URL=https://stg-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://stg-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_ECCKEY_ENV=prod diff --git a/.env.template b/.env.template index e42e4fd..3ddd694 100644 --- a/.env.template +++ b/.env.template @@ -8,3 +8,10 @@ REACT_APP_OTA_SERVICE_URL=http://localhost/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_ECCKEY_ENV=dev,stage,prod diff --git a/k8s/templates/deployment.yaml b/k8s/templates/deployment.yaml index d807e32..f4cab1c 100644 --- a/k8s/templates/deployment.yaml +++ b/k8s/templates/deployment.yaml @@ -24,12 +24,7 @@ spec: - name: {{ .Chart.Name }} image: "{{ .Values.image.registry }}/{{ .Values.image.name }}:{{ .Values.image.tag}}" resources: - requests: - cpu: {{ .Values.resources.requests.cpu }} - memory: {{ .Values.resources.requests.memory }} - limits: - cpu: {{ .Values.resources.limits.cpu }} - memory: {{ .Values.resources.limits.memory }} + {{- toYaml .Values.resources | nindent 12 }} env: # non-secret env vars {{- range $name, $value := $.Values.env }} diff --git a/k8s/values-cec-euprd.yaml b/k8s/values-cec-euprd.yaml index 12f9d4a..79af594 100644 --- a/k8s/values-cec-euprd.yaml +++ b/k8s/values-cec-euprd.yaml @@ -6,7 +6,7 @@ resources: cpu: 100m memory: 128Mi limits: - cpu: 250m + #cpu: 250m memory: 256Mi replicas: 3 diff --git a/k8s/values-cec-prd.yaml b/k8s/values-cec-prd.yaml index c2c8e18..579c364 100644 --- a/k8s/values-cec-prd.yaml +++ b/k8s/values-cec-prd.yaml @@ -6,7 +6,7 @@ resources: cpu: 100m memory: 128Mi limits: - cpu: 250m + #cpu: 250m memory: 256Mi replicas: 3 diff --git a/k8s/values-dev.yaml b/k8s/values-dev.yaml index 5885b55..6fb8400 100644 --- a/k8s/values-dev.yaml +++ b/k8s/values-dev.yaml @@ -6,7 +6,7 @@ resources: cpu: 100m memory: 128Mi limits: - cpu: 250m + #cpu: 250m memory: 256Mi replicas: 1 diff --git a/k8s/values-prd.yaml b/k8s/values-prd.yaml index 80d6163..64eb47d 100644 --- a/k8s/values-prd.yaml +++ b/k8s/values-prd.yaml @@ -6,7 +6,7 @@ resources: cpu: 100m memory: 128Mi limits: - cpu: 250m + #cpu: 250m memory: 256Mi replicas: 3 diff --git a/k8s/values-stg.yaml b/k8s/values-stg.yaml index efbbf2d..0ea9afb 100644 --- a/k8s/values-stg.yaml +++ b/k8s/values-stg.yaml @@ -6,7 +6,7 @@ resources: cpu: 100m memory: 128Mi limits: - cpu: 250m + #cpu: 250m memory: 256Mi replicas: 1 diff --git a/src/components/Controls/TRexLogs/index.jsx b/src/components/Controls/TRexLogs/index.jsx index 165c4ed..d1b44f7 100644 --- a/src/components/Controls/TRexLogs/index.jsx +++ b/src/components/Controls/TRexLogs/index.jsx @@ -128,7 +128,8 @@ const TRexLogsTable = ({ vin, token, classes }) => { const [logs, setLogs] = useState([]); const [pageIndex, setPageIndex] = useState(0); const [pageSize, setPageSize] = useState(DEFAULT_PAGE_SIZE); - const [selectedDate, setSelectedDate] = useState(new Date()); + const local_date = new Date() + const [selectedDate, setSelectedDate] = useState(new Date(local_date.getUTCFullYear(), local_date.getUTCMonth(), local_date.getUTCDate())); const [total, setTotal] = useState(0); const { setMessage } = useStatusContext(); @@ -140,7 +141,7 @@ const TRexLogsTable = ({ vin, token, classes }) => { return pageSize * pageIndex + pageSize } const getReadPercentage = () => { - return (currentOffset * 100 / blobSize).toFixed(2); + return (currentOffset * 100 / blobSize); } const getFilteredLogs = (logs) => { return logs.filter(log => currectLogLevels[log.level] === true) @@ -182,6 +183,19 @@ const TRexLogsTable = ({ vin, token, classes }) => { return fetched } + const downloadFile = async () => { + let day = formatTwoDigit(selectedDate.getDate()) + let month = formatTwoDigit(selectedDate.getMonth() + 1)// 0 Indexed + let year = selectedDate.getFullYear() + + let result = await api.getLogFileLink({ vin, year, month, day }, token) + window.open(result['Link'], '_blank') + } + + const formatTwoDigit = (num) => { + return num < 10 ? '0' + num : '' + num + } + useEffect(() => { (async () => { try { @@ -258,7 +272,7 @@ const TRexLogsTable = ({ vin, token, classes }) => { format="yyyy/MM/dd" margin="normal" id="date-picker-inline" - label="Choose date" + label="Choose date (UTC)" value={selectedDate} onChange={handleNewDate} KeyboardButtonProps={{ @@ -266,11 +280,12 @@ const TRexLogsTable = ({ vin, token, classes }) => { }} /> - + + { blobSize === 0 ? `No logs for ${fromatDateForRequest(selectedDate)}` : - `Read ${getReadPercentage()}% of logs` + `Read ${getReadPercentage().toFixed(2)}% of logs` } { { align="center" value={getReadPercentage()} /> } - +

+ + + @@ -293,7 +311,7 @@ const TRexLogsTable = ({ vin, token, classes }) => { - {getFilteredLogs(logs).slice(-getDesiredSize(), (pageIndex === 0 ? undefined : -(pageSize * pageIndex))).map((log, i) => ( + {getFilteredLogs(logs).slice(-getDesiredSize(), (pageIndex === 0 ? undefined : -(pageSize * pageIndex))).reverse().map((log, i) => ( {log.level} {log.trex_timestamp} diff --git a/src/components/DTCTimeline/DTCTimeline/index.jsx b/src/components/DTCTimeline/DTCTimeline/index.jsx index 2af0b2b..29eaf5b 100644 --- a/src/components/DTCTimeline/DTCTimeline/index.jsx +++ b/src/components/DTCTimeline/DTCTimeline/index.jsx @@ -1,15 +1,15 @@ import DateFnsUtils from '@date-io/date-fns'; -import { Button, CircularProgress, Grid, TableFooter, TablePagination, TableCell, Table, TableRow, TableBody} from "@material-ui/core"; +import { Button, CircularProgress, Grid, Table, TableBody, TableCell, TableFooter, TablePagination, TableRow } from "@material-ui/core"; import { KeyboardDatePicker, MuiPickersUtilsProvider } from '@material-ui/pickers'; +import clsx from "clsx"; import React, { useEffect, useState } from "react"; import { logger } from "../../../services/monitoring"; import { DTCTimelineProvider, useDTCTimelineContext } from '../../Contexts/DTCTimelineContext'; import { useStatusContext } from "../../Contexts/StatusContext"; import { useUserContext } from "../../Contexts/UserContext"; -import { useLocalStorage } from "../../useLocalStorage"; -import clsx from "clsx"; -import TableHeaderSortable from "../../Table/HeaderSortable"; import SearchField from '../../Controls/SearchField'; +import TableHeaderSortable from "../../Table/HeaderSortable"; +import { useLocalStorage } from "../../useLocalStorage"; import useStyles from "../../useStyles"; const MainForm = ({ vin }) => { @@ -41,8 +41,12 @@ const MainForm = ({ vin }) => { label: "ECU", }, { - id: "dtc", - label: "DTC", + id: "trouble_code", + label: "Trouble Code", + }, + { + id: "status_byte", + label: "Status Code", }, { id: "epoch_usec", @@ -190,7 +194,8 @@ const MainForm = ({ vin }) => { {dtc.vin} {dtc.ecu_name} - {dtc.dtc} + {dtc.trouble_code} + {dtc.status_byte} {formatDate(dtc.epoch_usec)} ))} @@ -216,7 +221,7 @@ const MainForm = ({ vin }) => { ); - + }; const DTCTimeline = (props) => ( diff --git a/src/components/Manifest/Update/__snapshots__/index.test.jsx.snap b/src/components/Manifest/Update/__snapshots__/index.test.jsx.snap index fa51235..9874fa0 100644 --- a/src/components/Manifest/Update/__snapshots__/index.test.jsx.snap +++ b/src/components/Manifest/Update/__snapshots__/index.test.jsx.snap @@ -218,6 +218,122 @@ exports[`Manifest Details Component Render 1`] = ` +
+ +
+ + + +
+
+
+ +
+ + + +
+