Compare commits

...

6 Commits

6 changed files with 169 additions and 40 deletions

View File

@@ -1,30 +1,31 @@
import {useEffect, useState} from "react"; //import {useEffect, useState} from "react";
import {LstCard} from "../extendedUI/LstCard"; import {LstCard} from "../extendedUI/LstCard";
import {CardContent, CardHeader} from "../ui/card"; import {CardContent, CardHeader} from "../ui/card";
import {Skeleton} from "../ui/skeleton"; import {Skeleton} from "../ui/skeleton";
import {Button} from "../ui/button"; import {Button} from "../ui/button";
import {toast} from "sonner";
export default function CycleCountLog() { export default function CycleCountLog() {
const [logs, setLogs] = useState([]); //const [logs, setLogs] = useState([]);
const [streaming, setStreaming] = useState(false); // Track if streaming is active //const [streaming, setStreaming] = useState(false); // Track if streaming is active
useEffect(() => { // useEffect(() => {
// Start streaming when the button is clicked // // Start streaming when the button is clicked
let es; // let es;
es = new EventSource("http://localhost:4000/api/logger/logs/stream?service=ocme-count&level=info"); // es = new EventSource("http://localhost:4000/api/logger/logs/stream?service=ocme-count&level=info");
es.onopen = () => console.log(">>> Connection opened!"); // es.onopen = () => console.log(">>> Connection opened!");
es.onerror = (e) => console.log("ERROR!", e); // es.onerror = (e) => console.log("ERROR!", e);
es.onmessage = (e) => { // es.onmessage = (e) => {
console.log(">>>", JSON.stringify(e)); // console.log(">>>", JSON.stringify(e));
}; // };
return () => es.close(); // return () => es.close();
}, []); // Effect runs when `streaming` state changes // }, []); // Effect runs when `streaming` state changes
const handleStartStreaming = () => { // const handleStartStreaming = () => {
setStreaming(true); // Start streaming when button is clicked // setStreaming(true); // Start streaming when button is clicked
}; // };
return ( return (
<LstCard className="w-48"> <LstCard className="w-48">
<CardHeader className="flex justify-center"> <CardHeader className="flex justify-center">
@@ -39,7 +40,7 @@ export default function CycleCountLog() {
</div> </div>
))} ))}
</CardContent> </CardContent>
<Button onClick={handleStartStreaming}>Start Stream</Button> <Button onClick={() => toast.success("SOmething")}>Start Stream</Button>
</LstCard> </LstCard>
); );
} }

View File

@@ -4,7 +4,7 @@ import {Button} from "../ui/button";
import {Input} from "../ui/input"; import {Input} from "../ui/input";
import {Table, TableBody, TableCell, TableHead, TableHeader, TableRow} from "../ui/table"; import {Table, TableBody, TableCell, TableHead, TableHeader, TableRow} from "../ui/table";
import {Skeleton} from "../ui/skeleton"; import {Skeleton} from "../ui/skeleton";
import CycleCountLog from "./CycleCountLog"; //import CycleCountLog from "./CycleCountLog";
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "../ui/select"; import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "../ui/select";
import {Controller, useForm} from "react-hook-form"; import {Controller, useForm} from "react-hook-form";
import axios from "axios"; import axios from "axios";

View File

@@ -73,7 +73,7 @@
} }
}, },
"admConfig": { "admConfig": {
"build": 44, "build": 47,
"oldBuild": "backend-0.1.3.zip" "oldBuild": "backend-0.1.3.zip"
} }
} }

View File

@@ -204,12 +204,139 @@ $plantFunness = {
########################################################### ###########################################################
# Old system still active until we have everything off it # Old system still active until we have everything off it
########################################################### ###########################################################
###########################################################
# Frontend env
###########################################################
Write-Host "Creating the env file in the front end"
$envContentTemplatef = @"
NEXTAUTH_SECRET= "12348fssad5sdg2f2354afvfw34"
NEXTAUTH_URL_INTERNAL= "http://localhost:3000"
NEXTAUTH_URL="{url}"
API_KEY= "E3ECD3619A943B98C6F33E3322362"
"@
try {
$url = "http://$($token)vms006:3000"
if ($token -eq "usiow2") {
$url = "http://usiow1vms006:3001"
}
if ($token -in @("test1", "test2", "test3")) {
$url = "http://usmcd1vms036:3000"
}
# Replace {url} with the actual $url
$envContentf = $envContentTemplatef -replace "{url}", $url
# Define the path where the .env file should be created
$envFilePathf = $obslst + "\apps\frontend\.env"
Write-Host "Final URL: $url"
# Write the content to the .env file
$envContentf | Out-File -FilePath $envFilePathf -Encoding UTF8 -Force
# Optional: Verify the file was created
if (Test-Path $envFilePathf) {
Write-Host "`.env` file created successfully on $env:COMPUTERNAME at $envFilePathf"
} else {
Write-Host "Failed to create `.env` file on $env:COMPUTERNAME"
}
} catch {
Write-Host "Error: Failed to create `.env` file on $server - $_"
}
###########################################################
# DB env
###########################################################
Write-Host "Creating the env file in the front end"
$envContentTemplateb = @"
DATABASE_URL="file:E:\LST\db\lstBackendDB.db"
"@
try {
# Define the path where the .env file should be created
$envFilePathb = $obslst + "\packages\database\.env"
# Write the content to the .env file
$envContentTemplateb | Out-File -FilePath $envFilePathb -Encoding UTF8 -Force
# Optional: Verify the file was created
if (Test-Path $envFilePathb) {
Write-Host "`.env` file created successfully on $env:COMPUTERNAME at $envFilePathb"
} else {
Write-Host "Failed to create `.env` file on $env:COMPUTERNAME"
}
} catch {
Write-Host "Error: Failed to create `.env` file on $server - $_"
}
###########################################################
# backend env
###########################################################
Write-Host "Creating the env file in the front end"
$envContentTemplated = @"
# Server env
NODE_ENV = production
# server apiKey
API_KEY = E3ECD3619A943B98C6F33E3322362
# Prisma DB link
DATABASE_URL="file:E:\LST\db\lstBackendDB.db"
# if you still want the db in the same folder as the server install you need to do like the example below else use the relevent link
DATEBASE_LOC="E:\LST\db\lstBackendDB.db"
DATABASE_BACKUP_LOC="E:\LST\backups"
# Server port
SERVER_PORT = 4400
# Logging
LOG_LEVEL = info
LOG_LOC ="E:\\LST\\logs"
# authentication
SALTING = 12
SECRET = E3ECD3619A943B98C6F33E3322362
JWT_SECRET = 12348fssad5sdg2f2354afvfw34
JWT_EXPIRES_TIME = 1h
# cookie time is in min please take this into consideration when creating all the times
COOKIE_EXPIRES_TIME = 60
# password token reset in mintues
RESET_TOKEN = 330
"@
try {
# Define the path where the .env file should be created
$envFilePathd = $obslst + "\.env"
# Write the content to the .env file
$envContentTemplated | Out-File -FilePath $envFilePathd -Encoding UTF8 -Force
# Optional: Verify the file was created
if (Test-Path $envFilePathd) {
Write-Host "`.env` file created successfully on $env:COMPUTERNAME at $envFilePathd"
} else {
Write-Host "Failed to create `.env` file on $env:COMPUTERNAME"
}
} catch {
Write-Host "Error: Failed to create `.env` file on $server - $_"
}
Write-Host "Running install on obs server." Write-Host "Running install on obs server."
Set-Location $obslst Set-Location $obslst
npm run newinstall # --omit=dev npm run newinstall # --omit=dev
Write-Host "Update the frontend" Write-Host "Update the frontend"
npm run install:front npm run install:front
npm run install:ui npm run install:ui
npm run install:db
Write-Host "Running db updates" Write-Host "Running db updates"
npm run db:migrate npm run db:migrate

View File

@@ -35,7 +35,7 @@
"lstServerPort": "4000", "lstServerPort": "4000",
"active": false, "active": false,
"serverLoc": "E:\\LST\\lstv2", "serverLoc": "E:\\LST\\lstv2",
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend", "oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]", "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]", "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{"specialInstructions": "something for ti"}] "otherSettings": [{"specialInstructions": "something for ti"}]
@@ -53,9 +53,9 @@
"contactPhone": "6366970253", "contactPhone": "6366970253",
"customerTiAcc": "ALPL01HOUSINT", "customerTiAcc": "ALPL01HOUSINT",
"lstServerPort": "4000", "lstServerPort": "4000",
"active": true, "active": false,
"serverLoc": "E:\\LST\\lstv2", "serverLoc": "E:\\LST\\lstv2",
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend", "oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]", "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]", "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{"specialInstructions": "something for ti"}] "otherSettings": [{"specialInstructions": "something for ti"}]
@@ -75,7 +75,7 @@
"lstServerPort": "4000", "lstServerPort": "4000",
"active": true, "active": true,
"serverLoc": "E:\\LST\\lstv2", "serverLoc": "E:\\LST\\lstv2",
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend", "oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]", "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]", "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{"specialInstructions": "something for ti"}] "otherSettings": [{"specialInstructions": "something for ti"}]
@@ -95,7 +95,7 @@
"lstServerPort": "4001", "lstServerPort": "4001",
"active": false, "active": false,
"serverLoc": "E:\\LST\\lstv2", "serverLoc": "E:\\LST\\lstv2",
"oldVersion": "D:\\lst\\lst_backend_2", "oldVersion": "E:\\LST\\lst_backend_2",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]", "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]", "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{"specialInstructions": "something for ti"}] "otherSettings": [{"specialInstructions": "something for ti"}]
@@ -115,7 +115,7 @@
"lstServerPort": "4000", "lstServerPort": "4000",
"active": false, "active": false,
"serverLoc": "E:\\LST\\lstv2", "serverLoc": "E:\\LST\\lstv2",
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend", "oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]", "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]", "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{"specialInstructions": "something for ti"}] "otherSettings": [{"specialInstructions": "something for ti"}]
@@ -133,9 +133,9 @@
"contactPhone": "6366970253", "contactPhone": "6366970253",
"customerTiAcc": "ALPL01BG2INT", "customerTiAcc": "ALPL01BG2INT",
"lstServerPort": "4000", "lstServerPort": "4000",
"active": true, "active": false,
"serverLoc": "E:\\LST\\lstv2", "serverLoc": "E:\\LST\\lstv2",
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend", "oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]", "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]", "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{"specialInstructions": "something for ti"}] "otherSettings": [{"specialInstructions": "something for ti"}]
@@ -153,9 +153,9 @@
"contactPhone": "6366970253", "contactPhone": "6366970253",
"customerTiAcc": "ALPL01MCDINT", "customerTiAcc": "ALPL01MCDINT",
"lstServerPort": "4000", "lstServerPort": "4000",
"active": true, "active": false,
"serverLoc": "E:\\LST\\lstv2", "serverLoc": "E:\\LST\\lstv2",
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend", "oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]", "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]", "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{"specialInstructions": "something for ti"}] "otherSettings": [{"specialInstructions": "something for ti"}]
@@ -195,7 +195,7 @@
"lstServerPort": "4000", "lstServerPort": "4000",
"active": false, "active": false,
"serverLoc": "E:\\LST\\lstv2", "serverLoc": "E:\\LST\\lstv2",
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend", "oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]", "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]", "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{"specialInstructions": "something for ti"}] "otherSettings": [{"specialInstructions": "something for ti"}]
@@ -215,7 +215,7 @@
"lstServerPort": "4000", "lstServerPort": "4000",
"active": false, "active": false,
"serverLoc": "E:\\LST\\lstv2", "serverLoc": "E:\\LST\\lstv2",
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend", "oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]", "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]", "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{"specialInstructions": "something for ti"}] "otherSettings": [{"specialInstructions": "something for ti"}]
@@ -235,7 +235,7 @@
"lstServerPort": "4000", "lstServerPort": "4000",
"active": false, "active": false,
"serverLoc": "E:\\LST\\lstv2", "serverLoc": "E:\\LST\\lstv2",
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend", "oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]", "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]", "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{"specialInstructions": "something for ti"}] "otherSettings": [{"specialInstructions": "something for ti"}]
@@ -255,7 +255,7 @@
"lstServerPort": "4000", "lstServerPort": "4000",
"active": false, "active": false,
"serverLoc": "E:\\LST\\lstv2", "serverLoc": "E:\\LST\\lstv2",
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend", "oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]", "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]", "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{"specialInstructions": "something for ti"}] "otherSettings": [{"specialInstructions": "something for ti"}]
@@ -275,7 +275,7 @@
"lstServerPort": "4000", "lstServerPort": "4000",
"active": false, "active": false,
"serverLoc": "E:\\LST\\lstv2", "serverLoc": "E:\\LST\\lstv2",
"oldVersion": "D:\\LST\\lst_backend", "oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]", "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]", "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{"specialInstructions": "something for ti"}] "otherSettings": [{"specialInstructions": "something for ti"}]
@@ -293,9 +293,9 @@
"contactPhone": "6366970253", "contactPhone": "6366970253",
"customerTiAcc": "ALPL01SHERMANINT", "customerTiAcc": "ALPL01SHERMANINT",
"lstServerPort": "4000", "lstServerPort": "4000",
"active": true, "active": false,
"serverLoc": "E:\\LST\\lstv2", "serverLoc": "E:\\LST\\lstv2",
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend", "oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]", "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]", "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{"specialInstructions": "something for ti"}] "otherSettings": [{"specialInstructions": "something for ti"}]
@@ -313,9 +313,9 @@
"contactPhone": "262-808-4211", "contactPhone": "262-808-4211",
"customerTiAcc": "ALPL01WBINT", "customerTiAcc": "ALPL01WBINT",
"lstServerPort": "4000", "lstServerPort": "4000",
"active": true, "active": false,
"serverLoc": "E:\\LST\\lstv2", "serverLoc": "E:\\LST\\lstv2",
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend", "oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]", "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]", "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{"specialInstructions": "something for ti", "active": false}] "otherSettings": [{"specialInstructions": "something for ti", "active": false}]

View File

@@ -40,6 +40,7 @@ export const serversCheckPoint = async () => {
contactPhone: servers[i].contactPhone, contactPhone: servers[i].contactPhone,
shippingHours: servers[i].shippingHours, shippingHours: servers[i].shippingHours,
customerTiAcc: servers[i].customerTiAcc, customerTiAcc: servers[i].customerTiAcc,
oldVersion: servers[i].oldVersion,
tiPostTime: servers[i].tiPostTime, tiPostTime: servers[i].tiPostTime,
otherSettings: servers[i].otherSettings, otherSettings: servers[i].otherSettings,
}, },