2021-09-15 02:50:55 +00:00
|
|
|
import React from 'react';
|
2021-11-17 17:59:00 +00:00
|
|
|
import cx from 'classnames';
|
2021-09-15 02:50:55 +00:00
|
|
|
import Input from '@/_ui/Input';
|
2021-10-25 09:16:46 +00:00
|
|
|
import Textarea from '@/_ui/Textarea';
|
2021-09-15 02:50:55 +00:00
|
|
|
import Select from '@/_ui/Select';
|
|
|
|
|
import Headers from '@/_ui/HttpHeaders';
|
|
|
|
|
import OAuth from '@/_ui/OAuth';
|
|
|
|
|
import Toggle from '@/_ui/Toggle';
|
2022-04-26 08:44:12 +00:00
|
|
|
import OpenApi from '@/_ui/OpenAPI';
|
2023-04-24 08:10:58 +00:00
|
|
|
import { Checkbox, CheckboxGroup } from '@/_ui/CheckBox';
|
2021-11-17 17:59:00 +00:00
|
|
|
import { CodeHinter } from '@/Editor/CodeBuilder/CodeHinter';
|
2021-09-15 07:40:11 +00:00
|
|
|
import GoogleSheets from '@/_components/Googlesheets';
|
2021-09-15 02:50:55 +00:00
|
|
|
import Slack from '@/_components/Slack';
|
2022-10-06 08:15:42 +00:00
|
|
|
import Zendesk from '@/_components/Zendesk';
|
2022-12-22 20:39:57 +00:00
|
|
|
import ToolJetDbOperations from '@/Editor/QueryManager/QueryEditors/TooljetDatabase/ToolJetDbOperations';
|
2023-07-04 10:02:45 +00:00
|
|
|
import { orgEnvironmentVariableService } from '../_services';
|
2021-09-15 02:50:55 +00:00
|
|
|
|
2021-11-17 17:59:00 +00:00
|
|
|
import { find, isEmpty } from 'lodash';
|
Feature Homepage and settings redesign (#5763)
* adding colors
* feat :: add button
* feat :: added typography
* feat: init storybook
* removes browserlist
* feat :: adding button styles and button component
* feat :: added sass addon
* stories update
* feat :: replacing with radix colors
* danger variants
* updates buttin story
* fix :: removing default items
* cleanup
* fix icons update
* feat :: folder list component
* fix :: naming
* icon and split button :: init
* intermediate save :: app card component
* renaming
* updates
* update for module imports
* updates icon
* update :: homepage design updates
* design changes dashboard
* updates :: apps section
* workspace stting new design upate
* updates dasboard design
* style :: fixes
* feat :: added context for sidebar nav breadcrumb
* added all solid icons
* intermediate update
* change: conditions for fetching users
* sorybook updates
* design updates :: workspace settings page
* manage users page
* lint fixes
* fix :: styling
* stle fixes :: workspace settings
* homepage redesign
* fix :: all drawer colors and position ,teplate page revamp , database page header fixes
* imported all bulk icons
* svg to jsx : bulk icons
* minor :: cleanup
* fix :: manage users drawer
* fix :: searchboxes , userspage fixes
* fix :: all inputs and minor ui fixes
* database page ui fixes
* fix :: database and folder search functionality and iconlist in homecard
* fixed some db functionality and edge cases for longer texts
* fix :: user addition manage user page
* self review cleanup and change in bulk icon fill state
* fix :: homepage seacbar
* merging develop and resolving conflicts
* remove unwanted stories
* reverting merge with develop
* Revert "reverting merge with develop"
This reverts commit 2150c8ec0ce9cedda4f4676211faa3321d4af7f8.
* clearing out warnings
* lint fixes
* feat :: added org modal in database page
* fix :: sso loader theme
* fix :: broken styles select
* fixed icon warning and select ui
* fix :: upload bulk and user select dark mode
* merge styles with develop
* feat :: integrated new ui for database
* removing storybook files
* fix :: all bugs related to users dropdown and cleanup
* fix: user search api for organization page
* cleanup and splitting dropzone component
* fix :: overflow issue in app card time
* fix for scrollbars in homepage
* PR review fixes
* updates :: fix d=global datasource design issues , homepage responsiveness
* tj db operations
* breadcrumb bug fixes
* lint fixes
* removing logs , removed fade in in datasource and database page
* marketplace page ui fix
* removing inital users table fetch
* Pr :: review changes
* remove logs
* fix :: popover bug
* minot style fix
* fix :: remove arrow from all popovers
* fix :: for loading states
* ux :: sidebar items reorder
* style :: fix
* style fix :: templates
* fix :: qa bugs
* fix :: Qa reported bugs
* removes :: folder fetch bug
* share link and datsource bg color fix
* fixes :: rename group ,
* removed logs
* pages popover background fix
* fix :: tj db table addition ui bug
* fix :: ui bug confirm modal password disable
* modal , revert name capitalize in lists, typos fix
* typos , users page route bugfix
* users page header bugfix
* workspace archive btn , datasources form style for select
* groups updated , delete, create flow updated
* avatar bug in profile page fix
* revert styles
* fix :: for create new table nav breadcrumb not being updated
* click state bug fix in avatar
* fix bug with appcard popover
* fix :: text capitalize issue
* fix :: lints and updated icon for filter delete
* fix warnings
---------
Co-authored-by: gandharv <gandharvkumargarg@gmail.com>
Co-authored-by: Vijaykant Yadav <vjy239@gmail.com>
2023-04-21 06:15:48 +00:00
|
|
|
import { ButtonSolid } from './AppButton';
|
2021-09-15 02:50:55 +00:00
|
|
|
|
2021-11-17 17:59:00 +00:00
|
|
|
const DynamicForm = ({
|
|
|
|
|
schema,
|
2023-07-04 10:02:45 +00:00
|
|
|
isGDS,
|
2021-11-17 17:59:00 +00:00
|
|
|
optionchanged,
|
|
|
|
|
createDataSource,
|
|
|
|
|
options,
|
|
|
|
|
isSaving,
|
|
|
|
|
selectedDataSource,
|
|
|
|
|
currentState,
|
2021-11-22 08:22:32 +00:00
|
|
|
isEditMode,
|
|
|
|
|
optionsChanged,
|
2021-12-10 03:09:23 +00:00
|
|
|
queryName,
|
2022-12-20 13:08:51 +00:00
|
|
|
computeSelectStyles = false,
|
2021-11-17 17:59:00 +00:00
|
|
|
}) => {
|
2022-12-27 14:40:33 +00:00
|
|
|
const [computedProps, setComputedProps] = React.useState({});
|
|
|
|
|
|
2023-07-04 10:02:45 +00:00
|
|
|
const [workspaceVariables, setWorkspaceVariables] = React.useState([]);
|
|
|
|
|
|
2021-09-15 02:50:55 +00:00
|
|
|
// if(schema.properties) todo add empty check
|
2022-01-17 07:08:17 +00:00
|
|
|
React.useLayoutEffect(() => {
|
2021-11-22 08:22:32 +00:00
|
|
|
if (!isEditMode || isEmpty(options)) {
|
|
|
|
|
optionsChanged(schema?.defaults ?? {});
|
|
|
|
|
}
|
2023-07-04 10:02:45 +00:00
|
|
|
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (isGDS) {
|
|
|
|
|
orgEnvironmentVariableService.getVariables().then((data) => {
|
|
|
|
|
const client_variables = {};
|
|
|
|
|
const server_variables = {};
|
|
|
|
|
data.variables.map((variable) => {
|
|
|
|
|
if (variable.variable_type === 'server') {
|
|
|
|
|
server_variables[variable.variable_name] = 'HiddenEnvironmentVariable';
|
|
|
|
|
} else {
|
|
|
|
|
client_variables[variable.variable_name] = variable.value;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setWorkspaceVariables({ client: client_variables, server: server_variables });
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
setWorkspaceVariables([]);
|
|
|
|
|
};
|
2021-12-02 06:55:40 +00:00
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2021-11-22 08:22:32 +00:00
|
|
|
}, []);
|
|
|
|
|
|
2022-12-27 14:40:33 +00:00
|
|
|
React.useEffect(() => {
|
|
|
|
|
const { properties } = schema;
|
2023-03-24 11:35:08 +00:00
|
|
|
if (!isEmpty(properties)) {
|
|
|
|
|
let fields = {};
|
|
|
|
|
let encrpytedFieldsProps = {};
|
|
|
|
|
const flipComponentDropdown = find(properties, ['type', 'dropdown-component-flip']);
|
2022-12-27 14:40:33 +00:00
|
|
|
|
2023-03-24 11:35:08 +00:00
|
|
|
if (flipComponentDropdown) {
|
|
|
|
|
const selector = options?.[flipComponentDropdown?.key]?.value;
|
|
|
|
|
fields = { ...flipComponentDropdown?.commonFields, ...properties[selector] };
|
|
|
|
|
} else {
|
|
|
|
|
fields = { ...properties };
|
|
|
|
|
}
|
2022-12-27 14:40:33 +00:00
|
|
|
|
2023-04-22 21:20:17 +00:00
|
|
|
Object.keys(fields).length > 0 &&
|
|
|
|
|
Object.keys(fields).map((key) => {
|
|
|
|
|
const { type, encrypted } = fields[key];
|
|
|
|
|
if ((type === 'password' || encrypted) && !(key in computedProps)) {
|
|
|
|
|
//Editable encrypted fields only if datasource doesn't exists
|
|
|
|
|
encrpytedFieldsProps[key] = {
|
|
|
|
|
disabled: !!selectedDataSource?.id,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
});
|
2023-03-24 11:35:08 +00:00
|
|
|
setComputedProps({ ...computedProps, ...encrpytedFieldsProps });
|
2022-12-27 14:40:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [options]);
|
|
|
|
|
|
2021-09-15 02:50:55 +00:00
|
|
|
const getElement = (type) => {
|
|
|
|
|
switch (type) {
|
|
|
|
|
case 'password':
|
|
|
|
|
case 'text':
|
|
|
|
|
return Input;
|
2021-10-25 09:16:46 +00:00
|
|
|
case 'textarea':
|
|
|
|
|
return Textarea;
|
2021-09-15 02:50:55 +00:00
|
|
|
case 'dropdown':
|
|
|
|
|
return Select;
|
|
|
|
|
case 'toggle':
|
|
|
|
|
return Toggle;
|
2023-04-21 10:05:51 +00:00
|
|
|
case 'checkbox':
|
|
|
|
|
return Checkbox;
|
|
|
|
|
case 'checkbox-group':
|
|
|
|
|
return CheckboxGroup;
|
2022-12-22 20:39:57 +00:00
|
|
|
case 'tooljetdb-operations':
|
|
|
|
|
return ToolJetDbOperations;
|
2021-09-15 02:50:55 +00:00
|
|
|
case 'react-component-headers':
|
|
|
|
|
return Headers;
|
|
|
|
|
case 'react-component-oauth-authentication':
|
|
|
|
|
return OAuth;
|
|
|
|
|
case 'react-component-google-sheets':
|
|
|
|
|
return GoogleSheets;
|
|
|
|
|
case 'react-component-slack':
|
|
|
|
|
return Slack;
|
2021-11-17 17:59:00 +00:00
|
|
|
case 'codehinter':
|
|
|
|
|
return CodeHinter;
|
2022-04-26 08:44:12 +00:00
|
|
|
case 'react-component-openapi-validator':
|
|
|
|
|
return OpenApi;
|
2022-10-06 08:15:42 +00:00
|
|
|
case 'react-component-zendesk':
|
|
|
|
|
return Zendesk;
|
2021-09-15 02:50:55 +00:00
|
|
|
default:
|
|
|
|
|
return <div>Type is invalid</div>;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2022-12-07 08:45:05 +00:00
|
|
|
const handleToggle = (controller) => {
|
|
|
|
|
if (controller) {
|
|
|
|
|
return !options?.[controller]?.value ? ' d-none' : '';
|
|
|
|
|
} else {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-17 17:59:00 +00:00
|
|
|
const getElementProps = ({
|
2022-01-17 07:08:17 +00:00
|
|
|
key,
|
|
|
|
|
list,
|
|
|
|
|
rows = 5,
|
2021-11-17 17:59:00 +00:00
|
|
|
helpText,
|
|
|
|
|
description,
|
|
|
|
|
type,
|
|
|
|
|
placeholder = '',
|
|
|
|
|
mode = 'sql',
|
|
|
|
|
lineNumbers = true,
|
|
|
|
|
initialValue,
|
2021-11-21 04:14:26 +00:00
|
|
|
height = 'auto',
|
2022-02-02 16:59:57 +00:00
|
|
|
width,
|
2021-12-02 06:55:40 +00:00
|
|
|
ignoreBraces = false,
|
2022-02-02 16:59:57 +00:00
|
|
|
className,
|
2022-12-07 08:45:05 +00:00
|
|
|
controller,
|
2021-11-17 17:59:00 +00:00
|
|
|
}) => {
|
2023-05-01 23:50:33 +00:00
|
|
|
const source = schema?.source?.kind;
|
2021-11-17 17:59:00 +00:00
|
|
|
const darkMode = localStorage.getItem('darkMode') === 'true';
|
2023-01-25 06:39:02 +00:00
|
|
|
|
|
|
|
|
if (!options) return;
|
|
|
|
|
|
2021-09-15 02:50:55 +00:00
|
|
|
switch (type) {
|
|
|
|
|
case 'password':
|
|
|
|
|
case 'text':
|
|
|
|
|
case 'textarea':
|
|
|
|
|
return {
|
|
|
|
|
type,
|
2022-12-27 14:40:33 +00:00
|
|
|
placeholder: options?.[key]?.encrypted ? '**************' : description,
|
2022-12-07 08:45:05 +00:00
|
|
|
className: `form-control${handleToggle(controller)}`,
|
2022-03-23 13:05:19 +00:00
|
|
|
value: options?.[key]?.value,
|
2022-01-17 07:08:17 +00:00
|
|
|
...(type === 'textarea' && { rows: rows }),
|
2021-09-15 02:50:55 +00:00
|
|
|
...(helpText && { helpText }),
|
2022-01-17 07:08:17 +00:00
|
|
|
onChange: (e) => optionchanged(key, e.target.value),
|
2023-07-04 10:02:45 +00:00
|
|
|
isGDS,
|
|
|
|
|
workspaceVariables,
|
2021-09-15 02:50:55 +00:00
|
|
|
};
|
|
|
|
|
case 'toggle':
|
|
|
|
|
return {
|
2022-06-06 01:28:04 +00:00
|
|
|
defaultChecked: options?.[key],
|
|
|
|
|
checked: options?.[key]?.value,
|
2022-01-17 07:08:17 +00:00
|
|
|
onChange: (e) => optionchanged(key, e.target.checked),
|
2021-09-15 02:50:55 +00:00
|
|
|
};
|
|
|
|
|
case 'dropdown':
|
|
|
|
|
case 'dropdown-component-flip':
|
|
|
|
|
return {
|
2022-01-17 07:08:17 +00:00
|
|
|
options: list,
|
2022-06-06 01:28:04 +00:00
|
|
|
value: options?.[key]?.value || options?.[key],
|
2022-01-17 07:08:17 +00:00
|
|
|
onChange: (value) => optionchanged(key, value),
|
2022-04-11 11:57:07 +00:00
|
|
|
width: width || '100%',
|
|
|
|
|
useMenuPortal: queryName ? true : false,
|
2022-12-20 13:08:51 +00:00
|
|
|
styles: computeSelectStyles ? computeSelectStyles('100%') : {},
|
2023-01-03 11:42:43 +00:00
|
|
|
useCustomStyles: computeSelectStyles ? true : false,
|
2021-09-15 02:50:55 +00:00
|
|
|
};
|
2023-04-21 10:05:51 +00:00
|
|
|
|
|
|
|
|
case 'checkbox-group':
|
|
|
|
|
return {
|
|
|
|
|
options: list,
|
2023-04-25 09:38:38 +00:00
|
|
|
values: options?.[key] ?? [],
|
|
|
|
|
onChange: (value) => {
|
|
|
|
|
optionchanged(key, [...value]);
|
|
|
|
|
},
|
2023-04-21 10:05:51 +00:00
|
|
|
};
|
|
|
|
|
|
2023-01-16 09:34:12 +00:00
|
|
|
case 'react-component-headers': {
|
|
|
|
|
const isRenderedAsQueryEditor = currentState != null;
|
2021-09-15 02:50:55 +00:00
|
|
|
return {
|
2022-01-17 07:08:17 +00:00
|
|
|
getter: key,
|
2023-01-16 09:34:12 +00:00
|
|
|
options: isRenderedAsQueryEditor
|
|
|
|
|
? options?.[key] ?? schema?.defaults?.[key]
|
|
|
|
|
: options?.[key]?.value ?? schema?.defaults?.[key]?.value,
|
2021-09-15 02:50:55 +00:00
|
|
|
optionchanged,
|
2023-01-16 09:34:12 +00:00
|
|
|
currentState,
|
|
|
|
|
isRenderedAsQueryEditor,
|
2021-09-15 02:50:55 +00:00
|
|
|
};
|
2023-01-16 09:34:12 +00:00
|
|
|
}
|
2021-09-15 02:50:55 +00:00
|
|
|
case 'react-component-oauth-authentication':
|
|
|
|
|
return {
|
2023-05-01 23:50:33 +00:00
|
|
|
isGrpc: source === 'grpc',
|
2023-01-25 06:12:04 +00:00
|
|
|
grant_type: options?.grant_type?.value,
|
|
|
|
|
auth_type: options?.auth_type?.value,
|
|
|
|
|
add_token_to: options?.add_token_to?.value,
|
|
|
|
|
header_prefix: options?.header_prefix?.value,
|
|
|
|
|
access_token_url: options?.access_token_url?.value,
|
|
|
|
|
access_token_custom_headers: options?.access_token_custom_headers?.value,
|
|
|
|
|
client_id: options?.client_id?.value,
|
|
|
|
|
client_secret: options?.client_secret?.value,
|
|
|
|
|
client_auth: options?.client_auth?.value,
|
|
|
|
|
scopes: options?.scopes?.value,
|
|
|
|
|
username: options?.username?.value,
|
|
|
|
|
password: options?.password?.value,
|
2023-05-01 23:50:33 +00:00
|
|
|
grpc_apiKey_key: options?.grpc_apikey_key?.value,
|
|
|
|
|
grpc_apiKey_value: options?.grpc_apikey_value?.value,
|
2023-01-25 06:12:04 +00:00
|
|
|
bearer_token: options?.bearer_token?.value,
|
|
|
|
|
auth_url: options?.auth_url?.value,
|
|
|
|
|
auth_key: options?.auth_key?.value,
|
|
|
|
|
custom_auth_params: options?.custom_auth_params?.value,
|
|
|
|
|
custom_query_params: options?.custom_query_params?.value,
|
|
|
|
|
multiple_auth_enabled: options?.multiple_auth_enabled?.value,
|
2021-09-15 02:50:55 +00:00
|
|
|
optionchanged,
|
|
|
|
|
};
|
|
|
|
|
case 'react-component-google-sheets':
|
|
|
|
|
case 'react-component-slack':
|
2022-10-06 08:15:42 +00:00
|
|
|
case 'react-component-zendesk':
|
2022-12-22 20:39:57 +00:00
|
|
|
return {
|
|
|
|
|
optionchanged,
|
|
|
|
|
createDataSource,
|
|
|
|
|
options,
|
|
|
|
|
isSaving,
|
|
|
|
|
selectedDataSource,
|
|
|
|
|
};
|
|
|
|
|
case 'tooljetdb-operations':
|
|
|
|
|
return {
|
|
|
|
|
currentState,
|
|
|
|
|
optionchanged,
|
|
|
|
|
createDataSource,
|
|
|
|
|
options,
|
|
|
|
|
isSaving,
|
|
|
|
|
selectedDataSource,
|
|
|
|
|
darkMode,
|
|
|
|
|
};
|
2021-11-17 17:59:00 +00:00
|
|
|
case 'codehinter':
|
|
|
|
|
return {
|
|
|
|
|
currentState,
|
2022-01-17 07:08:17 +00:00
|
|
|
initialValue: options[key]
|
|
|
|
|
? typeof options[key] === 'string'
|
|
|
|
|
? options[key]
|
|
|
|
|
: JSON.stringify(options[key])
|
2021-11-17 17:59:00 +00:00
|
|
|
: initialValue,
|
|
|
|
|
mode,
|
|
|
|
|
lineNumbers,
|
2022-02-02 16:59:57 +00:00
|
|
|
className: className ? className : lineNumbers ? 'query-hinter' : 'codehinter-query-editor-input',
|
2022-01-17 07:08:17 +00:00
|
|
|
onChange: (value) => optionchanged(key, value),
|
2021-11-17 17:59:00 +00:00
|
|
|
theme: darkMode ? 'monokai' : lineNumbers ? 'duotone-light' : 'default',
|
|
|
|
|
placeholder,
|
2021-11-21 04:14:26 +00:00
|
|
|
height,
|
2022-02-02 16:59:57 +00:00
|
|
|
width,
|
2022-01-17 07:08:17 +00:00
|
|
|
componentName: queryName ? `${queryName}::${key ?? ''}` : null,
|
2021-12-02 06:55:40 +00:00
|
|
|
ignoreBraces,
|
2022-11-11 05:45:12 +00:00
|
|
|
cyLabel: key ? `${String(key).toLocaleLowerCase().replace(/\s+/g, '-')}` : '',
|
2021-11-17 17:59:00 +00:00
|
|
|
};
|
2022-04-26 08:44:12 +00:00
|
|
|
case 'react-component-openapi-validator':
|
|
|
|
|
return {
|
|
|
|
|
format: options.format?.value,
|
|
|
|
|
definition: options.definition?.value,
|
|
|
|
|
auth_type: options.auth_type?.value,
|
|
|
|
|
auth_key: options.auth_key?.value,
|
|
|
|
|
username: options.username?.value,
|
|
|
|
|
password: options.password?.value,
|
|
|
|
|
bearer_token: options.bearer_token?.value,
|
|
|
|
|
api_keys: options.api_keys?.value,
|
|
|
|
|
optionchanged,
|
|
|
|
|
grant_type: options.grant_type?.value,
|
|
|
|
|
add_token_to: options.add_token_to?.value,
|
|
|
|
|
header_prefix: options.header_prefix?.value,
|
|
|
|
|
access_token_url: options.access_token_url?.value,
|
|
|
|
|
client_id: options.client_id?.value,
|
|
|
|
|
client_secret: options.client_secret?.value,
|
|
|
|
|
client_auth: options.client_auth?.value,
|
|
|
|
|
scopes: options.scopes?.value,
|
|
|
|
|
auth_url: options.auth_url?.value,
|
|
|
|
|
custom_auth_params: options.custom_auth_params?.value,
|
|
|
|
|
custom_query_params: options.custom_query_params?.value,
|
2023-03-24 16:11:21 +00:00
|
|
|
spec: options.spec?.value,
|
2022-04-26 08:44:12 +00:00
|
|
|
};
|
2021-09-15 02:50:55 +00:00
|
|
|
default:
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const getLayout = (obj) => {
|
2021-11-17 17:59:00 +00:00
|
|
|
if (isEmpty(obj)) return null;
|
|
|
|
|
const flipComponentDropdown = isFlipComponentDropdown(obj);
|
|
|
|
|
|
|
|
|
|
if (flipComponentDropdown) {
|
|
|
|
|
return flipComponentDropdown;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-27 14:40:33 +00:00
|
|
|
const handleEncryptedFieldsToggle = (event, field) => {
|
|
|
|
|
const isEditing = computedProps[field]['disabled'];
|
|
|
|
|
setComputedProps({
|
|
|
|
|
...computedProps,
|
|
|
|
|
[field]: {
|
|
|
|
|
...computedProps[field],
|
|
|
|
|
disabled: !isEditing,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (isEditing) {
|
|
|
|
|
optionchanged(field, '');
|
|
|
|
|
} else {
|
|
|
|
|
//Send old field value if editing mode disabled for encrypted fields
|
|
|
|
|
const newOptions = { ...options };
|
|
|
|
|
const oldFieldValue = selectedDataSource?.['options']?.[field];
|
|
|
|
|
optionsChanged({ ...newOptions, [field]: oldFieldValue });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-09-15 02:50:55 +00:00
|
|
|
return (
|
|
|
|
|
<div className="row">
|
|
|
|
|
{Object.keys(obj).map((key) => {
|
2022-01-17 07:08:17 +00:00
|
|
|
const { label, type, encrypted, className } = obj[key];
|
2021-09-15 02:50:55 +00:00
|
|
|
const Element = getElement(type);
|
|
|
|
|
|
|
|
|
|
return (
|
2022-12-27 14:40:33 +00:00
|
|
|
<div className={cx('my-2', { 'col-md-12': !className, [className]: !!className })} key={key}>
|
|
|
|
|
<div className="d-flex align-items-center">
|
|
|
|
|
{label && (
|
|
|
|
|
<label
|
|
|
|
|
className="form-label"
|
|
|
|
|
data-cy={`label-${String(label).toLocaleLowerCase().replace(/\s+/g, '-')}`}
|
|
|
|
|
>
|
|
|
|
|
{label}
|
|
|
|
|
</label>
|
|
|
|
|
)}
|
|
|
|
|
{(type === 'password' || encrypted) && selectedDataSource?.id && (
|
|
|
|
|
<div className="mx-1 col">
|
Feature Homepage and settings redesign (#5763)
* adding colors
* feat :: add button
* feat :: added typography
* feat: init storybook
* removes browserlist
* feat :: adding button styles and button component
* feat :: added sass addon
* stories update
* feat :: replacing with radix colors
* danger variants
* updates buttin story
* fix :: removing default items
* cleanup
* fix icons update
* feat :: folder list component
* fix :: naming
* icon and split button :: init
* intermediate save :: app card component
* renaming
* updates
* update for module imports
* updates icon
* update :: homepage design updates
* design changes dashboard
* updates :: apps section
* workspace stting new design upate
* updates dasboard design
* style :: fixes
* feat :: added context for sidebar nav breadcrumb
* added all solid icons
* intermediate update
* change: conditions for fetching users
* sorybook updates
* design updates :: workspace settings page
* manage users page
* lint fixes
* fix :: styling
* stle fixes :: workspace settings
* homepage redesign
* fix :: all drawer colors and position ,teplate page revamp , database page header fixes
* imported all bulk icons
* svg to jsx : bulk icons
* minor :: cleanup
* fix :: manage users drawer
* fix :: searchboxes , userspage fixes
* fix :: all inputs and minor ui fixes
* database page ui fixes
* fix :: database and folder search functionality and iconlist in homecard
* fixed some db functionality and edge cases for longer texts
* fix :: user addition manage user page
* self review cleanup and change in bulk icon fill state
* fix :: homepage seacbar
* merging develop and resolving conflicts
* remove unwanted stories
* reverting merge with develop
* Revert "reverting merge with develop"
This reverts commit 2150c8ec0ce9cedda4f4676211faa3321d4af7f8.
* clearing out warnings
* lint fixes
* feat :: added org modal in database page
* fix :: sso loader theme
* fix :: broken styles select
* fixed icon warning and select ui
* fix :: upload bulk and user select dark mode
* merge styles with develop
* feat :: integrated new ui for database
* removing storybook files
* fix :: all bugs related to users dropdown and cleanup
* fix: user search api for organization page
* cleanup and splitting dropzone component
* fix :: overflow issue in app card time
* fix for scrollbars in homepage
* PR review fixes
* updates :: fix d=global datasource design issues , homepage responsiveness
* tj db operations
* breadcrumb bug fixes
* lint fixes
* removing logs , removed fade in in datasource and database page
* marketplace page ui fix
* removing inital users table fetch
* Pr :: review changes
* remove logs
* fix :: popover bug
* minot style fix
* fix :: remove arrow from all popovers
* fix :: for loading states
* ux :: sidebar items reorder
* style :: fix
* style fix :: templates
* fix :: qa bugs
* fix :: Qa reported bugs
* removes :: folder fetch bug
* share link and datsource bg color fix
* fixes :: rename group ,
* removed logs
* pages popover background fix
* fix :: tj db table addition ui bug
* fix :: ui bug confirm modal password disable
* modal , revert name capitalize in lists, typos fix
* typos , users page route bugfix
* users page header bugfix
* workspace archive btn , datasources form style for select
* groups updated , delete, create flow updated
* avatar bug in profile page fix
* revert styles
* fix :: for create new table nav breadcrumb not being updated
* click state bug fix in avatar
* fix bug with appcard popover
* fix :: text capitalize issue
* fix :: lints and updated icon for filter delete
* fix warnings
---------
Co-authored-by: gandharv <gandharvkumargarg@gmail.com>
Co-authored-by: Vijaykant Yadav <vjy239@gmail.com>
2023-04-21 06:15:48 +00:00
|
|
|
<ButtonSolid
|
|
|
|
|
className="datasource-edit-btn mb-2"
|
|
|
|
|
type="a"
|
|
|
|
|
variant="tertiary"
|
2022-12-27 14:40:33 +00:00
|
|
|
target="_blank"
|
|
|
|
|
rel="noreferrer"
|
|
|
|
|
onClick={(event) => handleEncryptedFieldsToggle(event, key)}
|
|
|
|
|
>
|
|
|
|
|
{computedProps?.[key]?.['disabled'] ? 'Edit' : 'Cancel'}
|
Feature Homepage and settings redesign (#5763)
* adding colors
* feat :: add button
* feat :: added typography
* feat: init storybook
* removes browserlist
* feat :: adding button styles and button component
* feat :: added sass addon
* stories update
* feat :: replacing with radix colors
* danger variants
* updates buttin story
* fix :: removing default items
* cleanup
* fix icons update
* feat :: folder list component
* fix :: naming
* icon and split button :: init
* intermediate save :: app card component
* renaming
* updates
* update for module imports
* updates icon
* update :: homepage design updates
* design changes dashboard
* updates :: apps section
* workspace stting new design upate
* updates dasboard design
* style :: fixes
* feat :: added context for sidebar nav breadcrumb
* added all solid icons
* intermediate update
* change: conditions for fetching users
* sorybook updates
* design updates :: workspace settings page
* manage users page
* lint fixes
* fix :: styling
* stle fixes :: workspace settings
* homepage redesign
* fix :: all drawer colors and position ,teplate page revamp , database page header fixes
* imported all bulk icons
* svg to jsx : bulk icons
* minor :: cleanup
* fix :: manage users drawer
* fix :: searchboxes , userspage fixes
* fix :: all inputs and minor ui fixes
* database page ui fixes
* fix :: database and folder search functionality and iconlist in homecard
* fixed some db functionality and edge cases for longer texts
* fix :: user addition manage user page
* self review cleanup and change in bulk icon fill state
* fix :: homepage seacbar
* merging develop and resolving conflicts
* remove unwanted stories
* reverting merge with develop
* Revert "reverting merge with develop"
This reverts commit 2150c8ec0ce9cedda4f4676211faa3321d4af7f8.
* clearing out warnings
* lint fixes
* feat :: added org modal in database page
* fix :: sso loader theme
* fix :: broken styles select
* fixed icon warning and select ui
* fix :: upload bulk and user select dark mode
* merge styles with develop
* feat :: integrated new ui for database
* removing storybook files
* fix :: all bugs related to users dropdown and cleanup
* fix: user search api for organization page
* cleanup and splitting dropzone component
* fix :: overflow issue in app card time
* fix for scrollbars in homepage
* PR review fixes
* updates :: fix d=global datasource design issues , homepage responsiveness
* tj db operations
* breadcrumb bug fixes
* lint fixes
* removing logs , removed fade in in datasource and database page
* marketplace page ui fix
* removing inital users table fetch
* Pr :: review changes
* remove logs
* fix :: popover bug
* minot style fix
* fix :: remove arrow from all popovers
* fix :: for loading states
* ux :: sidebar items reorder
* style :: fix
* style fix :: templates
* fix :: qa bugs
* fix :: Qa reported bugs
* removes :: folder fetch bug
* share link and datsource bg color fix
* fixes :: rename group ,
* removed logs
* pages popover background fix
* fix :: tj db table addition ui bug
* fix :: ui bug confirm modal password disable
* modal , revert name capitalize in lists, typos fix
* typos , users page route bugfix
* users page header bugfix
* workspace archive btn , datasources form style for select
* groups updated , delete, create flow updated
* avatar bug in profile page fix
* revert styles
* fix :: for create new table nav breadcrumb not being updated
* click state bug fix in avatar
* fix bug with appcard popover
* fix :: text capitalize issue
* fix :: lints and updated icon for filter delete
* fix warnings
---------
Co-authored-by: gandharv <gandharvkumargarg@gmail.com>
Co-authored-by: Vijaykant Yadav <vjy239@gmail.com>
2023-04-21 06:15:48 +00:00
|
|
|
</ButtonSolid>
|
2022-12-27 14:40:33 +00:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{(type === 'password' || encrypted) && (
|
|
|
|
|
<div className="col-auto mb-2">
|
|
|
|
|
<small className="text-green">
|
2021-09-15 02:50:55 +00:00
|
|
|
<img
|
|
|
|
|
className="mx-2 encrypted-icon"
|
2022-08-27 16:28:24 +00:00
|
|
|
src="assets/images/icons/padlock.svg"
|
2021-09-15 02:50:55 +00:00
|
|
|
width="12"
|
|
|
|
|
height="12"
|
|
|
|
|
/>
|
|
|
|
|
Encrypted
|
|
|
|
|
</small>
|
2022-12-27 14:40:33 +00:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
2022-11-11 05:45:12 +00:00
|
|
|
<Element
|
|
|
|
|
{...getElementProps(obj[key])}
|
2022-12-27 14:40:33 +00:00
|
|
|
{...computedProps[key]}
|
2022-11-11 05:45:12 +00:00
|
|
|
data-cy={`${String(label).toLocaleLowerCase().replace(/\s+/g, '-')}-text-field`}
|
Feature Homepage and settings redesign (#5763)
* adding colors
* feat :: add button
* feat :: added typography
* feat: init storybook
* removes browserlist
* feat :: adding button styles and button component
* feat :: added sass addon
* stories update
* feat :: replacing with radix colors
* danger variants
* updates buttin story
* fix :: removing default items
* cleanup
* fix icons update
* feat :: folder list component
* fix :: naming
* icon and split button :: init
* intermediate save :: app card component
* renaming
* updates
* update for module imports
* updates icon
* update :: homepage design updates
* design changes dashboard
* updates :: apps section
* workspace stting new design upate
* updates dasboard design
* style :: fixes
* feat :: added context for sidebar nav breadcrumb
* added all solid icons
* intermediate update
* change: conditions for fetching users
* sorybook updates
* design updates :: workspace settings page
* manage users page
* lint fixes
* fix :: styling
* stle fixes :: workspace settings
* homepage redesign
* fix :: all drawer colors and position ,teplate page revamp , database page header fixes
* imported all bulk icons
* svg to jsx : bulk icons
* minor :: cleanup
* fix :: manage users drawer
* fix :: searchboxes , userspage fixes
* fix :: all inputs and minor ui fixes
* database page ui fixes
* fix :: database and folder search functionality and iconlist in homecard
* fixed some db functionality and edge cases for longer texts
* fix :: user addition manage user page
* self review cleanup and change in bulk icon fill state
* fix :: homepage seacbar
* merging develop and resolving conflicts
* remove unwanted stories
* reverting merge with develop
* Revert "reverting merge with develop"
This reverts commit 2150c8ec0ce9cedda4f4676211faa3321d4af7f8.
* clearing out warnings
* lint fixes
* feat :: added org modal in database page
* fix :: sso loader theme
* fix :: broken styles select
* fixed icon warning and select ui
* fix :: upload bulk and user select dark mode
* merge styles with develop
* feat :: integrated new ui for database
* removing storybook files
* fix :: all bugs related to users dropdown and cleanup
* fix: user search api for organization page
* cleanup and splitting dropzone component
* fix :: overflow issue in app card time
* fix for scrollbars in homepage
* PR review fixes
* updates :: fix d=global datasource design issues , homepage responsiveness
* tj db operations
* breadcrumb bug fixes
* lint fixes
* removing logs , removed fade in in datasource and database page
* marketplace page ui fix
* removing inital users table fetch
* Pr :: review changes
* remove logs
* fix :: popover bug
* minot style fix
* fix :: remove arrow from all popovers
* fix :: for loading states
* ux :: sidebar items reorder
* style :: fix
* style fix :: templates
* fix :: qa bugs
* fix :: Qa reported bugs
* removes :: folder fetch bug
* share link and datsource bg color fix
* fixes :: rename group ,
* removed logs
* pages popover background fix
* fix :: tj db table addition ui bug
* fix :: ui bug confirm modal password disable
* modal , revert name capitalize in lists, typos fix
* typos , users page route bugfix
* users page header bugfix
* workspace archive btn , datasources form style for select
* groups updated , delete, create flow updated
* avatar bug in profile page fix
* revert styles
* fix :: for create new table nav breadcrumb not being updated
* click state bug fix in avatar
* fix bug with appcard popover
* fix :: text capitalize issue
* fix :: lints and updated icon for filter delete
* fix warnings
---------
Co-authored-by: gandharv <gandharvkumargarg@gmail.com>
Co-authored-by: Vijaykant Yadav <vjy239@gmail.com>
2023-04-21 06:15:48 +00:00
|
|
|
customWrap={true} //to be removed after whole ui is same
|
2022-11-11 05:45:12 +00:00
|
|
|
/>
|
2021-09-15 02:50:55 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-17 17:59:00 +00:00
|
|
|
const isFlipComponentDropdown = (obj) => {
|
|
|
|
|
const flipComponentDropdown = find(obj, ['type', 'dropdown-component-flip']);
|
|
|
|
|
if (flipComponentDropdown) {
|
|
|
|
|
// options[key].value for datasource
|
|
|
|
|
// options[key] for dataquery
|
2022-06-06 01:28:04 +00:00
|
|
|
const selector = options?.[flipComponentDropdown?.key]?.value || options?.[flipComponentDropdown?.key];
|
2021-11-17 17:59:00 +00:00
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div className="row">
|
2022-02-21 18:07:09 +00:00
|
|
|
{flipComponentDropdown.commonFields && getLayout(flipComponentDropdown.commonFields)}
|
|
|
|
|
<div
|
|
|
|
|
className={cx('my-2', {
|
|
|
|
|
'col-md-12': !flipComponentDropdown.className,
|
|
|
|
|
[flipComponentDropdown.className]: !!flipComponentDropdown.className,
|
|
|
|
|
})}
|
|
|
|
|
>
|
2022-11-11 05:45:12 +00:00
|
|
|
{flipComponentDropdown.label && (
|
|
|
|
|
<label
|
|
|
|
|
className="form-label"
|
|
|
|
|
data-cy={`${String(flipComponentDropdown.label)
|
|
|
|
|
.toLocaleLowerCase()
|
|
|
|
|
.replace(/\s+/g, '-')}-dropdown-label`}
|
|
|
|
|
>
|
|
|
|
|
{flipComponentDropdown.label}
|
|
|
|
|
</label>
|
|
|
|
|
)}
|
|
|
|
|
<div data-cy={'query-select-dropdown'}>
|
2022-12-20 13:08:51 +00:00
|
|
|
<Select
|
|
|
|
|
{...getElementProps(flipComponentDropdown)}
|
|
|
|
|
styles={computeSelectStyles ? computeSelectStyles('100%') : {}}
|
2023-01-03 11:42:43 +00:00
|
|
|
useCustomStyles={computeSelectStyles ? true : false}
|
2022-12-20 13:08:51 +00:00
|
|
|
/>
|
2022-11-11 05:45:12 +00:00
|
|
|
</div>
|
2022-02-21 18:07:09 +00:00
|
|
|
{flipComponentDropdown.helpText && (
|
|
|
|
|
<span className="flip-dropdown-help-text">{flipComponentDropdown.helpText}</span>
|
|
|
|
|
)}
|
2021-11-17 17:59:00 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{getLayout(obj[selector])}
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const flipComponentDropdown = isFlipComponentDropdown(schema.properties);
|
2021-09-15 02:50:55 +00:00
|
|
|
|
|
|
|
|
if (flipComponentDropdown) {
|
2021-11-17 17:59:00 +00:00
|
|
|
return flipComponentDropdown;
|
2021-09-15 02:50:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return getLayout(schema.properties);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default DynamicForm;
|