Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uat #250

Merged
merged 4 commits into from
May 19, 2024
Merged

Uat #250

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/components/screens/URLTracking/HistoryTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { getCountryName } from 'utils/country';
import date, { DATE_FULL_FORMAT } from 'utils/date';
import { useTrans } from 'utils/i18next';
import { PAGE_SIZE } from 'utils/requests';
import { capitalize } from 'utils/text';
import { capitalize, truncateMiddle } from 'utils/text';

interface Props {
history?: UrlHistoryWithMeta;
Expand Down Expand Up @@ -116,8 +116,8 @@ export const HistoryTable = (props: Props) => {
{UA ? (
<div>
<p>
Device: {capitalize(UA?.getDevice().type) || t('unknown')} {UA?.getDevice().vendor}{' '}
{UA?.getDevice().model}
Device: {UA?.getDevice().vendor} {UA?.getDevice().model}{' '}
{capitalize(UA?.getDevice().type) || t('unknown')}
</p>
<p>OS: {UA?.getOS().name || t('unknown')}</p>
<p>Browser: {UA?.getBrowser().name || t('unknown')}</p>
Expand Down Expand Up @@ -167,7 +167,11 @@ export const HistoryTable = (props: Props) => {
) : (
<>
<UserX className="mr-1 w-6 stroke-2 text-red-500" />
{ref && <p>{ref}</p>}
{ref && (
<div className="max-w-xs" title={ref}>
<p className="line-clamp-1 block text-ellipsis whitespace-nowrap">{truncateMiddle(ref)}</p>
</div>
)}
</>
)}
</td>
Expand Down
4 changes: 2 additions & 2 deletions src/services/queue/rabbit/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const amqp = require('amqplib');
const { logger, isTest } = require('../utils');
const { logger, isTest, isLocal } = require('../utils');
const { postProcessForward } = require('../postProcessForward');


Expand Down Expand Up @@ -27,7 +27,7 @@ async function sendMessageToRabbitQueue(message) {
// Create the queue if it doesn't exist
await channel.assertQueue(queueName, { durable: false });

console.log("Sending...", message)
if (isLocal) console.log("Sending...", message);
// Send the message to the queue
channel.sendToQueue(queueName, Buffer.from(JSON.stringify(message)));

Expand Down
2 changes: 2 additions & 0 deletions src/services/queue/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const connectionString =
const queueName = process.env.AZURE_BUS_QUEUE_NAME || '';

const isTest = process.env.NODE_ENV === 'test';
const isLocal = process.env.NEXT_PUBLIC_BUILD_ENV === 'local';

const logger = pino(
{
Expand All @@ -28,5 +29,6 @@ module.exports = {
connectionString,
queueName,
isTest,
isLocal,
logger,
};
3 changes: 1 addition & 2 deletions src/utils/country.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Locale } from 'types/locale';

export const getCountryName = (code: string, locale: Locale = Locale.English) => {
const regionNames = new Intl.DisplayNames([locale], { type: 'region' });
let countryName: string | undefined = '';
try {
const regionNames = new Intl.DisplayNames([locale], { type: 'region' });
countryName = regionNames.of(code.toUpperCase());
} catch (error) {
console.error('GET COUNTRY NAME ERROR', error);
return '';
}
return countryName;
};
Loading