feature/IO-2924-Refactor-Production-Board-For-Sockets - Checkpoint

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-09-16 11:48:17 -04:00
parent a2d95dbce3
commit 5c54cf6c44
7 changed files with 30 additions and 29 deletions

View File

@@ -20,7 +20,7 @@ export function DmsAllocationsSummaryAp({ bodyshop, billids, title }) {
const { socket } = useContext(SocketContext);
useEffect(() => {
if (!socket) return;
if (!socket || !socket.connected) return;
const handleSuccess = async (billid) => {
setAllocationsSummary((allocationsSummary) =>
@@ -45,21 +45,10 @@ export function DmsAllocationsSummaryAp({ bodyshop, billids, title }) {
}
};
const handleFailure = ({ billid, error }) => {
setAllocationsSummary((allocationsSummary) =>
allocationsSummary.map((a) => {
if (a.billid !== billid) return a;
return { ...a, status: error };
})
);
};
socket.on("ap-export-success", handleSuccess);
socket.on("ap-export-failure", handleFailure);
return () => {
socket.off("ap-export-success", handleSuccess);
socket.off("ap-export-failure", handleFailure);
};
}, [socket]);

View File

@@ -24,7 +24,7 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId, title }) {
const [allocationsSummary, setAllocationsSummary] = useState([]);
useEffect(() => {
if (socket.connected) {
if (socket && socket.connected) {
socket.emit("cdk-calculate-allocations", jobId, (ack) => {
setAllocationsSummary(ack);
socket.allocationsSummary = ack;

View File

@@ -60,7 +60,7 @@ export function DmsContainer({ setBreadcrumbs, setSelectedHeader }) {
{
timestamp: new Date(),
level: "WARNING",
message: "Reconnected to CDK Export Service"
message: "Reconnected to DMS Export Service"
}
]);
};

View File

@@ -90,7 +90,7 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
{
timestamp: new Date(),
level: "WARNING",
message: "Reconnected to CDK Export Service"
message: "Reconnected to DMS Export Service"
}
]);
};
@@ -201,7 +201,7 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
<Select.Option key="WARNING">WARNING</Select.Option>
<Select.Option key="ERROR">ERROR</Select.Option>
</Select>
4<Button onClick={() => setLogs([])}>Clear Logs</Button>
<Button onClick={() => setLogs([])}>Clear Logs</Button>
<Button
onClick={() => {
setLogs([]);

View File

@@ -24,6 +24,7 @@ import UpdateAlert from "../../components/update-alert/update-alert.component";
import InstanceRenderManager from "../../utils/instanceRenderMgr.js";
import "./manage.page.styles.scss";
import SocketContext from "../../contexts/SocketIO/socketContext.jsx";
import { requestForToken } from "../../firebase/firebase.utils.js";
const JobsPage = lazy(() => import("../jobs/jobs.page"));
@@ -112,6 +113,17 @@ export function Manage({ conflict, bodyshop }) {
const [chatVisible] = useState(false);
const { socket, clientId } = useContext(SocketContext);
useEffect(() => {
const widgetId = InstanceRenderManager({
imex: "IABVNO4scRKY11XBQkNr",
rome: "mQdqARMzkZRUVugJ6TdS"
});
window.noticeable.render("widget", widgetId);
requestForToken().catch((error) => {
console.error(`Unable to request for token.`, error);
});
}, []);
useEffect(() => {
document.title = InstanceRenderManager({
imex: t("titles.imexonline"),