Skip to content

Commit

Permalink
CB-4285 view full text button for ValuePanel + remove truncated warni…
Browse files Browse the repository at this point in the history
…ng if loaded full text
  • Loading branch information
s.teleshev committed Jan 17, 2024
1 parent 6116402 commit 17d9813
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const TextValuePresentation: TabContainerPanelComponent<IDataValuePanelPr
},
}),
);
const { textValue, isFullTextValue, isTruncated, isTextColumn, pasteFullText } = useTextValue({
const { textValue, isTruncated, isTextColumn, pasteFullText } = useTextValue({
model,
resultIndex,
currentContentType: state.currentContentType,
Expand All @@ -124,7 +124,7 @@ export const TextValuePresentation: TabContainerPanelComponent<IDataValuePanelPr
isResultSetContentValue(contentValue) && isNotNullDefined(contentValue.contentLength) ? bytesToSize(contentValue.contentLength) : undefined;
const limit = bytesToSize(quotasService.getQuota('sqlBinaryPreviewMaxLength'));
const canSave = firstSelectedCell && contentAction.isDownloadable(firstSelectedCell);
const shouldShowPasteButton = isTextColumn && isTruncated && !isFullTextValue;
const shouldShowPasteButton = isTextColumn && isTruncated;
const typeExtension = useMemo(() => getTypeExtension(state.currentContentType) ?? [], [state.currentContentType]);
const extensions = useCodemirrorExtensions(undefined, typeExtension);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ interface IUseTextValueArgs {

interface IUseTextValue {
textValue: string;
isFullTextValue: boolean;
isTruncated: boolean;
isTextColumn: boolean;
pasteFullText(): Promise<void>;
Expand All @@ -46,7 +45,6 @@ export function useTextValue({ model, resultIndex, currentContentType }: IUseTex

const result: IUseTextValue = {
textValue: '',
isFullTextValue: false,
isTruncated: false,
isTextColumn,
async pasteFullText() {
Expand All @@ -72,7 +70,7 @@ export function useTextValue({ model, resultIndex, currentContentType }: IUseTex

if (isTextColumn && cachedFullText) {
result.textValue = cachedFullText;
result.isFullTextValue = true;
result.isTruncated = false;
}

if (editAction.isElementEdited(firstSelectedCell)) {
Expand Down
2 changes: 1 addition & 1 deletion webapp/packages/plugin-data-viewer/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default [
['data_viewer_presentation_value_content_value_size', 'Value size'],
['data_viewer_presentation_value_content_download_error', 'Download failed'],
['data_viewer_presentation_value_content_paste_error', 'Cannot load full text'],
['data_viewer_presentation_value_content_full_text_button', 'Paste full text'],
['data_viewer_presentation_value_content_full_text_button', 'View full text'],
['data_viewer_script_preview', 'Script'],
['data_viewer_script_preview_dialog_title', 'Preview changes'],
['data_viewer_script_preview_error_title', "Can't get the script"],
Expand Down
2 changes: 1 addition & 1 deletion webapp/packages/plugin-data-viewer/src/locales/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default [
['data_viewer_presentation_value_content_value_size', 'Value size'],
['data_viewer_presentation_value_content_download_error', 'Download failed'],
['data_viewer_presentation_value_content_paste_error', 'Cannot load full text'],
['data_viewer_presentation_value_content_full_text_button', 'Paste full text'],
['data_viewer_presentation_value_content_full_text_button', 'View full text'],
['data_viewer_refresh_result_set', 'Refresh result set'],
['data_viewer_total_count_tooltip', 'Get total count'],
['data_viewer_total_count_failed', 'Failed to get total count'],
Expand Down
2 changes: 1 addition & 1 deletion webapp/packages/plugin-data-viewer/src/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default [
['data_viewer_presentation_value_content_value_size', 'Размер значения'],
['data_viewer_presentation_value_content_download_error', 'Не удалось загрузить файл'],
['data_viewer_presentation_value_content_paste_error', 'Не удалось загрузить весь текст'],
['data_viewer_presentation_value_content_full_text_button', 'Вставить весь текст'],
['data_viewer_presentation_value_content_full_text_button', 'Посмотреть весь текст'],
['data_viewer_script_preview', 'Скрипт'],
['data_viewer_script_preview_dialog_title', 'Предпросмотр изменений'],
['data_viewer_script_preview_error_title', 'Не удалось получить скрипт'],
Expand Down
2 changes: 1 addition & 1 deletion webapp/packages/plugin-data-viewer/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default [
['data_viewer_presentation_value_content_value_size', 'Value size'],
['data_viewer_presentation_value_content_download_error', 'Download failed'],
['data_viewer_presentation_value_content_paste_error', 'Cannot load full text'],
['data_viewer_presentation_value_content_full_text_button', 'Paste full text'],
['data_viewer_presentation_value_content_full_text_button', 'View full text'],
['data_viewer_script_preview', '脚本'],
['data_viewer_script_preview_dialog_title', '预览更改'],
['data_viewer_script_preview_error_title', '无法获取脚本'],
Expand Down

0 comments on commit 17d9813

Please sign in to comment.