From c5de58a8ee771130c29009b25dd1c911ae70c873 Mon Sep 17 00:00:00 2001 From: pranavgoel29 Date: Mon, 11 Nov 2024 16:15:54 +0530 Subject: [PATCH 01/17] Fixed the type check logic for the getInputComponent function --- src/pages/Stream/Views/Manage/Alerts.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Stream/Views/Manage/Alerts.tsx b/src/pages/Stream/Views/Manage/Alerts.tsx index 54d33106..d65173b7 100644 --- a/src/pages/Stream/Views/Manage/Alerts.tsx +++ b/src/pages/Stream/Views/Manage/Alerts.tsx @@ -172,7 +172,7 @@ type ColumnRuleProps = { }; const getInputComponent = (type: 'text' | 'number' | 'timestamp') => { - return type === 'text' || 'timestamp' ? TextInput : NumberInput; + return type === 'text' || type === 'timestamp' ? TextInput : NumberInput; }; const ColumnRule = (props: ColumnRuleProps) => { From d1895dcafcb73c3cac7650cc0d2710789010b5dd Mon Sep 17 00:00:00 2001 From: pranavgoel29 Date: Mon, 11 Nov 2024 16:45:43 +0530 Subject: [PATCH 02/17] Removed the duplicate code of HumanizeNumber i.e., convertToReadableScale function and file --- src/utils/convertToReadableScale.ts | 17 ----------------- src/utils/formatBytes.ts | 16 ++++++++-------- 2 files changed, 8 insertions(+), 25 deletions(-) delete mode 100644 src/utils/convertToReadableScale.ts diff --git a/src/utils/convertToReadableScale.ts b/src/utils/convertToReadableScale.ts deleted file mode 100644 index 9c2ca32e..00000000 --- a/src/utils/convertToReadableScale.ts +++ /dev/null @@ -1,17 +0,0 @@ -export const convertToReadableScale = (val: number) => { - // Thousands, millions, billions etc.. - let s = ['', ' K', ' M', ' B', ' T']; - - // Dividing the value by 3. - let sNum = Math.floor(('' + val).length / 3); - - // Calculating the precised value. - let sVal = parseFloat((sNum != 0 ? val / Math.pow(1000, sNum) : val).toPrecision(4)); - - if (sVal % 1 != 0) { - return sVal.toFixed(1) + s[sNum]; - } - - // Appending the letter to precised val. - return sVal + s[sNum]; -}; diff --git a/src/utils/formatBytes.ts b/src/utils/formatBytes.ts index 636acb0b..9feb033d 100644 --- a/src/utils/formatBytes.ts +++ b/src/utils/formatBytes.ts @@ -2,9 +2,8 @@ export const formatBytes = (a: number, b: number = 1) => { if (!+a) return '0 Bytes'; const c = b < 0 ? 0 : b, d = Math.floor(Math.log(a) / Math.log(1024)); - return `${parseFloat((a / Math.pow(1024, d)).toFixed(c))} ${ - ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'][d] - }`; + return `${parseFloat((a / Math.pow(1024, d)).toFixed(c))} ${['Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'][d] + }`; }; export const convertGibToBytes = (value: number) => { @@ -13,15 +12,15 @@ export const convertGibToBytes = (value: number) => { return value * Math.pow(1024, 3); }; -export function HumanizeNumber(val: number) { +export const HumanizeNumber = (val: number) => { // Thousands, millions, billions etc.. - let s = ['', ' K', ' M', ' B', ' T']; + const s = ['', ' K', ' M', ' B', ' T']; // Dividing the value by 3. - let sNum = Math.floor(('' + val).length / 3); + const sNum = Math.floor(('' + val).length / 3); // Calculating the precised value. - let sVal = parseFloat((sNum != 0 ? val / Math.pow(1000, sNum) : val).toPrecision(4)); + const sVal = parseFloat((sNum != 0 ? val / Math.pow(1000, sNum) : val).toPrecision(4)); if (sVal % 1 != 0) { return sVal.toFixed(1) + s[sNum]; @@ -29,7 +28,8 @@ export function HumanizeNumber(val: number) { // Appending the letter to precised val. return sVal + s[sNum]; -} +}; + export const sanitizeEventsCount = (val: any) => { return typeof val === 'number' ? HumanizeNumber(val) : '0'; From cf5973524e7d749519f026e5e659cf2918255626 Mon Sep 17 00:00:00 2001 From: pranavgoel29 Date: Wed, 13 Nov 2024 18:20:53 +0530 Subject: [PATCH 03/17] Fix the semantic tag for roles header and modal header font-weight for OIDC modal --- src/pages/AccessManagement/Roles.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/AccessManagement/Roles.tsx b/src/pages/AccessManagement/Roles.tsx index edc88d2b..814750ed 100644 --- a/src/pages/AccessManagement/Roles.tsx +++ b/src/pages/AccessManagement/Roles.tsx @@ -167,7 +167,9 @@ const Roles: FC = () => { return ( - Roles + + Roles +