Merged in release/2024-11-22 (pull request #1959)

Release/2024 11 22
This commit is contained in:
Dave Richer
2024-11-27 18:03:54 +00:00
8 changed files with 73 additions and 12 deletions

View File

@@ -216,7 +216,9 @@ export function JobLinesComponent({
{
title: t("joblines.fields.part_qty"),
dataIndex: "part_qty",
key: "part_qty"
key: "part_qty",
sorter: (a, b) => a.part_qty - b.part_qty,
sortOrder: state.sortedInfo.columnKey === "part_qty" && state.sortedInfo.order
},
// {
// title: t('joblines.fields.tax_part'),

View File

@@ -110,7 +110,13 @@ export function ReportCenterModalComponent({ reportCenterModal, bodyshop }) {
to: values.to,
subject: Templates[values.key]?.subject
},
values.sendbytext === "text" ? values.sendbytext : values.sendbyexcel === "excel" ? "x" : values.sendby === "email" ? "e" : "p",
values.sendbytext === "text"
? values.sendbytext
: values.sendbyexcel === "excel"
? "x"
: values.sendby === "email"
? "e"
: "p",
id
);
setLoading(false);
@@ -274,6 +280,17 @@ export function ReportCenterModalComponent({ reportCenterModal, bodyshop }) {
{
required: true
//message: t("general.validation.required"),
},
{
validator: (_, value) => {
if (value && value[0] && value[1] && process.env.NODE_ENV === "production") {
const diffInDays = (value[1] - value[0]) / (1000 * 3600 * 24);
if (diffInDays > 92) {
return Promise.reject(t("general.validation.dateRangeExceeded"));
}
}
return Promise.resolve();
}
}
]}
>

View File

@@ -2,7 +2,7 @@ import { gql } from "@apollo/client";
export const GET_ALL_JOBLINES_BY_PK = gql`
query GET_ALL_JOBLINES_BY_PK($id: uuid!) {
joblines(where: { jobid: { _eq: $id } }, order_by: { line_no: asc }) {
joblines(where: { jobid: { _eq: $id }, removed: { _eq: false } }, order_by: { line_no: asc }) {
id
line_no
unq_seq

View File

@@ -1289,6 +1289,7 @@
"unsavedchangespopup": "You have unsaved changes. Are you sure you want to leave?"
},
"validation": {
"dateRangeExceeded": "The date range has been exceeded.",
"invalidemail": "Please enter a valid email.",
"invalidphone": "Please enter a valid phone number.",
"required": "{{label}} is required."

View File

@@ -1289,6 +1289,7 @@
"unsavedchangespopup": ""
},
"validation": {
"dateRangeExceeded": "",
"invalidemail": "Por favor introduzca una dirección de correo electrónico válida.",
"invalidphone": "",
"required": "Este campo es requerido."

View File

@@ -1289,6 +1289,7 @@
"unsavedchangespopup": ""
},
"validation": {
"dateRangeExceeded": "",
"invalidemail": "S'il vous plaît entrer un email valide.",
"invalidphone": "",
"required": "Ce champ est requis."

View File

@@ -24,6 +24,8 @@ const { ElastiCacheClient, DescribeCacheClustersCommand } = require("@aws-sdk/cl
const { InstanceRegion } = require("./server/utils/instanceMgr");
const StartStatusReporter = require("./server/utils/statusReporter");
const cleanupTasks = [];
let isShuttingDown = false;
const CLUSTER_RETRY_BASE_DELAY = 100;
const CLUSTER_RETRY_MAX_DELAY = 5000;
const CLUSTER_RETRY_JITTER = 100;
@@ -298,7 +300,14 @@ const main = async () => {
applyRoutes({ app });
redisSocketEvents({ io: ioRedis, redisHelpers, ioHelpers, logger });
StartStatusReporter();
const StatusReporter = StartStatusReporter();
registerCleanupTask(async () => {
StatusReporter.end();
});
// Add SIGTERM signal handler
process.on("SIGTERM", handleSigterm);
process.on("SIGINT", handleSigterm); // Optional: Handle Ctrl+C
try {
await server.listen(port);
@@ -317,3 +326,33 @@ main().catch((error) => {
// Note: If we want the app to crash on all uncaught async operations, we would
// need to put a `process.exit(1);` here
});
// Register a cleanup task
function registerCleanupTask(task) {
cleanupTasks.push(task);
}
// SIGTERM handler
async function handleSigterm() {
if (isShuttingDown) {
logger.log("sigterm-api", "WARN", null, null, { message: "Shutdown already in progress, ignoring signal." });
return;
}
isShuttingDown = true;
logger.log("sigterm-api", "WARN", null, null, { message: "SIGTERM Received. Starting graceful shutdown." });
try {
for (const task of cleanupTasks) {
logger.log("sigterm-api", "WARN", null, null, { message: `Running cleanup task: ${task.name}` });
await task();
}
logger.log("sigterm-api", "WARN", null, null, { message: `All cleanup tasks completed.` });
} catch (error) {
logger.log("sigterm-api-error", "ERROR", null, null, { message: error.message, stack: error.stack });
}
process.exit(0);
}

View File

@@ -11,7 +11,7 @@ const InstanceManager = require("../utils/instanceMgr").default;
function StartStatusReporter() {
//For ImEX Online.
InstanceManager({
return InstanceManager({
executeFunction: true,
args: [],
imex: () => {
@@ -31,14 +31,14 @@ function StartStatusReporter() {
service_id: process.env.CRISP_SERVICE_IDENTIFIER, // Service ID containing the parent Node for Replica (given by Crisp)
node_id: process.env.CRISP_NODE_IDENTIFIER, // Node ID containing Replica (given by Crisp)
replica_id: getHostNameOrIP(), // Unique Replica ID for instance (ie. your IP on the LAN)
interval: 30, // Reporting interval (in seconds; defaults to 30 seconds if not set)
interval: 30 // Reporting interval (in seconds; defaults to 30 seconds if not set)
console: {
debug: (log_message, data) => logger.log("crisp-status-update", "DEBUG", null, null, { log_message, data }),
log: (log_message, data) => logger.log("crisp-status-update", "DEBUG", null, null, { log_message, data }),
warn: (log_message, data) => logger.log("crisp-status-update", "WARN", null, null, { log_message, data }),
error: (log_message, data) => logger.log("crisp-status-update", "ERROR", null, null, { log_message, data })
} // Console instance if you need to debug issues,
// console: {
// debug: (log_message, data) => logger.log("crisp-status-update", "DEBUG", null, null, { log_message, data }),
// log: (log_message, data) => logger.log("crisp-status-update", "DEBUG", null, null, { log_message, data }),
// warn: (log_message, data) => logger.log("crisp-status-update", "WARN", null, null, { log_message, data }),
// error: (log_message, data) => logger.log("crisp-status-update", "ERROR", null, null, { log_message, data })
// } // Console instance if you need to debug issues,
});
return crispStatusReporter;