Compare commits
13 Commits
cb00addee9
...
v0.0.2-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| f7ea5f709e | |||
| 3d3c2aa964 | |||
| 781025dca0 | |||
| a593bb2baa | |||
| 759f96b0b6 | |||
| de5df2b00b | |||
| 4d53af0338 | |||
| f7276ca2d7 | |||
| d6328ab764 | |||
| a6d53f0266 | |||
| 7962463927 | |||
| f716de1a58 | |||
| 88cef2a56c |
@@ -50,3 +50,11 @@ GP_PASSWORD=
|
||||
# how often to check for new/updated queries in min
|
||||
QUERY_TIME_TYPE=m #valid options are m, h
|
||||
QUERY_CHECK=1
|
||||
|
||||
|
||||
# Oauth setup
|
||||
PROVIDER=""
|
||||
CLIENT_ID=""
|
||||
CLIENT_SECRET=""
|
||||
CLIENT_SCOPES="openid profile email groups"
|
||||
DISCOVERY_URL=""
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -149,3 +149,4 @@ dist
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
frontend/.tanstack/tmp/2249110e-da91fb0b1b87b6c4cc3e2c2cd25037fd
|
||||
|
||||
50
CHANGELOG.md
50
CHANGELOG.md
@@ -1,5 +1,55 @@
|
||||
# All Changes to LST can be found below.
|
||||
|
||||
## [0.0.2-alpha.0](https://git.tuffraid.net/cowch/lst_v3/compare/v0.0.1...v0.0.2-alpha.0) (2026-04-23)
|
||||
|
||||
## [0.0.1](https://git.tuffraid.net/cowch/lst_v3/compare/v0.0.1-alpha.5...v0.0.1) (2026-04-23)
|
||||
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
* **frontend:** lingering import crashed us ([781025d](https://git.tuffraid.net/cowch/lst_v3/commits/781025dca00e9dd4b2ad9b283be944ed91bbc1e5))
|
||||
|
||||
|
||||
### 📝 Chore
|
||||
|
||||
* **doc remove:** removed a doc and put it in the real area for docs ([a593bb2](https://git.tuffraid.net/cowch/lst_v3/commits/a593bb2baafd0166a178b80cd76dd8862f240e11))
|
||||
|
||||
## [0.0.1-alpha.5](https://git.tuffraid.net/cowch/lst_v3/compare/v0.0.1-alpha.4...v0.0.1-alpha.5) (2026-04-23)
|
||||
|
||||
|
||||
### 🌟 Enhancements
|
||||
|
||||
* **admin:** moved server build/update to full app ([cb00add](https://git.tuffraid.net/cowch/lst_v3/commits/cb00addee96b3ecccf2694f85cb7882cac9c7e3d))
|
||||
* **lstmobile:** intial scanner setup kinda working ([3734d9d](https://git.tuffraid.net/cowch/lst_v3/commits/3734d9daac143ad8fb4404c59990bc4f546f365b))
|
||||
* **oidc:** added in so we could use an oidc to login as well :D ([f7276ca](https://git.tuffraid.net/cowch/lst_v3/commits/f7276ca2d722e30da65bbead23dc9bd57df25aa7))
|
||||
* **servers:** added marked tree in to the mix ([4d53af0](https://git.tuffraid.net/cowch/lst_v3/commits/4d53af033876d81e0d38c148c15cb0af6f3d5bf0))
|
||||
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
* **datamart:** fixes to correct how we handle activations of new features and legacy queries ([b832d7a](https://git.tuffraid.net/cowch/lst_v3/commits/b832d7aa1ecd063be1bbb7e969617fc7a6376ffa))
|
||||
* **datamart:** if we do not have 2.0 warehousing activate we need to use legacy ([5b1c885](https://git.tuffraid.net/cowch/lst_v3/commits/5b1c88546ff9a42dc572450fe05ad68015edb627))
|
||||
* **gp:** weird issue with db username and password ([d6328ab](https://git.tuffraid.net/cowch/lst_v3/commits/d6328ab764c3626aef99727b873003384951d299))
|
||||
* **inventory:** changes to accruatly adjust the query and check the feature set ([32517d0](https://git.tuffraid.net/cowch/lst_v3/commits/32517d0c98c42a0f0f60135b4a9951c4090ccd58))
|
||||
* **logistics:** historical issue where it was being really weird ([cfbc156](https://git.tuffraid.net/cowch/lst_v3/commits/cfbc1565172f7c2e27f0a1593fe8e99b00d91bb7))
|
||||
* **logistics:** purchasing monitoring was going off every 5th min instead of every 5 min ([3639c1b](https://git.tuffraid.net/cowch/lst_v3/commits/3639c1b77c597a94816bfedd0892f0c8980c6403))
|
||||
* **ocp:** fixes to make sure we always hav printer.data as an array or dont do anything ([fb3cd85](https://git.tuffraid.net/cowch/lst_v3/commits/fb3cd85b411315cac0abd22d050ee88929754833))
|
||||
* **psi:** refactor psi queries ([a1eeade](https://git.tuffraid.net/cowch/lst_v3/commits/a1eeadeec438f7c5c6d31f190fee5c22f83dc6b0))
|
||||
|
||||
|
||||
### 📝 Chore
|
||||
|
||||
* **clean:** removed bruno api a proper api doc will be added to lst later ([f716de1](https://git.tuffraid.net/cowch/lst_v3/commits/f716de1a58a4a4c02d9a0a375444ceecea4a018b))
|
||||
* **scripts:** added in a helper to remove old stuff ([de5df2b](https://git.tuffraid.net/cowch/lst_v3/commits/de5df2b00b1c6fe7c53d6ea075b4cf7e0fb845f9))
|
||||
|
||||
|
||||
### 🛠️ Code Refactor
|
||||
|
||||
* **scanner:** more basic work to get the scanner just running ([82f8369](https://git.tuffraid.net/cowch/lst_v3/commits/82f8369640b2b0ff63dd640dc0aa0609a42c7dda))
|
||||
* **servers:** added mcd and stp1 ([88cef2a](https://git.tuffraid.net/cowch/lst_v3/commits/88cef2a56c390b692866658ce519e59ffeaf4c17))
|
||||
* **server:** server updates can now only be done from a dev pc ([7962463](https://git.tuffraid.net/cowch/lst_v3/commits/7962463927c4c5d2e12db9a0dd536b0f29fc65b2))
|
||||
* **sql:** changed sql connection to ip:port ([a6d53f0](https://git.tuffraid.net/cowch/lst_v3/commits/a6d53f0266f1edc3f3946cd1f07d893c8a98d9c7))
|
||||
|
||||
## [0.0.1-alpha.4](https://git.tuffraid.net/cowch/lst_v3/compare/v0.0.1-alpha.3...v0.0.1-alpha.4) (2026-04-15)
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
import type sql from "mssql";
|
||||
|
||||
// TODO : Remove this later and get it onto the env
|
||||
const username = "gpviewer";
|
||||
const password = "gp$$ViewOnly!";
|
||||
|
||||
const port = process.env.SQL_PORT
|
||||
? Number.parseInt(process.env.SQL_PORT, 10)
|
||||
: undefined;
|
||||
|
||||
export const gpSqlConfig: sql.config = {
|
||||
server: `USMCD1VMS011`,
|
||||
server: `${process.env.GP_SERVER ?? "USMCD1VMS011"}`,
|
||||
port: port,
|
||||
database: `ALPLA`,
|
||||
user: username,
|
||||
password: password,
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
import type sql from "mssql";
|
||||
|
||||
const port = process.env.SQL_PORT
|
||||
? Number.parseInt(process.env.SQL_PORT, 10)
|
||||
: undefined;
|
||||
|
||||
export const prodSqlConfig: sql.config = {
|
||||
server: `${process.env.PROD_SERVER}`,
|
||||
database: `AlplaPROD_${process.env.PROD_PLANT_TOKEN}_cus`,
|
||||
port: port,
|
||||
user: process.env.PROD_USER,
|
||||
password: process.env.PROD_PASSWORD,
|
||||
options: {
|
||||
|
||||
@@ -249,7 +249,6 @@ export const runDatamartQuery = async (data: Data) => {
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
case "psiDeliveryData":
|
||||
datamartQuery = datamartQuery
|
||||
.replace("[startDate]", `${data.options.startDate}`)
|
||||
|
||||
@@ -53,13 +53,14 @@ export const connectGPSql = async () => {
|
||||
notify: false,
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
reconnectToSql;
|
||||
return returnFunc({
|
||||
success: false,
|
||||
level: "error",
|
||||
module: "system",
|
||||
subModule: "db",
|
||||
message: "Failed to connect to the prod sql server.",
|
||||
message: "Failed to connect to the gp sql server.",
|
||||
data: [error],
|
||||
notify: false,
|
||||
});
|
||||
|
||||
@@ -96,8 +96,42 @@ const servers: NewServerData[] = [
|
||||
serverLoc: "D$\\LST_V3",
|
||||
buildNumber: 1,
|
||||
},
|
||||
{
|
||||
name: "McDonough",
|
||||
server: "USMCD1VMS006",
|
||||
plantToken: "usmcd1",
|
||||
idAddress: "10.193.0.26",
|
||||
greatPlainsPlantCode: "10",
|
||||
contactEmail: "",
|
||||
contactPhone: "",
|
||||
serverLoc: "D$\\LST_V3",
|
||||
buildNumber: 1,
|
||||
},
|
||||
{
|
||||
name: "St. Peters",
|
||||
server: "USSTP1VMS006",
|
||||
plantToken: "usstp1",
|
||||
idAddress: "10.37.0.26",
|
||||
greatPlainsPlantCode: "45",
|
||||
contactEmail: "",
|
||||
contactPhone: "",
|
||||
serverLoc: "D$\\LST_V3",
|
||||
buildNumber: 1,
|
||||
},
|
||||
{
|
||||
name: "Marked Tree",
|
||||
server: "USMAR1VMS006",
|
||||
plantToken: "usmar1",
|
||||
idAddress: "10.206.9.26",
|
||||
greatPlainsPlantCode: "90",
|
||||
contactEmail: "",
|
||||
contactPhone: "",
|
||||
serverLoc: "D$\\LST_V3",
|
||||
buildNumber: 1,
|
||||
},
|
||||
];
|
||||
|
||||
// notes here for when it comes time to pull in all the server address info [test1_AlplaPROD2.0_Read].[masterData].[Plant] has everything from every server :D
|
||||
export const serversChecks = async () => {
|
||||
const log = createLogger({ module: "system", subModule: "serverData" });
|
||||
const { data, error } = await tryCatch(
|
||||
@@ -130,3 +164,9 @@ export const serversChecks = async () => {
|
||||
log.info({}, "All Servers were added/updated");
|
||||
}
|
||||
};
|
||||
|
||||
// Communication from logistic network to logisticsSupportTool (for printers and scanners)
|
||||
|
||||
// network justification
|
||||
|
||||
// scanners and printers are on dhcp
|
||||
|
||||
@@ -2,6 +2,7 @@ import { betterAuth } from "better-auth";
|
||||
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
||||
import {
|
||||
admin as adminPlugin,
|
||||
genericOAuth,
|
||||
// apiKey,
|
||||
// createAuthMiddleware,
|
||||
//customSession,
|
||||
@@ -16,6 +17,46 @@ import { ac, admin, systemAdmin, user } from "./auth.permissions.js";
|
||||
import { allowedOrigins } from "./cors.utils.js";
|
||||
import { sendEmail } from "./sendEmail.utils.js";
|
||||
|
||||
function decodeJwtPayload<T = Record<string, unknown>>(jwt: string): T {
|
||||
const parts = jwt.split(".");
|
||||
if (parts.length < 2) {
|
||||
throw new Error("Invalid JWT");
|
||||
}
|
||||
|
||||
const payload = parts[1]?.replace(/-/g, "+").replace(/_/g, "/");
|
||||
|
||||
const padded = payload?.padEnd(
|
||||
payload.length + ((4 - (payload.length % 4)) % 4),
|
||||
"=",
|
||||
);
|
||||
|
||||
const json = Buffer.from(padded ?? "", "base64").toString("utf8");
|
||||
return JSON.parse(json) as T;
|
||||
}
|
||||
|
||||
function normalizeGroups(groups?: unknown): string[] {
|
||||
if (!Array.isArray(groups)) return [];
|
||||
|
||||
return groups
|
||||
.filter((g): g is string => typeof g === "string")
|
||||
.map((g) => g.trim().toLowerCase())
|
||||
.filter((g) => g.length > 0);
|
||||
}
|
||||
|
||||
type VoidAuthClaims = {
|
||||
sub: string;
|
||||
name?: string;
|
||||
preferred_username?: string;
|
||||
email?: string;
|
||||
email_verified?: boolean;
|
||||
groups?: string[];
|
||||
picture?: string;
|
||||
iss?: string;
|
||||
aud?: string;
|
||||
exp?: number;
|
||||
iat?: number;
|
||||
};
|
||||
|
||||
export const schema = {
|
||||
user: rawSchema.user,
|
||||
session: rawSchema.session,
|
||||
@@ -25,9 +66,73 @@ export const schema = {
|
||||
apiKey: rawSchema.apikey, // 🔑 rename to apiKey
|
||||
};
|
||||
|
||||
const hasOAuth =
|
||||
Boolean(process.env.PROVIDER) &&
|
||||
Boolean(process.env.CLIENT_ID) &&
|
||||
Boolean(process.env.CLIENT_SECRET) &&
|
||||
Boolean(process.env.DISCOVERY_URL);
|
||||
|
||||
if (!hasOAuth) {
|
||||
console.warn("Missing oauth data.");
|
||||
}
|
||||
|
||||
const oauthPlugins = hasOAuth
|
||||
? [
|
||||
genericOAuth({
|
||||
config: [
|
||||
{
|
||||
providerId: process.env.PROVIDER!,
|
||||
clientId: process.env.CLIENT_ID!,
|
||||
clientSecret: process.env.CLIENT_SECRET!,
|
||||
discoveryUrl: process.env.DISCOVERY_URL!,
|
||||
scopes: (process.env.CLIENT_SCOPES ?? "")
|
||||
.split(/[,\s]+/)
|
||||
.filter(Boolean),
|
||||
pkce: true,
|
||||
requireIssuerValidation: true,
|
||||
redirectURI: `${process.env.URL}/lst/api/auth/oauth2/callback/${process.env.PROVIDER!}`,
|
||||
getUserInfo: async (tokens) => {
|
||||
if (!tokens.idToken) {
|
||||
throw new Error("VoidAuth did not return an idToken");
|
||||
}
|
||||
|
||||
const claims = decodeJwtPayload<VoidAuthClaims>(tokens.idToken);
|
||||
const groups = normalizeGroups(claims.groups);
|
||||
|
||||
return {
|
||||
id: claims.sub,
|
||||
email: claims.email ?? "",
|
||||
name:
|
||||
claims.name ??
|
||||
claims.preferred_username ??
|
||||
claims.email ??
|
||||
"Unknown User",
|
||||
image: claims.picture ?? null,
|
||||
emailVerified: Boolean(claims.email_verified),
|
||||
groups,
|
||||
username: claims.preferred_username ?? null,
|
||||
} as any;
|
||||
},
|
||||
|
||||
mapProfileToUser: async (profile) => {
|
||||
return {
|
||||
name: profile.name,
|
||||
role: profile.groups?.includes("lst_admins")
|
||||
? "systemAdmin"
|
||||
: profile.groups?.includes("admins")
|
||||
? "admin"
|
||||
: "user",
|
||||
};
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
]
|
||||
: [];
|
||||
|
||||
export const auth = betterAuth({
|
||||
appName: "lst",
|
||||
baseURL: process.env.URL,
|
||||
baseURL: `${process.env.URL}/lst/api/auth`,
|
||||
database: drizzleAdapter(db, {
|
||||
provider: "pg",
|
||||
schema,
|
||||
@@ -42,6 +147,14 @@ export const auth = betterAuth({
|
||||
},
|
||||
},
|
||||
},
|
||||
account: {
|
||||
encryptOAuthTokens: true,
|
||||
updateAccountOnSignIn: true,
|
||||
accountLinking: {
|
||||
enabled: true,
|
||||
trustedProviders: ["voidauth"],
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
jwt({ jwt: { expirationTime: "1h" } }),
|
||||
//apiKey(),
|
||||
@@ -63,6 +176,7 @@ export const auth = betterAuth({
|
||||
return true;
|
||||
},
|
||||
}),
|
||||
...oauthPlugins,
|
||||
|
||||
// customSession(async ({ user, session }) => {
|
||||
// const roles = await db
|
||||
@@ -121,7 +235,7 @@ export const auth = betterAuth({
|
||||
},
|
||||
},
|
||||
cookie: {
|
||||
path: "/lst/app",
|
||||
path: "/lst",
|
||||
sameSite: "lax",
|
||||
secure: false,
|
||||
httpOnly: true,
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
meta {
|
||||
name: Login
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{url}}/api/auth/sign-in/email
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
Origin: http://localhost:3000
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"email": "blake.matthes@alpla.com",
|
||||
"password": "nova0511"
|
||||
}
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
// // grab the raw Set-Cookie header
|
||||
// const cookies = res.headers["set-cookie"];
|
||||
|
||||
// const sessionCookie = cookies[0].split(";")[0];
|
||||
|
||||
// // Save it as an environment variable
|
||||
// bru.setEnvVar("session_cookie", sessionCookie);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
meta {
|
||||
name: Register
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{url}}/api/authentication/register
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"name":"Blake", // option when in the frontend as we will pass over as username if not added
|
||||
"username": "matthes01",
|
||||
"email": "blake.matthes@alpla.com",
|
||||
"password": "nova0511"
|
||||
}
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
// // grab the raw Set-Cookie header
|
||||
// const cookies = res.headers["set-cookie"];
|
||||
|
||||
// const sessionCookie = cookies[0].split(";")[0];
|
||||
|
||||
// // Save it as an environment variable
|
||||
// bru.setEnvVar("session_cookie", sessionCookie);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
meta {
|
||||
name: auth
|
||||
seq: 5
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
meta {
|
||||
name: getSession
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{url}}/api/auth/get-session
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"version": "1",
|
||||
"name": "lst_v3",
|
||||
"type": "collection",
|
||||
"ignore": [
|
||||
"node_modules",
|
||||
".git"
|
||||
]
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
docs {
|
||||
All Api endpoints to the logistics support tool
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
meta {
|
||||
name: Get queries
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{url}}/api/datamart
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
meta {
|
||||
name: Run Query
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{url}}/api/datamart/:name?articles=118,120&startDate=2026-01-01&endDate=2026-12-31&all=x
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
params:query {
|
||||
articles: 118,120
|
||||
startDate: 2026-01-01
|
||||
endDate: 2026-12-31
|
||||
all: x
|
||||
}
|
||||
|
||||
params:path {
|
||||
name: deliveryByDateRange
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
meta {
|
||||
name: datamart
|
||||
seq: 2
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
vars {
|
||||
url: http://localhost:3000/lst
|
||||
readerIp: 10.44.14.215
|
||||
}
|
||||
vars:secret [
|
||||
token
|
||||
]
|
||||
@@ -1,20 +0,0 @@
|
||||
meta {
|
||||
name: Get All notifications.
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{url}}/api/notification
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
Passing all as a query param will return all queries active and none active
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
meta {
|
||||
name: Subscribe to notification
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{url}}/api/notification/sub
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"userId":"m6AbQXFwOXoX3YKLfwWgq2LIdDqS5jqv",
|
||||
"notificationId": "0399eb2a-39df-48b7-9f1c-d233cec94d2e",
|
||||
"emails": ["blake.matthes@alpla.com","blake.matthes@alpla.com"]
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
meta {
|
||||
name: notifications
|
||||
seq: 7
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
meta {
|
||||
name: remove sub notification
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
delete {
|
||||
url: {{url}}/api/notification/sub
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"userId":"0kHd6Kkdub4GW6rK1qa1yjWwqXtvykqT",
|
||||
"notificationId": "0399eb2a-39df-48b7-9f1c-d233cec94d2e",
|
||||
"emails": ["blake.mattes@alpla.com"]
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
meta {
|
||||
name: subscriptions
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{url}}/api/notification/sub
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
meta {
|
||||
name: update notification
|
||||
type: http
|
||||
seq: 6
|
||||
}
|
||||
|
||||
patch {
|
||||
url: {{url}}/api/notification/:id
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
params:path {
|
||||
id: 0399eb2a-39df-48b7-9f1c-d233cec94d2e
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"active" : true,
|
||||
"options": []
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
Passing all as a query param will return all queries active and none active
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
meta {
|
||||
name: update sub notification
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
patch {
|
||||
url: {{url}}/api/notification/sub
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"userId":"m6AbQXFwOXoX3YKLfwWgq2LIdDqS5jqv",
|
||||
"notificationId": "0399eb2a-39df-48b7-9f1c-d233cec94d2e",
|
||||
"emails": ["cowchmonkey@gmail.com"]
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
meta {
|
||||
name: Printer Listenter
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{url}}/api/ocp/printer/listener/line_1
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"message":"xnvjdhhgsdfr"
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
meta {
|
||||
name: ocp
|
||||
seq: 9
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
meta {
|
||||
name: GetApt
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{url}}/api/opendock
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
meta {
|
||||
name: Sql Start
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{url}}/api/system/prodsql/start
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
meta {
|
||||
name: Sql restart
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{url}}/api/system/prodsql/restart
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
meta {
|
||||
name: Sql stop
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{url}}/api/system/prodsql/stop
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
meta {
|
||||
name: prodSql
|
||||
seq: 6
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
meta {
|
||||
name: rfidReaders
|
||||
seq: 8
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
meta {
|
||||
name: reader
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: https://usday1prod.alpla.net/lst/old/api/rfid/mgtevents/line3.1
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
meta {
|
||||
name: Config
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: https://{{readerIp}}/cloud/config
|
||||
body: none
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token: {{token}}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
meta {
|
||||
name: Login
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: https://{{readerIp}}/cloud/localRestLogin
|
||||
body: none
|
||||
auth: basic
|
||||
}
|
||||
|
||||
auth:basic {
|
||||
username: admin
|
||||
password: Zebra123!
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
const body = res.getBody();
|
||||
|
||||
if (body.message) {
|
||||
bru.setEnvVar("token", body.message);
|
||||
} else {
|
||||
bru.setEnvVar("token", "error");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,237 +0,0 @@
|
||||
meta {
|
||||
name: Update Config
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
put {
|
||||
url: https://{{readerIp}}/cloud/config
|
||||
body: json
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
headers {
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token: {{token}}
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"GPIO-LED": {
|
||||
"GPODefaults": {
|
||||
"1": "HIGH",
|
||||
"2": "HIGH",
|
||||
"3": "HIGH",
|
||||
"4": "HIGH"
|
||||
},
|
||||
"LEDDefaults": {
|
||||
"3": "GREEN"
|
||||
},
|
||||
"TAG_READ": [
|
||||
{
|
||||
"pin": 1,
|
||||
"state": "HIGH",
|
||||
"type": "GPO"
|
||||
}
|
||||
]
|
||||
},
|
||||
"READER-GATEWAY": {
|
||||
"batching": [
|
||||
{
|
||||
"maxPayloadSizePerReport": 256000,
|
||||
"reportingInterval": 2000
|
||||
},
|
||||
{
|
||||
"maxPayloadSizePerReport": 256000,
|
||||
"reportingInterval": 2000
|
||||
}
|
||||
],
|
||||
"endpointConfig": {
|
||||
"data": {
|
||||
"event": {
|
||||
"connections": [
|
||||
{
|
||||
"additionalOptions": {
|
||||
"retention": {
|
||||
"maxEventRetentionTimeInMin": 500,
|
||||
"maxNumEvents": 150000,
|
||||
"throttle": 100
|
||||
}
|
||||
},
|
||||
"description": "",
|
||||
"name": "LST",
|
||||
"options": {
|
||||
"URL": "https://usday1prod.alpla.net/lst/old/api/rfid/taginfo/line3.4",
|
||||
"security": {
|
||||
"CACertificateFileLocation": "",
|
||||
"authenticationOptions": {},
|
||||
"authenticationType": "NONE",
|
||||
"verifyHost": false,
|
||||
"verifyPeer": false
|
||||
}
|
||||
},
|
||||
"type": "httpPost"
|
||||
},
|
||||
{
|
||||
"additionalOptions": {
|
||||
"retention": {
|
||||
"maxEventRetentionTimeInMin": 500,
|
||||
"maxNumEvents": 150000,
|
||||
"throttle": 100
|
||||
}
|
||||
},
|
||||
"description": "",
|
||||
"name": "mgt",
|
||||
"options": {
|
||||
"URL": "https://usday1prod.alpla.net/lst/old/api/rfid/mgtevents/line3.4",
|
||||
"security": {
|
||||
"CACertificateFileLocation": "",
|
||||
"authenticationOptions": {},
|
||||
"authenticationType": "NONE",
|
||||
"verifyHost": false,
|
||||
"verifyPeer": false
|
||||
}
|
||||
},
|
||||
"type": "httpPost"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"managementEventConfig": {
|
||||
"errors": {
|
||||
"antenna": false,
|
||||
"cpu": {
|
||||
"reportIntervalInSec": 1800,
|
||||
"threshold": 90
|
||||
},
|
||||
"database": true,
|
||||
"flash": {
|
||||
"reportIntervalInSec": 1800,
|
||||
"threshold": 90
|
||||
},
|
||||
"ntp": true,
|
||||
"radio": true,
|
||||
"radio_control": true,
|
||||
"ram": {
|
||||
"reportIntervalInSec": 1800,
|
||||
"threshold": 90
|
||||
},
|
||||
"reader_gateway": true,
|
||||
"userApp": {
|
||||
"reportIntervalInSec": 1800,
|
||||
"threshold": 120
|
||||
}
|
||||
},
|
||||
"gpiEvents": true,
|
||||
"gpoEvents": true,
|
||||
"heartbeat": {
|
||||
"fields": {
|
||||
"radio_control": [
|
||||
"ANTENNAS",
|
||||
"RADIO_ACTIVITY",
|
||||
"RADIO_CONNECTION",
|
||||
"CPU",
|
||||
"RAM",
|
||||
"UPTIME",
|
||||
"NUM_ERRORS",
|
||||
"NUM_WARNINGS",
|
||||
"NUM_TAG_READS",
|
||||
"NUM_TAG_READS_PER_ANTENNA",
|
||||
"NUM_DATA_MESSAGES_TXED",
|
||||
"NUM_RADIO_PACKETS_RXED"
|
||||
],
|
||||
"reader_gateway": [
|
||||
"NUM_DATA_MESSAGES_RXED",
|
||||
"NUM_MANAGEMENT_EVENTS_TXED",
|
||||
"NUM_DATA_MESSAGES_TXED",
|
||||
"NUM_DATA_MESSAGES_RETAINED",
|
||||
"NUM_DATA_MESSAGES_DROPPED",
|
||||
"CPU",
|
||||
"RAM",
|
||||
"UPTIME",
|
||||
"NUM_ERRORS",
|
||||
"NUM_WARNINGS",
|
||||
"INTERFACE_CONNECTION_STATUS",
|
||||
"NOLOCKQ_DEPTH"
|
||||
],
|
||||
"system": [
|
||||
"CPU",
|
||||
"FLASH",
|
||||
"NTP",
|
||||
"RAM",
|
||||
"SYSTEMTIME",
|
||||
"TEMPERATURE",
|
||||
"UPTIME",
|
||||
"GPO",
|
||||
"GPI",
|
||||
"POWER_NEGOTIATION",
|
||||
"POWER_SOURCE",
|
||||
"MAC_ADDRESS",
|
||||
"HOSTNAME"
|
||||
],
|
||||
"userapps": [
|
||||
"STATUS",
|
||||
"CPU",
|
||||
"RAM",
|
||||
"UPTIME",
|
||||
"NUM_DATA_MESSAGES_RXED",
|
||||
"NUM_DATA_MESSAGES_TXED",
|
||||
"INCOMING_DATA_BUFFER_PERCENTAGE_REMAINING",
|
||||
"OUTGOING_DATA_BUFFER_PERCENTAGE_REMAINING"
|
||||
]
|
||||
},
|
||||
"interval": 60
|
||||
},
|
||||
"userappEvents": true,
|
||||
"warnings": {
|
||||
"cpu": {
|
||||
"reportIntervalInSec": 1800,
|
||||
"threshold": 80
|
||||
},
|
||||
"database": true,
|
||||
"flash": {
|
||||
"reportIntervalInSec": 1800,
|
||||
"threshold": 80
|
||||
},
|
||||
"ntp": true,
|
||||
"radio_api": true,
|
||||
"radio_control": true,
|
||||
"ram": {
|
||||
"reportIntervalInSec": 1800,
|
||||
"threshold": 80
|
||||
},
|
||||
"reader_gateway": true,
|
||||
"temperature": {
|
||||
"ambient": 75,
|
||||
"pa": 105
|
||||
},
|
||||
"userApp": {
|
||||
"reportIntervalInSec": 1800,
|
||||
"threshold": 60
|
||||
}
|
||||
}
|
||||
},
|
||||
"retention": [
|
||||
{
|
||||
"maxEventRetentionTimeInMin": 500,
|
||||
"maxNumEvents": 150000,
|
||||
"throttle": 100
|
||||
},
|
||||
{
|
||||
"maxEventRetentionTimeInMin": 500,
|
||||
"maxNumEvents": 150000,
|
||||
"throttle": 100
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
meta {
|
||||
name: readerSpecific
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: basic
|
||||
}
|
||||
|
||||
auth:basic {
|
||||
username: admin
|
||||
password: Zebra123!
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
meta {
|
||||
name: Get Settings
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{url}}/api/settings
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
returns all settings
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
meta {
|
||||
name: Status
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{url}}/api/stats
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
meta {
|
||||
name: updateSetting
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
patch {
|
||||
url: {{url}}/api/settings/opendock_sync
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"value" : "1",
|
||||
"active": "true"
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
Allows the changing of a setting based on the parameter.
|
||||
|
||||
* when a setting that is being changed is a feature there will be some backgound logic that will stop that features processes and no long work.
|
||||
|
||||
* when the setting is being changed is system the entire app will do a full restart
|
||||
|
||||
* when a seeting is being changed and is standard nothing will happen until the next action is completed. example someone prints a label and you changed the default to 120 second from 90 seconds
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
meta {
|
||||
name: Active Jobs
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{url}}/api/utils/croner
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
meta {
|
||||
name: Change job status
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
patch {
|
||||
url: {{url}}/api/utils/croner/stop
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"name": "open-dock-monitor"
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -12,48 +12,36 @@ services:
|
||||
#- "${VITE_PORT:-4200}:4200"
|
||||
- "3600:3000"
|
||||
dns:
|
||||
- 10.193.9.250
|
||||
- 10.193.9.251 # your internal DNS server
|
||||
dns_search:
|
||||
- alpla.net # or your internal search suffix
|
||||
- 10.44.9.250
|
||||
- 10.44.9.251 # your internal DNS server
|
||||
- 1.1.1.1
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- LOG_LEVEL=info
|
||||
- EXTERNAL_URL=http://192.168.8.222:3600
|
||||
- DATABASE_HOST=host.docker.internal # if running on the same docker then do this
|
||||
- DATABASE_PORT=5433
|
||||
- DATABASE_HOST=postgres # if running on the same docker then do this
|
||||
- DATABASE_PORT=5432
|
||||
- DATABASE_USER=${DATABASE_USER}
|
||||
- DATABASE_PASSWORD=${DATABASE_PASSWORD}
|
||||
- DATABASE_DB=${DATABASE_DB}
|
||||
- PROD_SERVER=${PROD_SERVER}
|
||||
- PROD_SERVER=10.75.9.56 #${PROD_SERVER}
|
||||
- PROD_PLANT_TOKEN=${PROD_PLANT_TOKEN}
|
||||
- PROD_USER=${PROD_USER}
|
||||
- PROD_PASSWORD=${PROD_PASSWORD}
|
||||
- GP_SERVER=10.193.9.31
|
||||
- SQL_PORT=1433
|
||||
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
|
||||
- BETTER_AUTH_URL=${URL}
|
||||
# for all host including prod servers, plc's, printers, or other de
|
||||
# extra_hosts:
|
||||
# - "${PROD_SERVER}:${PROD_IP}"
|
||||
- OPENDOCK_URL=${OPENDOCK_URL}
|
||||
- OPENDOCK_PASSWORD=${OPENDOCK_PASSWORD}
|
||||
- DEFAULT_DOCK=${DEFAULT_DOCK}
|
||||
- DEFAULT_LOAD_TYPE=${DEFAULT_LOAD_TYPE}
|
||||
- DEFAULT_CARRIER=${DEFAULT_CARRIER}
|
||||
|
||||
# networks:
|
||||
# - default
|
||||
# - logisticsNetwork
|
||||
# #- mlan1
|
||||
# networks:
|
||||
# logisticsNetwork:
|
||||
# driver: macvlan
|
||||
# driver_opts:
|
||||
# parent: eth0
|
||||
# ipam:
|
||||
# config:
|
||||
# - subnet: ${LOGISTICS_NETWORK}
|
||||
# gateway: ${LOGISTICS_GATEWAY}
|
||||
#for all host including prod servers, plc's, printers, or other de
|
||||
networks:
|
||||
- docker-network
|
||||
|
||||
# mlan1:
|
||||
# driver: macvlan
|
||||
# driver_opts:
|
||||
# parent: eth0
|
||||
# ipam:
|
||||
# config:
|
||||
# - subnet: ${MLAN1_NETWORK}
|
||||
# gateway: ${MLAN1_GATEWAY}
|
||||
networks:
|
||||
docker-network:
|
||||
external: true
|
||||
@@ -1,4 +1,4 @@
|
||||
import { adminClient } from "better-auth/client/plugins";
|
||||
import { adminClient, genericOAuthClient } from "better-auth/client/plugins";
|
||||
import { createAuthClient } from "better-auth/react";
|
||||
import { ac, admin, systemAdmin, user } from "./auth-permissions";
|
||||
|
||||
@@ -13,6 +13,7 @@ export const authClient = createAuthClient({
|
||||
systemAdmin,
|
||||
},
|
||||
}),
|
||||
genericOAuthClient(),
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Link, useNavigate } from "@tanstack/react-router";
|
||||
import { Cat } from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
import {
|
||||
Card,
|
||||
@@ -9,13 +10,23 @@ import {
|
||||
} from "@/components/ui/card";
|
||||
import { authClient } from "@/lib/auth-client";
|
||||
import { useAppForm } from "@/lib/formSutff";
|
||||
import { Button } from "../../../components/ui/button";
|
||||
import socket from "../../../lib/socket.io";
|
||||
|
||||
export default function LoginForm({ redirectPath }: { redirectPath: string }) {
|
||||
const loginEmail = localStorage.getItem("loginEmail") || "";
|
||||
const rememberMe = localStorage.getItem("rememberMe") === "true";
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const oauthLogin = async () => {
|
||||
await authClient.signIn.oauth2({
|
||||
providerId: "voidauth",
|
||||
callbackURL: "/lst/app",
|
||||
errorCallbackURL: "/lst/app/login",
|
||||
});
|
||||
};
|
||||
|
||||
const form = useAppForm({
|
||||
defaultValues: {
|
||||
email: loginEmail,
|
||||
@@ -26,7 +37,7 @@ export default function LoginForm({ redirectPath }: { redirectPath: string }) {
|
||||
// set remember me incase we want it later
|
||||
if (value.rememberMe) {
|
||||
localStorage.setItem("rememberMe", value.rememberMe.toString());
|
||||
localStorage.setItem("loginEmail", value.email);
|
||||
localStorage.setItem("loginEmail", value.email.toLocaleLowerCase());
|
||||
} else {
|
||||
localStorage.removeItem("rememberMe");
|
||||
localStorage.removeItem("loginEmail");
|
||||
@@ -62,7 +73,17 @@ export default function LoginForm({ redirectPath }: { redirectPath: string }) {
|
||||
<div>
|
||||
<Card className="p-3 w-96">
|
||||
<CardHeader>
|
||||
<CardTitle>Login to your account</CardTitle>
|
||||
<CardTitle>
|
||||
<div className="flex flex-row justify-center">
|
||||
<Button onClick={oauthLogin} size="lg" variant="ghost">
|
||||
<Cat />
|
||||
</Button>
|
||||
<span className="mt-2">Login to your account</span>{" "}
|
||||
<Button size="lg" variant="ghost">
|
||||
<Cat />
|
||||
</Button>
|
||||
</div>
|
||||
</CardTitle>
|
||||
<CardDescription>
|
||||
Enter your username and password below
|
||||
</CardDescription>
|
||||
@@ -76,12 +97,19 @@ export default function LoginForm({ redirectPath }: { redirectPath: string }) {
|
||||
>
|
||||
<form.AppField name="email">
|
||||
{(field) => (
|
||||
<field.InputField label="Email" inputType="email" required />
|
||||
<field.InputField
|
||||
label="Email"
|
||||
inputType="email"
|
||||
required={rememberMe}
|
||||
/>
|
||||
)}
|
||||
</form.AppField>
|
||||
<form.AppField name="password">
|
||||
{(field) => (
|
||||
<field.InputPasswordField label="Password" required={true} />
|
||||
<field.InputPasswordField
|
||||
label="Password"
|
||||
required={rememberMe}
|
||||
/>
|
||||
)}
|
||||
</form.AppField>
|
||||
|
||||
@@ -98,7 +126,7 @@ export default function LoginForm({ redirectPath }: { redirectPath: string }) {
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end mt-2">
|
||||
<div className="flex justify-between mt-2 ">
|
||||
<form.AppForm>
|
||||
<form.SubmitButton>Login</form.SubmitButton>
|
||||
</form.AppForm>
|
||||
|
||||
@@ -48,7 +48,7 @@ export const Route = createFileRoute("/admin/servers")({
|
||||
const ServerTable = () => {
|
||||
const { data, refetch } = useSuspenseQuery(servers());
|
||||
const columnHelper = createColumnHelper<any>();
|
||||
|
||||
const okToUpdate = ["localhost", "usmcd1olp082"];
|
||||
const columns = [
|
||||
columnHelper.accessor("name", {
|
||||
header: ({ column }) => (
|
||||
@@ -75,81 +75,86 @@ const ServerTable = () => {
|
||||
),
|
||||
cell: (i) => <span>{i.getValue()}</span>,
|
||||
}),
|
||||
columnHelper.accessor("lastUpdated", {
|
||||
header: ({ column }) => (
|
||||
<SearchableHeader column={column} title="Last Update" />
|
||||
),
|
||||
cell: (i) => <span>{format(i.getValue(), "M/d/yyyy HH:mm")}</span>,
|
||||
}),
|
||||
columnHelper.accessor("buildNumber", {
|
||||
header: ({ column }) => (
|
||||
<SearchableHeader column={column} title="Build" />
|
||||
),
|
||||
cell: (i) => <span>{i.getValue()}</span>,
|
||||
}),
|
||||
columnHelper.accessor("update", {
|
||||
header: ({ column }) => (
|
||||
<SearchableHeader column={column} title="Update" searchable={false} />
|
||||
),
|
||||
filterFn: "includesString",
|
||||
cell: (i) => {
|
||||
// biome-ignore lint: just removing the lint for now to get this going will maybe fix later
|
||||
const [activeToggle, setActiveToggle] = useState(false);
|
||||
|
||||
const onToggle = async () => {
|
||||
setActiveToggle(true);
|
||||
toast.success(
|
||||
`${i.row.original.name} just started the upgrade monitor logs for errors.`,
|
||||
);
|
||||
try {
|
||||
const res = await axios.post(
|
||||
`/lst/api/admin/build/updateServer`,
|
||||
{
|
||||
server: i.row.original.server,
|
||||
destination: i.row.original.serverLoc,
|
||||
token: i.row.original.plantToken,
|
||||
},
|
||||
{ withCredentials: true },
|
||||
);
|
||||
|
||||
if (res.data.success) {
|
||||
toast.success(
|
||||
`${i.row.original.name} has completed its upgrade.`,
|
||||
);
|
||||
refetch();
|
||||
setActiveToggle(false);
|
||||
}
|
||||
} catch (error) {
|
||||
setActiveToggle(false);
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<Button
|
||||
variant="ghost"
|
||||
disabled={activeToggle}
|
||||
onClick={() => onToggle()}
|
||||
>
|
||||
{activeToggle ? (
|
||||
<span>
|
||||
<Spinner />
|
||||
</span>
|
||||
) : (
|
||||
<span>
|
||||
<CircleFadingArrowUp />
|
||||
</span>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
if (okToUpdate.includes(window.location.hostname)) {
|
||||
columns.push(
|
||||
columnHelper.accessor("lastUpdated", {
|
||||
header: ({ column }) => (
|
||||
<SearchableHeader column={column} title="Last Update" />
|
||||
),
|
||||
cell: (i) => <span>{format(i.getValue(), "M/d/yyyy HH:mm")}</span>,
|
||||
}),
|
||||
columnHelper.accessor("buildNumber", {
|
||||
header: ({ column }) => (
|
||||
<SearchableHeader column={column} title="Build" />
|
||||
),
|
||||
cell: (i) => <span>{i.getValue()}</span>,
|
||||
}),
|
||||
columnHelper.accessor("update", {
|
||||
header: ({ column }) => (
|
||||
<SearchableHeader column={column} title="Update" searchable={false} />
|
||||
),
|
||||
filterFn: "includesString",
|
||||
cell: (i) => {
|
||||
// biome-ignore lint: just removing the lint for now to get this going will maybe fix later
|
||||
const [activeToggle, setActiveToggle] = useState(false);
|
||||
|
||||
const onToggle = async () => {
|
||||
setActiveToggle(true);
|
||||
toast.success(
|
||||
`${i.row.original.name} just started the upgrade monitor logs for errors.`,
|
||||
);
|
||||
try {
|
||||
const res = await axios.post(
|
||||
`/lst/api/admin/build/updateServer`,
|
||||
{
|
||||
server: i.row.original.server,
|
||||
destination: i.row.original.serverLoc,
|
||||
token: i.row.original.plantToken,
|
||||
},
|
||||
{ withCredentials: true },
|
||||
);
|
||||
|
||||
if (res.data.success) {
|
||||
toast.success(
|
||||
`${i.row.original.name} has completed its upgrade.`,
|
||||
);
|
||||
refetch();
|
||||
setActiveToggle(false);
|
||||
}
|
||||
} catch (error) {
|
||||
setActiveToggle(false);
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<Button
|
||||
variant="ghost"
|
||||
disabled={activeToggle}
|
||||
onClick={() => onToggle()}
|
||||
>
|
||||
{activeToggle ? (
|
||||
<span>
|
||||
<Spinner />
|
||||
</span>
|
||||
) : (
|
||||
<span>
|
||||
<CircleFadingArrowUp />
|
||||
</span>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
return <LstTable data={data} columns={columns} />;
|
||||
};
|
||||
|
||||
@@ -158,6 +163,7 @@ function RouteComponent() {
|
||||
|
||||
const columnHelper = createColumnHelper<any>();
|
||||
|
||||
console.log(window.location);
|
||||
const logColumns = [
|
||||
columnHelper.accessor("timestamp", {
|
||||
header: ({ column }) => (
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "lst_v3",
|
||||
"version": "0.0.1-alpha.4",
|
||||
"version": "0.0.2-alpha.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "lst_v3",
|
||||
"version": "0.0.1-alpha.4",
|
||||
"version": "0.0.2-alpha.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@dotenvx/dotenvx": "^1.57.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lst_v3",
|
||||
"version": "0.0.1-alpha.4",
|
||||
"version": "0.0.2-alpha.0",
|
||||
"description": "The tool that supports us in our everyday alplaprod",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
|
||||
|
||||
docker build -t git.tuffraid.net/cowch/lst_v3:latest .
|
||||
docker push git.tuffraid.net/cowch/lst_v3:latest
|
||||
|
||||
docker compose pull && docker compose up -d --force-recreate
|
||||
|
||||
How to choose the bump
|
||||
|
||||
Use this rule:
|
||||
|
||||
patch = bug fix, small safe improvement
|
||||
minor = new feature, backward compatible
|
||||
major = breaking change
|
||||
|
||||
Changesets uses semver bump ty
|
||||
|
||||
|
||||
### daily process
|
||||
npm commit
|
||||
|
||||
- when closing a issue at the end add
|
||||
Use one of these in the commit body or PR description:
|
||||
|
||||
- - Closes #123
|
||||
- - Fixes #123
|
||||
- - Resolves #123
|
||||
|
||||
Common ones:
|
||||
|
||||
- - Closes #123
|
||||
- - Fixes #123
|
||||
- - Resolves #123
|
||||
Reference an issue without closing it
|
||||
|
||||
Use:
|
||||
|
||||
- - Refs #123
|
||||
- - Related to #123
|
||||
- - See #123
|
||||
|
||||
Good safe one:
|
||||
|
||||
- - Refs #123
|
||||
Good example commit
|
||||
|
||||
Subject:
|
||||
|
||||
- - fix(cors): normalize external url origin
|
||||
|
||||
Body:
|
||||
|
||||
- - Refs #42
|
||||
|
||||
Or if this should close it:
|
||||
|
||||
- - Closes #42
|
||||
|
||||
# Release flow
|
||||
npm run changeset:add
|
||||
|
||||
Pick one:
|
||||
|
||||
- patch = bug fix
|
||||
- minor = new feature, non-breaking
|
||||
- major = breaking change
|
||||
|
||||
Edit the generated .md file in .changeset it will be randomly named and add anything else in here from all the commits that are new to this release
|
||||
|
||||
Recommended release command
|
||||
npm run changeset:version
|
||||
|
||||
stage the change log file
|
||||
|
||||
git commit -m "chore(release): version packages"
|
||||
|
||||
git tag v0.0.1-alpha.0 change this to the same version thats in the pkg.json
|
||||
|
||||
then push it
|
||||
|
||||
git push
|
||||
git push --tags
|
||||
|
||||
|
||||
|
||||
|
||||
### release type
|
||||
|
||||
when we want to go from alpha to normal well do
|
||||
npx changeset pre enter alpha
|
||||
npx changeset pre enter rc
|
||||
|
||||
go to full production
|
||||
npx changeset pre exit
|
||||
npx changeset version
|
||||
|
||||
### Steps will make it cleaner later
|
||||
Daily work
|
||||
1. Stage files
|
||||
2. npm run commit
|
||||
3. Add issue keyword if needed
|
||||
4. git push when ready
|
||||
|
||||
Release flow
|
||||
1. npx changeset
|
||||
2. pick patch/minor/major
|
||||
3. edit the generated md file with better notes
|
||||
4. npx changeset version
|
||||
5. git add .
|
||||
6. git commit -m "chore(release): version packages"
|
||||
7. git tag vX.X.X
|
||||
8. git push
|
||||
9. git push --tags
|
||||
|
||||
|
||||
# normal work
|
||||
stage files
|
||||
npm run commit
|
||||
|
||||
# if releasing
|
||||
npm run commit
|
||||
npm run release -- --prerelease alpha
|
||||
git push
|
||||
git push --tags
|
||||
|
||||
|
||||
git add .
|
||||
git commit -m "chore(release): version packages"
|
||||
git tag v0.0.1-alpha.0
|
||||
git push
|
||||
git push --tags
|
||||
|
||||
@@ -16,6 +16,7 @@ param (
|
||||
# server migrations get - reminder to add to old version in pkg "start:lst": "cd lstV2 && npm start",
|
||||
# powershell.exe -ExecutionPolicy Bypass -File .\scripts\services.ps1 -serviceName "LST_app" -option "install" -appPath "D:\LST" -description "Logistics Support Tool" -command "run start"
|
||||
# powershell.exe -ExecutionPolicy Bypass -File .\scripts\services.ps1 -serviceName "LSTV2" -option "install" -appPath "D:\LST" -description "Logistics Support Tool" -command "run start:lst"
|
||||
# powershell.exe -ExecutionPolicy Bypass -File .\scripts\services.ps1 -serviceName "LST_ctl" -option "delete" -appPath "D:\LST" -description "Logistics Support Tool" -command "run start:lst"
|
||||
|
||||
$nssmPath = $AppPath + "\nssm.exe"
|
||||
$npmPath = "C:\Program Files\nodejs\npm.cmd" # Path to npm.cmd
|
||||
|
||||
@@ -23,6 +23,8 @@ $password = $ADM_PASSWORD
|
||||
$securePass = ConvertTo-SecureString $password -AsPlainText -Force
|
||||
$credentials = New-Object System.Management.Automation.PSCredential($username, $securePass)
|
||||
|
||||
|
||||
|
||||
function Update-Server {
|
||||
param (
|
||||
[string]$Destination,
|
||||
@@ -84,6 +86,75 @@ function Update-Server {
|
||||
$AppUpdate = {
|
||||
param ($Server, $Token, $Destination, $BuildFile)
|
||||
|
||||
function Fix-Env {
|
||||
$envFile = ".env"
|
||||
|
||||
if (-not (Test-Path $envFile)) {
|
||||
Write-Host ".env not found, creating..."
|
||||
New-Item -ItemType File -Path $envFile | Out-Null
|
||||
}
|
||||
|
||||
$envContent = Get-Content $envFile -Raw
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($envContent)) {
|
||||
$envContent = ""
|
||||
}
|
||||
|
||||
$envVarsToAdd = @{
|
||||
"PROVIDER" = "voidauth"
|
||||
"CLIENT_ID" = "crIVcUilFWIS6ME3"
|
||||
"CLIENT_SECRET" = "zsJeyjMN2yDDqfyzSsh96OtlA2714F5d"
|
||||
"CLIENT_SCOPES" = "openid profile email groups"
|
||||
"DISCOVERY_URL" = "https://auth.tuffraid.net/oidc/.well-known/openid-configuration"
|
||||
}
|
||||
|
||||
$linesToAppend = @()
|
||||
|
||||
foreach ($key in $envVarsToAdd.Keys) {
|
||||
$escapedKey = [regex]::Escape($key)
|
||||
|
||||
if ($envContent -notmatch "(?m)^$escapedKey=") {
|
||||
$linesToAppend += "$key=$($envVarsToAdd[$key])"
|
||||
Write-Host "Adding missing env: $key"
|
||||
}
|
||||
else {
|
||||
Write-Host "Env exists, skipping add: $key"
|
||||
}
|
||||
}
|
||||
|
||||
###### to replace the values of mistakens or something fun where we need to fix across all 17 servers put it here.
|
||||
$envVarsToReplace = @{
|
||||
# "PORT" = "3000"
|
||||
#"URL" = "https://$($Token)prod.alpla.net/lst"
|
||||
}
|
||||
|
||||
foreach ($key in $envVarsToReplace.Keys) {
|
||||
$value = $envVarsToReplace[$key]
|
||||
$escapedKey = [regex]::Escape($key)
|
||||
|
||||
if ($envContent -match "(?m)^$escapedKey=") {
|
||||
Write-Host "Replacing env: $key -> $value"
|
||||
$envContent = $envContent -replace "(?m)^$escapedKey=.*", "$key=$value"
|
||||
}
|
||||
else {
|
||||
Write-Host "Env not found for replace, skipping: $key"
|
||||
}
|
||||
}
|
||||
|
||||
if ($linesToAppend.Count -gt 0) {
|
||||
if ($envContent.Length -gt 0 -and -not $envContent.EndsWith("`n")) {
|
||||
$envContent += "`r`n"
|
||||
}
|
||||
|
||||
$envContent += "`r`n# ---- VoidAuth Config ----`r`n"
|
||||
$envContent += ($linesToAppend -join "`r`n")
|
||||
Write-Host "Appending new env vars."
|
||||
}
|
||||
|
||||
Set-Content -Path $envFile -Value $envContent
|
||||
Write-Host "Env update completed."
|
||||
}
|
||||
|
||||
#convert everything to the server fun
|
||||
$LocalPath = $Destination -replace '\$', ':'
|
||||
$BuildFileLoc = "$LocalPath\$BuildFile"
|
||||
@@ -121,8 +192,12 @@ function Update-Server {
|
||||
Write-Host "Running install/update in: $LocalPath"
|
||||
npm install --omit=dev
|
||||
Start-Sleep -Seconds 3
|
||||
Write-Host "Install/update completed."
|
||||
# do the migrations
|
||||
Write-Host "Install/update completed."
|
||||
|
||||
# update the env to include the new and missing things silly people and wanting things fixed :(
|
||||
Fix-Env #-Path $LocalPath
|
||||
|
||||
# do the migrations
|
||||
# Push-Location $LocalPath
|
||||
Write-Host "Running migrations"
|
||||
npm run dev:db:migrate
|
||||
|
||||
Reference in New Issue
Block a user