From 7d3deec0191c95e60483eccecbea751fe613e0d3 Mon Sep 17 00:00:00 2001 From: naumov Date: Mon, 8 Apr 2024 15:29:10 +0200 Subject: [PATCH] CB-4851 add hardlimit for show more button content in text presentation --- .../TextValue/TextValueTruncatedMessage.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/TextValueTruncatedMessage.tsx b/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/TextValueTruncatedMessage.tsx index 6ed479d0de..ff934e1319 100644 --- a/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/TextValueTruncatedMessage.tsx +++ b/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/TextValueTruncatedMessage.tsx @@ -21,6 +21,8 @@ import type { IDatabaseResultSet } from '../../DatabaseDataModel/IDatabaseResult import { QuotaPlaceholder } from '../QuotaPlaceholder'; import { MAX_BLOB_PREVIEW_SIZE } from './MAX_BLOB_PREVIEW_SIZE'; +const MAX_TEXT_CONTENT_SIZE = 1 * 1048576; + interface Props { resultIndex: number; model: IDatabaseDataModel; @@ -44,9 +46,8 @@ export const TextValueTruncatedMessage = observer(function TextValueTrunc return null; } const isTextColumn = formatAction.isText(elementKey); - - const valueSize = - isResultSetContentValue(contentValue) && isNotNullDefined(contentValue.contentLength) ? bytesToSize(contentValue.contentLength) : undefined; + const valueSize = isResultSetContentValue(contentValue) && isNotNullDefined(contentValue.contentLength) ? contentValue.contentLength : undefined; + const canShowMore = valueSize ? valueSize <= MAX_TEXT_CONTENT_SIZE : true; async function pasteFullText() { try { @@ -58,10 +59,11 @@ export const TextValueTruncatedMessage = observer(function TextValueTrunc return ( - {isTextColumn && ( + {isTextColumn && canShowMore && ( )}