ToolJet/frontend/src/AppBuilder/CodeEditor/CodeHinter.jsx

158 lines
4.4 KiB
React
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
import { useResolveStore } from '@/_stores/resolverStore';
import { shallow } from 'zustand/shallow';
import './styles.scss';
import SingleLineCodeEditor from './SingleLineCodeEditor';
import MultiLineCodeEditor from './MultiLineCodeEditor';
import usePortal from '@/_hooks/use-portal';
import Tooltip from 'react-bootstrap/Tooltip';
import OverlayTrigger from 'react-bootstrap/OverlayTrigger';
import { isNumber } from 'lodash';
import { Alert } from '@/_ui/Alert/Alert';
Feature: Add JSON datatype to ToolJet Database (#2492) * feat: jsonb datatype support in tooljet database inprogress * feat: jsonb support added for tooljet database column operations as well as create and edit table * feat: added support to query JSONB values in JOIN operation * added dto validation for join operation * Added json data type in tjdb * single line editor bug fixed * Basic UI implementation for create table drawer for jsonb column type * removed the console * Added the sanitization for json default value in the dto * Added jsonb svg for jsonb column type * Updated UI for created column form * Updated UI for edit column form * Change the UI for create row * Updated UI for edit row form * Show dummy {...} value on table cell * Setting up the codehinter in tjdb dashboard * Created codehinter wrapper for tjdb table celljsonb data type * Codehineter for tjdb cell * Made changes in tjdb column and row drawers * removed unwanted code * Added maximum height for codehinter wrapper in each drawers Avoided keydown event in create column drawer * Set max height to codehinter for tjdb table cell * Added jsonb path option for list row operation [rebase] * Added filtering out column with json datatype in udpate rows operation * Added filter option with jsonpath in delete row operation * Made changes for join tables * added json path in jon filter condition * fix: parsing the jsonb default values in view table api * Made on change and initial value value changes for all tjdb dashboard changes * updated intial value and component name for codehinter in all drawers for tooljetdb * Table cell edit codehinter initial value * Updated codehinter onchange and initial value * Added json path field for join sort section * TJDB query manager updates for jsonb column type * Tjdb dashboard bug fixes * fix: joins jsonbpath expression can be sent without single quotes * Added error validation for JSON in codehinter * Removed console * Added codehinter wrapper for tjdb cell * Made default functional * Made set to null functionality working * Toggle functionality for default value * Toggle null functionality * Clean code * create row form added handle disable input click * cutom-footer css and add new data css * Fixed tooltip * Updated tooltip for join codehinters in query manager * fix: jsonb column values validation in server side * Made the initial value empty string if value is undefined * active tab in edit row form bug * Error state in tjdb hinter inside cell * code mirror breaks, on the initial render * Added placeholder and adjusted icon size in dropdown * Fixed: Opening the cell with keyboard nav shows ‘enter to save’. * bug fixed * json icon alignment in the dropdown fixed * In create and edit table, codehinter text is vertcially centered aligned * Create row and update row info message for jsonb column type fixed * SHowing popover when clicked on the jsonb cell * Showing unique constraint in disable state for jsonb * bugfix: bulkupload in tjdb for jsonb datatype should accept different json format * Bug fixed for cellhinter and row form * Avoided flickering in column form * removed console * zindex issue for codehinter in react portal for table cell * Single line editor file changes removed * row form bug fixed * single quotes string escaped as it needs to be inserted as default value in JSONB column * Bug fixed * Edit and create row active tab bug fixed * If value is empty, then dont show error in the codehinter * fix: error handling for invalid jsonpath in join expression * Handled null and Null edge cases for edit and create row * Removed console * Bug fix for save chages button in edit and create row drawer * Error toast message for invalid syntax * removed debounce time * Copied all query manager and codehinter changes from editor to appbuilder directory * Updated imports of codehinter in tjdb forms inside dashboard * Discarded all changes made to editor directory * Removed console * Fixed flickering effect in the edit and create row drawer in TJDB dashboard * Added focused state to codehinter in tjdb drawer, updated font size for the same * Updated error message * bug fixed : Pop up icon not visible inside codehinter * Fixed : border issue in tjdb codehinter * bugfix: array is not allowed to insert in JSONB column (#2734) * Error message in tjdb drawers * Error state for table schema * Error message for cell hinter wrapper * fixed : space between {} and table name in popup * Spacing issue in create and update column UI in query manager fixed * Show tooltip in fk column dropdown * Bug fixed: edit drawer on first render cutom value is always empty * Bug fixed * Reverting react portal changes * bug fixed for error copyright * z index issue fixed for tableschema * reverting back the changes for table form from last commit * Bug fix: Flickering issue in table schema for codehinter input * Bug fixed : toggle bwtween null and default value * Handled spacing between the component name in react portal * added new schema definition as we have introduced jsonb datatype default values can have Object and Array * fix: removed the support for error code mapping for undefined function error because database has different error text for it based on the scenario like jsonb aggregates etc --------- Co-authored-by: Ganesh Kumar <ganesh8056234@gmail.com> Co-authored-by: Ganesh Kumar <40178541+ganesh8056@users.noreply.github.com> Co-authored-by: Akshay <akshaysasidharan93@gmail.com>
2024-11-29 10:43:24 +00:00
import TJDBCodeEditor from './TJDBHinter';
const CODE_EDITOR_TYPE = {
fxEditor: SingleLineCodeEditor.EditorBridge,
basic: SingleLineCodeEditor,
multiline: MultiLineCodeEditor,
extendedSingleLine: SingleLineCodeEditor,
Feature: Add JSON datatype to ToolJet Database (#2492) * feat: jsonb datatype support in tooljet database inprogress * feat: jsonb support added for tooljet database column operations as well as create and edit table * feat: added support to query JSONB values in JOIN operation * added dto validation for join operation * Added json data type in tjdb * single line editor bug fixed * Basic UI implementation for create table drawer for jsonb column type * removed the console * Added the sanitization for json default value in the dto * Added jsonb svg for jsonb column type * Updated UI for created column form * Updated UI for edit column form * Change the UI for create row * Updated UI for edit row form * Show dummy {...} value on table cell * Setting up the codehinter in tjdb dashboard * Created codehinter wrapper for tjdb table celljsonb data type * Codehineter for tjdb cell * Made changes in tjdb column and row drawers * removed unwanted code * Added maximum height for codehinter wrapper in each drawers Avoided keydown event in create column drawer * Set max height to codehinter for tjdb table cell * Added jsonb path option for list row operation [rebase] * Added filtering out column with json datatype in udpate rows operation * Added filter option with jsonpath in delete row operation * Made changes for join tables * added json path in jon filter condition * fix: parsing the jsonb default values in view table api * Made on change and initial value value changes for all tjdb dashboard changes * updated intial value and component name for codehinter in all drawers for tooljetdb * Table cell edit codehinter initial value * Updated codehinter onchange and initial value * Added json path field for join sort section * TJDB query manager updates for jsonb column type * Tjdb dashboard bug fixes * fix: joins jsonbpath expression can be sent without single quotes * Added error validation for JSON in codehinter * Removed console * Added codehinter wrapper for tjdb cell * Made default functional * Made set to null functionality working * Toggle functionality for default value * Toggle null functionality * Clean code * create row form added handle disable input click * cutom-footer css and add new data css * Fixed tooltip * Updated tooltip for join codehinters in query manager * fix: jsonb column values validation in server side * Made the initial value empty string if value is undefined * active tab in edit row form bug * Error state in tjdb hinter inside cell * code mirror breaks, on the initial render * Added placeholder and adjusted icon size in dropdown * Fixed: Opening the cell with keyboard nav shows ‘enter to save’. * bug fixed * json icon alignment in the dropdown fixed * In create and edit table, codehinter text is vertcially centered aligned * Create row and update row info message for jsonb column type fixed * SHowing popover when clicked on the jsonb cell * Showing unique constraint in disable state for jsonb * bugfix: bulkupload in tjdb for jsonb datatype should accept different json format * Bug fixed for cellhinter and row form * Avoided flickering in column form * removed console * zindex issue for codehinter in react portal for table cell * Single line editor file changes removed * row form bug fixed * single quotes string escaped as it needs to be inserted as default value in JSONB column * Bug fixed * Edit and create row active tab bug fixed * If value is empty, then dont show error in the codehinter * fix: error handling for invalid jsonpath in join expression * Handled null and Null edge cases for edit and create row * Removed console * Bug fix for save chages button in edit and create row drawer * Error toast message for invalid syntax * removed debounce time * Copied all query manager and codehinter changes from editor to appbuilder directory * Updated imports of codehinter in tjdb forms inside dashboard * Discarded all changes made to editor directory * Removed console * Fixed flickering effect in the edit and create row drawer in TJDB dashboard * Added focused state to codehinter in tjdb drawer, updated font size for the same * Updated error message * bug fixed : Pop up icon not visible inside codehinter * Fixed : border issue in tjdb codehinter * bugfix: array is not allowed to insert in JSONB column (#2734) * Error message in tjdb drawers * Error state for table schema * Error message for cell hinter wrapper * fixed : space between {} and table name in popup * Spacing issue in create and update column UI in query manager fixed * Show tooltip in fk column dropdown * Bug fixed: edit drawer on first render cutom value is always empty * Bug fixed * Reverting react portal changes * bug fixed for error copyright * z index issue fixed for tableschema * reverting back the changes for table form from last commit * Bug fix: Flickering issue in table schema for codehinter input * Bug fixed : toggle bwtween null and default value * Handled spacing between the component name in react portal * added new schema definition as we have introduced jsonb datatype default values can have Object and Array * fix: removed the support for error code mapping for undefined function error because database has different error text for it based on the scenario like jsonb aggregates etc --------- Co-authored-by: Ganesh Kumar <ganesh8056234@gmail.com> Co-authored-by: Ganesh Kumar <40178541+ganesh8056@users.noreply.github.com> Co-authored-by: Akshay <akshaysasidharan93@gmail.com>
2024-11-29 10:43:24 +00:00
tjdbHinter: TJDBCodeEditor,
};
feat: Form 2.0 (#12941) * init: Added resetOnSubmit, validateOnSubmit properties and exposed formData value * Added the generate form from dropdown menu on the inspector * feat: Added generate form button and fields section * Added the generate column popup UI * feat: Added UI for form fields * feat: Added the UI for new custom field * chore: Added refresh data and custom schema UI * feat: Added the util function to map the JSON to component * chore: cleanup and fixed bugs on dropdown * feat: Added fields property to the form config * feat: save generated fields on form * feat: generated child components from the JSON * fix: bugs on generating component from JSON * chore: added functionality for view properties and styles on field popover * feat: Added local state for add new custom fields * feat: Added logic to create component on submitting new custom field * fix: bugfies on creating a custom fields * feat: Handled grouping of data in the manage column modal * feat: Handled deletion case of the fields * fix: fixed bug on deleting the fields * chore: Updated the form fields logic to store only the necessary values and fetch the remaining values from the component directly using componentId * chore: updated logic to handle fx in mandatory and selected fields * feat: Added functionality to update the component from form fields * fix: bug on componentType typo * chore: written logic to handle the componentType update * feat: Added multiple updates including componentType change * chore: Added few more input components * chore: Moved the form fields property logic to new formComponentSlice * fix: creating a custom field while dragging across the parent components * chore: reverted the deletion logic a bit to properly fetch the parentID from the component * fix: while moving the component with more than 1 form field, it is clearing the complete list * fix: handle the case of moving component from canvas to form * chore: Removed unwanted UI blocks and added logic to conditionally display data section when custom schema is turned off * chore: cleaned up the Dropdownmenu component & added memo to avoid re-render * feat: Added query support and updated logic to display the columns on the modal * chore: cleanup & passed the correct columns to the component * chore: cleaned up the form status constant * chore: wrapped functions in a * chore: created a separate function to create components from form * chore: cleaned up the code to use the same code for component creation * chore: updated the logic for the form field component update * feat: Added functionality for single field popover icons & moved the single field creation out of common function to simplify the field update * fix: removed the deleted fields while refreshing the form * fix: updated the logic for the refresh fields * feat: Added logic to ignore the components to be deleted for regeration of form * chore: moved the component list supported to a constant * fix: Added a backfill logic for the fields property to handle without migration * fix: added a correct key for custom field * fix: Fixed issue on adding custom fields while regenrating the form * fix: Fixed issues on generating form fields while refreshing the FORM * chore: cleanedup the code * chore: Fixed path and merged with main * fix: avoided the multiple re-renders on FORM and fixed the state issue on data & formData * fix: removed the child components from inspector & added a support for query even if it is an array to generate the form * fix: fixed few bugs and design feedbacks * fix: Added a logic to set the width of the dropdown menu same as dropdown trigger * feat: updated the deprecated section for Form * feat: Added a logic to run query on selecting the query on generate form from * fix: changed the logic of selection handled in the manage column modal. The components will be created only if the column is selected. * refactor: moved the manage fields from button to an icon * fix: merged the field definition with the existing default data to show it on manage column popup * feat: focused the codehinter when the rawJson is selected on the dropdown menu * chore: cleanup * feat: update formComponentSlice with latest changes - Fixed getCurrentPageIndex usage in setComponentPropertyByComponentIds - Enhanced component batch operations functionality - Improved form field management logic * Reverted the git changes reflected on the form PR * Reverted the git changes reflected on the form PR * Reverted the git changes reflected on the form PR * fix: fixed the issues due to merge conflict * feat: Removed componentMapping modal for rawJson. Added JsonSchema in the dropdown menu and moved the refresh button inside the modal footer for the queries * fix: Added a loader in the column mapping & updated the styles * chore: cleanup and moves to separate files * chore: cleanup the components * fix: modal was not poping up when I click a different query * chore: cleanedup `ColumnMappingComponent` * fix: fixed bugs on regenerating the forms, shown the loader while running the query, added support for multiple queries etc * chore: removed unwanted props * fix: fixed the undo/redo issues * fix: Fixed the issue on custom fields not showing up on the columnMappingModal * fix: bugfixes like duplicate field, maping popup stays on screen, visibility not working, form loader etc * fix: Fixed the height of the textare and fixed showing the main popover on click of make mandatory button * fix: Fixed the undo redo issue on deleting the form component * fix: removed the undo/redo while saving the form data section * chore: updated the default data for rawJSON * fix: Fixed bugs on toggleswitch, scroll, placeholder etc * fix: Added a condition to render the placeholder input * chore: taken care bito feedback * fix: fixed the modal closing issue * fix: Fixed the gutter issue as the canvas height needs to be updated once the child components are generated * chore: fixed design feedback * fix: Added hover to the modal body instead of each section
2025-06-27 14:38:15 +00:00
const CodeHinter = ({
type = 'basic',
initialValue,
componentName,
disabled,
renderCopilot,
setCodeEditorView,
helpText,
feat: Form 2.0 (#12941) * init: Added resetOnSubmit, validateOnSubmit properties and exposed formData value * Added the generate form from dropdown menu on the inspector * feat: Added generate form button and fields section * Added the generate column popup UI * feat: Added UI for form fields * feat: Added the UI for new custom field * chore: Added refresh data and custom schema UI * feat: Added the util function to map the JSON to component * chore: cleanup and fixed bugs on dropdown * feat: Added fields property to the form config * feat: save generated fields on form * feat: generated child components from the JSON * fix: bugs on generating component from JSON * chore: added functionality for view properties and styles on field popover * feat: Added local state for add new custom fields * feat: Added logic to create component on submitting new custom field * fix: bugfies on creating a custom fields * feat: Handled grouping of data in the manage column modal * feat: Handled deletion case of the fields * fix: fixed bug on deleting the fields * chore: Updated the form fields logic to store only the necessary values and fetch the remaining values from the component directly using componentId * chore: updated logic to handle fx in mandatory and selected fields * feat: Added functionality to update the component from form fields * fix: bug on componentType typo * chore: written logic to handle the componentType update * feat: Added multiple updates including componentType change * chore: Added few more input components * chore: Moved the form fields property logic to new formComponentSlice * fix: creating a custom field while dragging across the parent components * chore: reverted the deletion logic a bit to properly fetch the parentID from the component * fix: while moving the component with more than 1 form field, it is clearing the complete list * fix: handle the case of moving component from canvas to form * chore: Removed unwanted UI blocks and added logic to conditionally display data section when custom schema is turned off * chore: cleaned up the Dropdownmenu component & added memo to avoid re-render * feat: Added query support and updated logic to display the columns on the modal * chore: cleanup & passed the correct columns to the component * chore: cleaned up the form status constant * chore: wrapped functions in a * chore: created a separate function to create components from form * chore: cleaned up the code to use the same code for component creation * chore: updated the logic for the form field component update * feat: Added functionality for single field popover icons & moved the single field creation out of common function to simplify the field update * fix: removed the deleted fields while refreshing the form * fix: updated the logic for the refresh fields * feat: Added logic to ignore the components to be deleted for regeration of form * chore: moved the component list supported to a constant * fix: Added a backfill logic for the fields property to handle without migration * fix: added a correct key for custom field * fix: Fixed issue on adding custom fields while regenrating the form * fix: Fixed issues on generating form fields while refreshing the FORM * chore: cleanedup the code * chore: Fixed path and merged with main * fix: avoided the multiple re-renders on FORM and fixed the state issue on data & formData * fix: removed the child components from inspector & added a support for query even if it is an array to generate the form * fix: fixed few bugs and design feedbacks * fix: Added a logic to set the width of the dropdown menu same as dropdown trigger * feat: updated the deprecated section for Form * feat: Added a logic to run query on selecting the query on generate form from * fix: changed the logic of selection handled in the manage column modal. The components will be created only if the column is selected. * refactor: moved the manage fields from button to an icon * fix: merged the field definition with the existing default data to show it on manage column popup * feat: focused the codehinter when the rawJson is selected on the dropdown menu * chore: cleanup * feat: update formComponentSlice with latest changes - Fixed getCurrentPageIndex usage in setComponentPropertyByComponentIds - Enhanced component batch operations functionality - Improved form field management logic * Reverted the git changes reflected on the form PR * Reverted the git changes reflected on the form PR * Reverted the git changes reflected on the form PR * fix: fixed the issues due to merge conflict * feat: Removed componentMapping modal for rawJson. Added JsonSchema in the dropdown menu and moved the refresh button inside the modal footer for the queries * fix: Added a loader in the column mapping & updated the styles * chore: cleanup and moves to separate files * chore: cleanup the components * fix: modal was not poping up when I click a different query * chore: cleanedup `ColumnMappingComponent` * fix: fixed bugs on regenerating the forms, shown the loader while running the query, added support for multiple queries etc * chore: removed unwanted props * fix: fixed the undo/redo issues * fix: Fixed the issue on custom fields not showing up on the columnMappingModal * fix: bugfixes like duplicate field, maping popup stays on screen, visibility not working, form loader etc * fix: Fixed the height of the textare and fixed showing the main popover on click of make mandatory button * fix: Fixed the undo redo issue on deleting the form component * fix: removed the undo/redo while saving the form data section * chore: updated the default data for rawJSON * fix: Fixed bugs on toggleswitch, scroll, placeholder etc * fix: Added a condition to render the placeholder input * chore: taken care bito feedback * fix: fixed the modal closing issue * fix: Fixed the gutter issue as the canvas height needs to be updated once the child components are generated * chore: fixed design feedback * fix: Added hover to the modal body instead of each section
2025-06-27 14:38:15 +00:00
...restProps
}) => {
const darkMode = localStorage.getItem('darkMode') === 'true';
const [isOpen, setIsOpen] = React.useState(false);
const handleTogglePopupExapand = () => {
const changeOpen = (newOpen) => {
setIsOpen(newOpen);
if (typeof restProps?.popOverCallback === 'function') restProps?.popOverCallback(newOpen);
};
if (!isOpen) {
changeOpen(true);
}
return new Promise((resolve) => {
const element = document.getElementsByClassName('portal-container');
if (element) {
const checkPortalExits = element[0]?.classList.contains(componentName);
if (checkPortalExits === false) {
const parent = element[0].parentNode;
parent.removeChild(element[0]);
}
changeOpen(false);
resolve();
}
}).then(() => {
changeOpen(true);
forceUpdate();
});
};
const [, forceUpdate] = React.useReducer((x) => x + 1, 0);
const RenderCodeEditor = CODE_EDITOR_TYPE[type];
return (
<>
<RenderCodeEditor
renderCopilot={renderCopilot}
type={type}
initialValue={initialValue}
darkMode={darkMode}
portalProps={{
isOpen,
setIsOpen,
handleTogglePopupExapand,
forceUpdate,
}}
componentName={componentName}
disabled={disabled}
setCodeEditorView={setCodeEditorView}
{...restProps}
/>
{helpText && <span className="codehinter-helper-text">{helpText}</span>}
</>
);
};
const Portal = ({ children, ...restProps }) => {
const renderPortal = usePortal({ children, ...restProps });
return <React.Fragment>{renderPortal}</React.Fragment>;
};
2025-02-25 06:52:50 +00:00
const PopupIcon = ({ callback, icon, tip, position, isMultiEditor = false, isQueryManager = false }) => {
const size = 16;
const topRef = isNumber(position?.height) ? Math.floor(position?.height) - 30 : 32;
let top = isMultiEditor ? 270 : topRef > 32 ? topRef : 0;
2025-02-25 06:52:50 +00:00
// for query manager we allow the height of query manager to be dynamic, so we need to render the popup icon at the bottom of code editor
const renderAtBottom = isQueryManager && (isMultiEditor || topRef > 32);
return (
2025-02-25 06:52:50 +00:00
<div
className="d-flex justify-content-end w-100 position-absolute codehinter-popup-icon"
style={renderAtBottom ? { bottom: '30px' } : { top: top }}
>
<OverlayTrigger
trigger={['hover', 'focus']}
placement="top"
delay={{ show: 800, hide: 100 }}
overlay={<Tooltip id="button-tooltip">{tip}</Tooltip>}
>
<img
Feature: Add JSON datatype to ToolJet Database (#2492) * feat: jsonb datatype support in tooljet database inprogress * feat: jsonb support added for tooljet database column operations as well as create and edit table * feat: added support to query JSONB values in JOIN operation * added dto validation for join operation * Added json data type in tjdb * single line editor bug fixed * Basic UI implementation for create table drawer for jsonb column type * removed the console * Added the sanitization for json default value in the dto * Added jsonb svg for jsonb column type * Updated UI for created column form * Updated UI for edit column form * Change the UI for create row * Updated UI for edit row form * Show dummy {...} value on table cell * Setting up the codehinter in tjdb dashboard * Created codehinter wrapper for tjdb table celljsonb data type * Codehineter for tjdb cell * Made changes in tjdb column and row drawers * removed unwanted code * Added maximum height for codehinter wrapper in each drawers Avoided keydown event in create column drawer * Set max height to codehinter for tjdb table cell * Added jsonb path option for list row operation [rebase] * Added filtering out column with json datatype in udpate rows operation * Added filter option with jsonpath in delete row operation * Made changes for join tables * added json path in jon filter condition * fix: parsing the jsonb default values in view table api * Made on change and initial value value changes for all tjdb dashboard changes * updated intial value and component name for codehinter in all drawers for tooljetdb * Table cell edit codehinter initial value * Updated codehinter onchange and initial value * Added json path field for join sort section * TJDB query manager updates for jsonb column type * Tjdb dashboard bug fixes * fix: joins jsonbpath expression can be sent without single quotes * Added error validation for JSON in codehinter * Removed console * Added codehinter wrapper for tjdb cell * Made default functional * Made set to null functionality working * Toggle functionality for default value * Toggle null functionality * Clean code * create row form added handle disable input click * cutom-footer css and add new data css * Fixed tooltip * Updated tooltip for join codehinters in query manager * fix: jsonb column values validation in server side * Made the initial value empty string if value is undefined * active tab in edit row form bug * Error state in tjdb hinter inside cell * code mirror breaks, on the initial render * Added placeholder and adjusted icon size in dropdown * Fixed: Opening the cell with keyboard nav shows ‘enter to save’. * bug fixed * json icon alignment in the dropdown fixed * In create and edit table, codehinter text is vertcially centered aligned * Create row and update row info message for jsonb column type fixed * SHowing popover when clicked on the jsonb cell * Showing unique constraint in disable state for jsonb * bugfix: bulkupload in tjdb for jsonb datatype should accept different json format * Bug fixed for cellhinter and row form * Avoided flickering in column form * removed console * zindex issue for codehinter in react portal for table cell * Single line editor file changes removed * row form bug fixed * single quotes string escaped as it needs to be inserted as default value in JSONB column * Bug fixed * Edit and create row active tab bug fixed * If value is empty, then dont show error in the codehinter * fix: error handling for invalid jsonpath in join expression * Handled null and Null edge cases for edit and create row * Removed console * Bug fix for save chages button in edit and create row drawer * Error toast message for invalid syntax * removed debounce time * Copied all query manager and codehinter changes from editor to appbuilder directory * Updated imports of codehinter in tjdb forms inside dashboard * Discarded all changes made to editor directory * Removed console * Fixed flickering effect in the edit and create row drawer in TJDB dashboard * Added focused state to codehinter in tjdb drawer, updated font size for the same * Updated error message * bug fixed : Pop up icon not visible inside codehinter * Fixed : border issue in tjdb codehinter * bugfix: array is not allowed to insert in JSONB column (#2734) * Error message in tjdb drawers * Error state for table schema * Error message for cell hinter wrapper * fixed : space between {} and table name in popup * Spacing issue in create and update column UI in query manager fixed * Show tooltip in fk column dropdown * Bug fixed: edit drawer on first render cutom value is always empty * Bug fixed * Reverting react portal changes * bug fixed for error copyright * z index issue fixed for tableschema * reverting back the changes for table form from last commit * Bug fix: Flickering issue in table schema for codehinter input * Bug fixed : toggle bwtween null and default value * Handled spacing between the component name in react portal * added new schema definition as we have introduced jsonb datatype default values can have Object and Array * fix: removed the support for error code mapping for undefined function error because database has different error text for it based on the scenario like jsonb aggregates etc --------- Co-authored-by: Ganesh Kumar <ganesh8056234@gmail.com> Co-authored-by: Ganesh Kumar <40178541+ganesh8056@users.noreply.github.com> Co-authored-by: Akshay <akshaysasidharan93@gmail.com>
2024-11-29 10:43:24 +00:00
style={{ zIndex: 10000 }}
className="svg-icon m-2 popup-btn"
src={`assets/images/icons/${icon}.svg`}
width={size}
height={size}
onClick={(e) => {
e.stopPropagation();
callback();
}}
/>
</OverlayTrigger>
</div>
);
};
const DepericatedAlertForWorkspaceVariable = ({ text }) => {
return (
<Alert
svg="tj-info-warning"
cls="codehinter workspace-variables-alert-banner p-1 mb-0 mt-2"
data-cy={``}
imgHeight={18}
imgWidth={18}
>
<div className="d-flex align-items-center">
<div class="">{text}</div>
</div>
</Alert>
);
};
CodeHinter.Portal = Portal;
CodeHinter.PopupIcon = PopupIcon;
CodeHinter.DepericatedAlert = DepericatedAlertForWorkspaceVariable;
CodeHinter.propTypes = {
type: PropTypes.string.isRequired,
disabled: PropTypes.bool,
};
export default CodeHinter;