diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap
index 02bd570..8012769 100644
--- a/src/components/App/__snapshots__/App.test.js.snap
+++ b/src/components/App/__snapshots__/App.test.js.snap
@@ -11842,7 +11842,6 @@ exports[`App Route /vehicle-status authenticated 1`] = `
-
diff --git a/src/components/BulkActions/actions/DeleteVehicles.jsx b/src/components/BulkActions/actions/DeleteVehicles.jsx
deleted file mode 100644
index ede865d..0000000
--- a/src/components/BulkActions/actions/DeleteVehicles.jsx
+++ /dev/null
@@ -1,55 +0,0 @@
-import { forwardRef, useImperativeHandle } from "react";
-import { useStatusContext } from "../../Contexts/StatusContext";
-import { useUserContext } from "../../Contexts/UserContext";
-import TaskRunner from "../../../utils/taskRunner";
-import vehiclesAPI from "../../../services/vehiclesAPI";
-
-export default forwardRef(({
- ids,
- idCSV,
-}, ref) => {
- const { setMessage } = useStatusContext();
- const { token: { idToken: { jwtToken: token } } } = useUserContext();
-
- useImperativeHandle(ref, () => ({
- async submit() {
- return new Promise((resolve, reject) => {
- const taskRunner = new TaskRunner(5, ids.length);
- let errorCount = 0;
-
- const task = (vin, index) => {
- const progressMessage = `${index + 1}/${ids.length}`;
- return async () => vehiclesAPI.deleteVehicle(vin, token)
- .then((response) => {
- if (response.error) {
- errorCount += 1;
- setMessage(`${progressMessage} ${response.error}: ${response.message}`);
- } else {
- setMessage(`${progressMessage} Deleted ${vin}`);
- }
- return response;
- })
- .catch((error) => reject(error));
- }
-
- ids.forEach((vin, i) => {
- taskRunner.push(task(vin, i));
- });
-
- taskRunner.onComplete().then((responses) => {
- const completeMessage = `${ids.length - errorCount}/${ids.length}`;
- setMessage(`Successfully deleted ${completeMessage} vehicles.`);
- resolve(responses);
- });
- });
- },
- }));
-
- return (
-
-
- You are about to delete the following VINs: {idCSV}.
-
-
- );
-});
\ No newline at end of file
diff --git a/src/components/BulkActions/actions/DeleteVehicles.test.jsx b/src/components/BulkActions/actions/DeleteVehicles.test.jsx
deleted file mode 100644
index e453362..0000000
--- a/src/components/BulkActions/actions/DeleteVehicles.test.jsx
+++ /dev/null
@@ -1,40 +0,0 @@
-jest.mock("../../Contexts/UserContext");
-jest.mock("../../Contexts/StatusContext");
-jest.mock("../../../services/vehiclesAPI");
-
-import React from "react";
-import {
- render,
- act,
-} from "@testing-library/react";
-import { UserProvider, setToken } from "../../Contexts/UserContext";
-import { StatusProvider } from "../../Contexts/StatusContext";
-import { TEST_AUTH_OBJECT_FISKER } from "../../../utils/testing";
-import DeleteVehicles from "./DeleteVehicles";
-import vehiclesAPI from "../../../services/vehiclesAPI";
-
-describe("BulkActions/DeleteVehicles", () => {
- beforeAll(() => {
- setToken(TEST_AUTH_OBJECT_FISKER);
- });
-
- it("makes request to delete multiple vehicles", async () => {
- const api = jest.spyOn(vehiclesAPI, "deleteVehicle");
- const ref = React.createRef();
-
- render(
-
-
-
-
-
- );
-
- await act(async () => ref.current.submit());
- expect(api).toHaveBeenCalledTimes(3);
- });
-});
diff --git a/src/components/BulkActions/index.jsx b/src/components/BulkActions/index.jsx
index bdb8389..a65e917 100644
--- a/src/components/BulkActions/index.jsx
+++ b/src/components/BulkActions/index.jsx
@@ -9,7 +9,6 @@ import truncateCSV from "../../utils/truncateCSV";
// https://react.dev/reference/react/lazy
const AddTags = lazy(() => import("./actions/AddTags"));
const AddToFleet = lazy(() => import("./actions/AddToFleet"));
-const DeleteVehicles = lazy(() => import("./actions/DeleteVehicles"));
const UpdateConfig = lazy(() => import("./actions/UpdateConfig"));
const SendSMS = lazy(() => import("./actions/SendSMS"));
const Cancel = lazy(() => import("./actions/Cancel"));
@@ -41,12 +40,6 @@ export default function BulkActions({
disabled: false,
trigger: () => setActive("addToFleet"),
},
- {
- id: "deleteVehicles",
- name: "Delete",
- disabled: false,
- trigger: () => setActive("deleteVehicles"),
- },
{
id: "updateConfig",
name: "Update Config",
@@ -125,7 +118,6 @@ export default function BulkActions({
{active === "addTags" && }
{active === "addToFleet" && }
- {active === "deleteVehicles" && }
{active === "updateConfig" && }
{active === "sms" && }
{active === "cancel" && }
diff --git a/src/components/Cars/List/index.jsx b/src/components/Cars/List/index.jsx
index 57c36eb..51a617c 100644
--- a/src/components/Cars/List/index.jsx
+++ b/src/components/Cars/List/index.jsx
@@ -75,7 +75,7 @@ const MainForm = () => {
-
+
diff --git a/src/components/Cars/Status/Details/__snapshots__/index.test.jsx.snap b/src/components/Cars/Status/Details/__snapshots__/index.test.jsx.snap
index eff462a..2fb2974 100644
--- a/src/components/Cars/Status/Details/__snapshots__/index.test.jsx.snap
+++ b/src/components/Cars/Status/Details/__snapshots__/index.test.jsx.snap
@@ -203,7 +203,6 @@ exports[`VehicleDetailsTab Render 1`] = `
-
diff --git a/src/components/Cars/Status/Details/index.jsx b/src/components/Cars/Status/Details/index.jsx
index 27bb2f1..2048481 100644
--- a/src/components/Cars/Status/Details/index.jsx
+++ b/src/components/Cars/Status/Details/index.jsx
@@ -1,10 +1,8 @@
import { Box, Checkbox, FormControlLabel, Grid, Tooltip } from "@material-ui/core";
-import DeleteIcon from "@material-ui/icons/Delete";
import EditIcon from "@material-ui/icons/Edit";
import UploadIcon from '@mui/icons-material/Upload';
import clsx from "clsx";
import React, { useEffect, useState } from "react";
-import { Redirect } from "react-router";
import { Link } from "react-router-dom";
import { logger } from "../../../../services/monitoring";
@@ -16,16 +14,13 @@ import {
VehicleProvider
} from "../../../Contexts/VehicleContext";
import { RoleWrap } from "../../../Controls/RoleWrap";
-import DeleteConfirmation from "../../../DeleteConfirmation";
import GeneralConfirmation from "../../../GeneralConfirmation";
import useStyles from "../../../useStyles";
const MainForm = ({ vin }) => {
const classes = useStyles();
const { setMessage } = useStatusContext();
- const { vehicle, getVehicle, deleteVehicle, uploadConfig } = useVehicleContext();
- const [redirect, setRedirect] = useState(null);
- const [showDeleteModal, setShowDeleteModal] = useState(false);
+ const { vehicle, getVehicle, uploadConfig } = useVehicleContext();
const [showUploadConfigModal, setShowUploadConfigModal] = useState(false);
const [forced, setForced] = useState(false);
const {
@@ -55,17 +50,6 @@ const MainForm = ({ vin }) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [token]);
- const onDelete = async () => {
- try {
- await deleteVehicle(vin, token);
- setMessage(`Deleted ${vin}`);
- setRedirect(`/vehicles`);
- } catch (e) {
- setMessage(e.message);
- logger.warn(e.stack);
- }
- };
-
const onUploadConfig = async () => {
try {
await uploadConfig(vin, forced, token);
@@ -99,10 +83,6 @@ const MainForm = ({ vin }) => {
}
}
- if (redirect && redirect.length > 0) {
- return ;
- }
-
return (
@@ -232,25 +212,8 @@ const MainForm = ({ vin }) => {
-
-
- setShowDeleteModal(true)}>
-
-
-
-
- setShowDeleteModal(false)}
- deleteFunction={onDelete}
- />
-
diff --git a/src/components/Cars/Status/__snapshots__/index.test.jsx.snap b/src/components/Cars/Status/__snapshots__/index.test.jsx.snap
index 17a22f2..5529475 100644
--- a/src/components/Cars/Status/__snapshots__/index.test.jsx.snap
+++ b/src/components/Cars/Status/__snapshots__/index.test.jsx.snap
@@ -393,7 +393,6 @@ exports[`CarStatus Render 1`] = `
-
diff --git a/src/components/Contexts/VehicleContext.jsx b/src/components/Contexts/VehicleContext.jsx
index 909d7c3..c52d2fb 100644
--- a/src/components/Contexts/VehicleContext.jsx
+++ b/src/components/Contexts/VehicleContext.jsx
@@ -243,20 +243,6 @@ export const VehicleProvider = ({ children }) => {
}
}
- const deleteVehicle = async (vin, token) => {
- try {
- setBusy(true);
- validateVIN(vin);
-
- const result = await api.deleteVehicle(vin, token);
- if (result.error)
- throw new Error(`Delete vehicle error. ${result.message}`);
- return result;
- } finally {
- setBusy(false);
- }
- };
-
const getCANSignals = async (vin, token) => {
try {
setBusy(true);
@@ -313,7 +299,6 @@ export const VehicleProvider = ({ children }) => {
fleets,
totalFleets,
addVehicle,
- deleteVehicle,
getConnections,
getCANSignals,
getECUs,
diff --git a/src/components/Contexts/VehicleContext.test.jsx b/src/components/Contexts/VehicleContext.test.jsx
index bd58d34..10554cc 100644
--- a/src/components/Contexts/VehicleContext.test.jsx
+++ b/src/components/Contexts/VehicleContext.test.jsx
@@ -303,80 +303,6 @@ describe("VehicleContext", () => {
});
});
- describe("deleteVehicle", () => {
- beforeEach(async () => {
- const TestComp = () => {
- const { busy, deleteVehicle } = useVehicleContext();
- const { message, setMessage } = useStatusContext();
- const deleteV = async (name) => {
- try {
- await deleteVehicle(name);
- } catch (e) {
- setMessage(e.message);
- }
- };
-
- return (
- <>
- {message}
- {busy.toString()}
-
-
+
diff --git a/src/services/vehiclesAPI.js b/src/services/vehiclesAPI.js
index 398de0f..f40da4e 100644
--- a/src/services/vehiclesAPI.js
+++ b/src/services/vehiclesAPI.js
@@ -29,17 +29,6 @@ const vehiclesAPI = {
.then(fetchRespHandler)
.catch(errorHandler),
- deleteVehicle: async (vin, token) =>
- fetch(`${API_ENDPOINT}/vehicle/${vin}`, {
- method: "DELETE",
- headers: Object.assign(
- { "Content-Type": "application/json" },
- getAuthHeaderOptions(token)
- ),
- })
- .then(fetchRespHandler)
- .catch(errorHandler),
-
getConnections: async (vins, token) => {
const u = `${API_ENDPOINT}/carsconnected`;
return fetch(u, {