Compare commits
6 Commits
feature/IO
...
hotfix/IO-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20747c4091 | ||
|
|
d5bd9d9b59 | ||
|
|
4fc3fbdcc0 | ||
|
|
dc60b8d18e | ||
|
|
32813032e6 | ||
|
|
9a71779cfe |
@@ -1,17 +1,16 @@
|
||||
import { DeleteFilled, DownOutlined, WarningFilled } from "@ant-design/icons";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
import { Checkbox, Divider, Dropdown, Form, Input, InputNumber, Radio, Select, Space, Tag } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component.jsx";
|
||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component";
|
||||
import PartsOrderModalPriceChange from "./parts-order-modal-price-change.component";
|
||||
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component.jsx";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop
|
||||
@@ -33,7 +32,7 @@ export function PartsOrderModalComponent({ bodyshop, vendorList, sendTypeState,
|
||||
});
|
||||
|
||||
const { t } = useTranslation();
|
||||
const handleClick = ({ item, key, keyPath }) => {
|
||||
const handleClick = ({ item }) => {
|
||||
form.setFieldsValue({ comments: item.props.value });
|
||||
};
|
||||
|
||||
@@ -98,17 +97,18 @@ export function PartsOrderModalComponent({ bodyshop, vendorList, sendTypeState,
|
||||
<Checkbox />
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
<Form.Item name="order_type" initialValue="parts_order" label={t("parts_orders.labels.order_type")}>
|
||||
<Radio.Group disabled={sendType === "oec"}>
|
||||
<Radio value={"parts_order"}>{t("parts_orders.labels.parts_order")}</Radio>
|
||||
<Radio value={"sublet"}>{t("parts_orders.labels.sublet_order")}</Radio>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
{!isReturn && (
|
||||
<Form.Item name="order_type" initialValue="parts_order" label={t("parts_orders.labels.order_type")}>
|
||||
<Radio.Group disabled={sendType === "oec"}>
|
||||
<Radio value={"parts_order"}>{t("parts_orders.labels.parts_order")}</Radio>
|
||||
<Radio value={"sublet"}>{t("parts_orders.labels.sublet_order")}</Radio>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
</LayoutFormRow>
|
||||
<Divider orientation="left">{t("parts_orders.labels.inthisorder")}</Divider>
|
||||
<Form.List name={["parts_order_lines", "data"]}>
|
||||
{(fields, { add, remove, move }) => {
|
||||
{(fields, { remove, move }) => {
|
||||
return (
|
||||
<div>
|
||||
{fields.map((field, index) => (
|
||||
|
||||
67
server.js
67
server.js
@@ -28,7 +28,11 @@ const logger = require("./server/utils/logger");
|
||||
const { applyRedisHelpers } = require("./server/utils/redisHelpers");
|
||||
const { applyIOHelpers } = require("./server/utils/ioHelpers");
|
||||
const { redisSocketEvents } = require("./server/web-sockets/redisSocketEvents");
|
||||
const { ElastiCacheClient, DescribeCacheClustersCommand } = require("@aws-sdk/client-elasticache");
|
||||
const {
|
||||
ElastiCacheClient,
|
||||
DescribeCacheClustersCommand,
|
||||
DescribeReplicationGroupsCommand
|
||||
} = require("@aws-sdk/client-elasticache");
|
||||
const { InstanceRegion } = require("./server/utils/instanceMgr");
|
||||
const StartStatusReporter = require("./server/utils/statusReporter");
|
||||
|
||||
@@ -58,7 +62,7 @@ const SOCKETIO_CORS_ORIGIN = [
|
||||
"https://beta.test.imex.online",
|
||||
"https://www.beta.test.imex.online",
|
||||
"https://beta.imex.online",
|
||||
"https://www.beta.imex.online",
|
||||
"https://www.beta.imex.online",
|
||||
"https://www.test.promanager.web-est.com",
|
||||
"https://test.promanager.web-est.com",
|
||||
"https://www.promanager.web-est.com",
|
||||
@@ -124,26 +128,48 @@ const applyRoutes = ({ app }) => {
|
||||
* @returns {Promise<string[]>}
|
||||
*/
|
||||
const getRedisNodesFromAWS = async () => {
|
||||
const client = new ElastiCacheClient({
|
||||
region: InstanceRegion()
|
||||
});
|
||||
|
||||
const params = {
|
||||
ReplicationGroupId: process.env.REDIS_CLUSTER_ID,
|
||||
ShowCacheNodeInfo: true
|
||||
};
|
||||
const client = new ElastiCacheClient({ region: InstanceRegion() });
|
||||
|
||||
try {
|
||||
// Fetch the cache clusters associated with the replication group
|
||||
const command = new DescribeCacheClustersCommand(params);
|
||||
const response = await client.send(command);
|
||||
const cacheClusters = response.CacheClusters;
|
||||
const describeReplicationGroupCommand = new DescribeReplicationGroupsCommand({
|
||||
ReplicationGroupId: process.env.REDIS_CLUSTER_ID
|
||||
});
|
||||
const describeReplicationGroupResponse = await client.send(describeReplicationGroupCommand);
|
||||
|
||||
return cacheClusters.flatMap((cluster) =>
|
||||
cluster.CacheNodes.map((node) => `${node.Endpoint.Address}:${node.Endpoint.Port}`)
|
||||
);
|
||||
//TODO: add checking to make sure there's only 1.
|
||||
const cacheClusterIds = describeReplicationGroupResponse.ReplicationGroups[0].MemberClusters;
|
||||
|
||||
// Ensure cacheClusters exists and is an array
|
||||
if (!cacheClusterIds || !Array.isArray(cacheClusterIds) || cacheClusterIds.length === 0) {
|
||||
logger.log(`No cache clusters found for cluster id ${process.env.REDIS_CLUSTER_ID}`, "ERROR", "redis", "api");
|
||||
return [];
|
||||
}
|
||||
|
||||
const nodeEndpointAddresses = [];
|
||||
|
||||
for (const cluster of cacheClusterIds) {
|
||||
const params = { CacheClusterId: cluster, ShowCacheNodeInfo: true };
|
||||
const command = new DescribeCacheClustersCommand(params);
|
||||
const response = await client.send(command);
|
||||
|
||||
if (response.CacheClusters && Array.isArray(response.CacheClusters)) {
|
||||
// Map nodes to address strings
|
||||
//TODO: What happens if we have more shards?
|
||||
const nodeAddress = `${response.CacheClusters[0].CacheNodes[0].Endpoint.Address}:${response.CacheClusters[0].CacheNodes[0].Endpoint.Port}`;
|
||||
// Debug log node addresses
|
||||
logger.log(`Cluster node addresses: ${nodeAddress}`, "DEBUG", "redis", "api");
|
||||
// Return only those addresses that start with the current cluster id
|
||||
nodeEndpointAddresses.push(nodeAddress);
|
||||
}
|
||||
}
|
||||
|
||||
return nodeEndpointAddresses;
|
||||
// Process each cluster
|
||||
} catch (err) {
|
||||
logger.log(`Error fetching Redis nodes from AWS: ${err.message}`, "ERROR", "redis", "api");
|
||||
logger.log(`Error fetching Redis nodes from AWS:`, "ERROR", "redis", "api", {
|
||||
message: err?.message,
|
||||
stack: err?.stack
|
||||
});
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
@@ -360,7 +386,10 @@ async function handleSigterm() {
|
||||
}
|
||||
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 });
|
||||
logger.log("sigterm-api-error", "ERROR", null, null, {
|
||||
message: error.message,
|
||||
stack: error.stack
|
||||
});
|
||||
}
|
||||
|
||||
process.exit(0);
|
||||
|
||||
Reference in New Issue
Block a user