diff --git a/lib/errsole.js b/lib/errsole.js index 55876e0..b2b6eb2 100644 --- a/lib/errsole.js +++ b/lib/errsole.js @@ -107,6 +107,7 @@ Errsole.koaProxyMiddleware = function (url) { } }); }; + Errsole.nestExpressProxyMiddleware = function (path, req, res, next) { const options = { hostname: 'localhost', @@ -126,57 +127,30 @@ Errsole.nestExpressProxyMiddleware = function (path, req, res, next) { proxyRes.pipe(res, { end: true }); }); - proxyReq.on('error', (err) => { - res.status(500).send('Proxy request error' + err); - }); - - if (req.method === 'POST' && req.body) { - const bodyData = JSON.stringify(req.body); - proxyReq.setHeader('Content-Type', 'application/json'); - proxyReq.setHeader('Content-Length', Buffer.byteLength(bodyData)); - proxyReq.write(bodyData); - } - - proxyReq.end(); + req.pipe(proxyReq, { end: true }); }; Errsole.nestFastifyProxyMiddleware = function (path, req, res) { - const bodyChunks = []; - req.raw.on('data', chunk => { - bodyChunks.push(chunk); - }); - - req.raw.on('end', () => { - const bodyData = Buffer.concat(bodyChunks).toString(); - const options = { - hostname: 'localhost', - port: this.port, - path: req.url.replace(path, ''), - method: req.method, - headers: { - ...req.headers, - host: 'localhost:' + this.port - } - }; - - const proxyReq = http.request(options, (proxyRes) => { - if (proxyRes.statusCode && proxyRes.headers) { - res.raw.writeHead(proxyRes.statusCode, proxyRes.headers); - } - proxyRes.pipe(res.raw, { end: true }); - }); - - proxyReq.on('error', (err) => { - res.status(500).send('Proxy request error: ' + err); - }); + const options = { + hostname: 'localhost', + port: this.port, + path: req.url.replace(path, ''), + method: req.method, + headers: { + ...req.headers, + host: 'localhost:' + this.port + } + }; - if (req.method === 'POST' && bodyData) { - proxyReq.setHeader('Content-Type', 'application/json'); - proxyReq.setHeader('Content-Length', Buffer.byteLength(bodyData)); - proxyReq.write(bodyData); + const proxyReq = http.request(options, (proxyRes) => { + if (proxyRes.statusCode && proxyRes.headers) { + res.raw.writeHead(proxyRes.statusCode, proxyRes.headers); } - proxyReq.end(); + proxyRes.pipe(res.raw, { end: true }); }); + + // Pipe the incoming request directly to the proxy request + req.raw.pipe(proxyReq, { end: true }); }; Errsole.hapiProxyMiddleware = function (basePath, auth = false) { diff --git a/lib/main/server/utils/alerts.js b/lib/main/server/utils/alerts.js index 10dab50..489f689 100644 --- a/lib/main/server/utils/alerts.js +++ b/lib/main/server/utils/alerts.js @@ -54,7 +54,6 @@ SlackService.sendAlert = async function (message, type, messageExtraInfo, errsol if (data && data.item) { const parsedValue = JSON.parse(data.item.value); if (parsedValue.status === false) { - console.log('Slack integration is disabled.'); return false; // Slack integration is disabled } // create alert url @@ -154,7 +153,6 @@ EmailService.sendAlert = async function (message, type, messageExtraInfo, errsol if (data && data.item) { const parsedValue = JSON.parse(data.item.value); if (parsedValue.status === false) { - console.log('Email integration is disabled.'); return false; // Email integration is disabled } // create alert url diff --git a/lib/web/assets/css/app.css b/lib/web/assets/css/app.css index 1eb81e6..b9aa1e3 100644 --- a/lib/web/assets/css/app.css +++ b/lib/web/assets/css/app.css @@ -152,12 +152,13 @@ body { margin-left: 10px; } -.date-picker-date { - width: 120px !important; +.datetime-picker-date { + width: 125px !important; } -.date-picker-time { - width: 120px !important; +.datetime-picker-time { + width: 125px !important; + margin-left: 10px !important; } .log-btn-apply { @@ -314,7 +315,7 @@ body { } .filter-input-div { - width: calc(100% - 440px); + width: calc(100% - 445px); } .filter-input { diff --git a/lib/web/src/components/ConsoleLogs.js b/lib/web/src/components/ConsoleLogs.js index 24d8a20..ae90ed6 100644 --- a/lib/web/src/components/ConsoleLogs.js +++ b/lib/web/src/components/ConsoleLogs.js @@ -14,7 +14,7 @@ import * as logActions from 'actions/logActions.js'; import * as appActions from 'actions/appActions.js'; /* Ante UI */ -import { DatePicker, TimePicker, Layout, Input, Icon, Button, Collapse, Select, Spin, Switch, Modal, Tooltip, Menu, Dropdown, notification } from 'antd'; +import { DatePicker, TimePicker, Layout, Icon, Button, Collapse, Select, Spin, Switch, Modal, Tooltip, Menu, Dropdown, notification, message } from 'antd'; const cookies = new Cookies(); const { Content } = Layout; @@ -518,11 +518,11 @@ class ConsoleLogs extends React.Component { }); } - handleDateChange(date, dateString) { + handleDateChange (date, dateString) { this.setState({ searchDate: dateString }); // Save the formatted date string } - handleTimeChange(time, timeString) { + handleTimeChange (time, timeString) { this.setState({ searchTime: timeString }); // Save the formatted time string } @@ -860,22 +860,22 @@ class ConsoleLogs extends React.Component {
-
-
+
+ className='datetime-picker-time' + placeholder='Select Time' + onChange={this.handleTimeChange.bind(this)} + format='HH:mm:ss' + value={searchTime ? moment(searchTime, 'HH:mm:ss') : null} + />
diff --git a/lib/web/src/services/httpServices.js b/lib/web/src/services/httpServices.js index 0f4caa8..71edc47 100644 --- a/lib/web/src/services/httpServices.js +++ b/lib/web/src/services/httpServices.js @@ -13,6 +13,7 @@ const URI = getBaseUri(); // Use the dynamic base URI // Set axios defaults axios.defaults.baseURL = URI; axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; +axios.defaults.headers.patch['Content-Type'] = 'application/x-www-form-urlencoded'; axios.defaults.withCredentials = true; // Setup Axios interceptors to attach the JWT