diff --git a/Common/Types/Billing/SubscriptionPlan.ts b/Common/Types/Billing/SubscriptionPlan.ts index e46ad93fdc..63bc1e6699 100644 --- a/Common/Types/Billing/SubscriptionPlan.ts +++ b/Common/Types/Billing/SubscriptionPlan.ts @@ -5,7 +5,7 @@ export enum PlanSelect { Free = 'Free', Growth = 'Growth', Enterprise = 'Enterprise', - Scale = 'Scale' + Scale = 'Scale', } export default class SubscriptionPlan { diff --git a/Common/Types/Code/CodeType.ts b/Common/Types/Code/CodeType.ts index 3103ef4786..d410f3276b 100644 --- a/Common/Types/Code/CodeType.ts +++ b/Common/Types/Code/CodeType.ts @@ -3,7 +3,7 @@ enum CodeType { CSS = 'css', HTML = 'html', JSON = 'json', - Markdown = 'markdown' + Markdown = 'markdown', // TODO add more mime types. } diff --git a/Common/Types/Workflow/WorkflowPlan.ts b/Common/Types/Workflow/WorkflowPlan.ts index e9b503663a..3d20cf1fbd 100644 --- a/Common/Types/Workflow/WorkflowPlan.ts +++ b/Common/Types/Workflow/WorkflowPlan.ts @@ -1,9 +1,8 @@ -enum WorkflowPlan { - "Free" = 0, - "Enterprise"= 9999999, - "Growth" = 500, - "Scale" = 2000 +enum WorkflowPlan { + 'Free' = 0, + 'Enterprise' = 9999999, + 'Growth' = 500, + 'Scale' = 2000, } - -export default WorkflowPlan; \ No newline at end of file +export default WorkflowPlan; diff --git a/Common/Types/Workflow/WorkflowStatus.ts b/Common/Types/Workflow/WorkflowStatus.ts index 0bc40a8dab..c140e198e4 100644 --- a/Common/Types/Workflow/WorkflowStatus.ts +++ b/Common/Types/Workflow/WorkflowStatus.ts @@ -4,7 +4,7 @@ enum WorkflowStatus { Success = 'Success', Error = 'Error', Timeout = 'Timeout', - WorkflowCountExceeded = 'WorkflowCountExceeded' + WorkflowCountExceeded = 'WorkflowCountExceeded', } export default WorkflowStatus; diff --git a/CommonServer/API/BaseAPI.ts b/CommonServer/API/BaseAPI.ts index 9239b48b4f..829c3c5ee2 100644 --- a/CommonServer/API/BaseAPI.ts +++ b/CommonServer/API/BaseAPI.ts @@ -31,12 +31,12 @@ export default class BaseAPI< TBaseModel extends BaseModel, TBaseService extends DatabaseService > { - public entityType: { new(): TBaseModel }; + public entityType: { new (): TBaseModel }; public router: ExpressRouter; public service: TBaseService; - public constructor(type: { new(): TBaseModel }, service: TBaseService) { + public constructor(type: { new (): TBaseModel }, service: TBaseService) { this.entityType = type; const router: ExpressRouter = Express.getRouter(); // Create @@ -363,7 +363,6 @@ export default class BaseAPI< req: ExpressRequest, res: ExpressResponse ): Promise { - await this.onBeforeDelete(req, res); const objectId: ObjectID = new ObjectID(req.params['id'] as string); @@ -381,7 +380,6 @@ export default class BaseAPI< req: ExpressRequest, res: ExpressResponse ): Promise { - await this.onBeforeUpdate(req, res); const objectId: ObjectID = new ObjectID(req.params['id'] as string); const objectIdString: string = objectId.toString(); diff --git a/CommonServer/Services/BillingInvoiceService.ts b/CommonServer/Services/BillingInvoiceService.ts index c90053a7a2..8d278b9c44 100644 --- a/CommonServer/Services/BillingInvoiceService.ts +++ b/CommonServer/Services/BillingInvoiceService.ts @@ -53,7 +53,7 @@ export class Service extends DatabaseService { query: { projectId: findBy.props.tenantId!, }, - limit: LIMIT_PER_PROJECT, + limit: LIMIT_PER_PROJECT, skip: 0, props: { isRoot: true, diff --git a/CommonServer/Services/BillingPaymentMethodService.ts b/CommonServer/Services/BillingPaymentMethodService.ts index 5189d57a8e..ec1804f836 100644 --- a/CommonServer/Services/BillingPaymentMethodService.ts +++ b/CommonServer/Services/BillingPaymentMethodService.ts @@ -53,7 +53,7 @@ export class Service extends DatabaseService { query: { projectId: findBy.props.tenantId!, }, - limit: LIMIT_PER_PROJECT, + limit: LIMIT_PER_PROJECT, skip: 0, props: { isRoot: true, diff --git a/CommonServer/Services/DatabaseService.ts b/CommonServer/Services/DatabaseService.ts index dff43b23f8..ffa06dd9d8 100644 --- a/CommonServer/Services/DatabaseService.ts +++ b/CommonServer/Services/DatabaseService.ts @@ -75,12 +75,12 @@ export interface OnUpdate { class DatabaseService { private postgresDatabase!: PostgresDatabase; - public entityType!: { new(): TBaseModel }; + public entityType!: { new (): TBaseModel }; private model!: TBaseModel; private modelName!: string; public constructor( - modelType: { new(): TBaseModel }, + modelType: { new (): TBaseModel }, postgresDatabase?: PostgresDatabase ) { this.entityType = modelType; @@ -374,8 +374,8 @@ class DatabaseService { createBy.data.getSlugifyColumn() as string ] ? ((createBy.data as any)[ - createBy.data.getSlugifyColumn() as string - ] as string) + createBy.data.getSlugifyColumn() as string + ] as string) : null ); } @@ -807,22 +807,25 @@ class DatabaseService { ignoreHooks: true, }, }); - - - let numberOfDocsAffected: number = 0; + let numberOfDocsAffected: number = 0; if (items.length > 0) { beforeDeleteBy.query = { ...beforeDeleteBy.query, - _id: QueryHelper.in(items.map((i: TBaseModel) => { - return i.id!; - })) - } + _id: QueryHelper.in( + items.map((i: TBaseModel) => { + return i.id!; + }) + ), + }; numberOfDocsAffected = - (await this.getRepository().softDelete(beforeDeleteBy.query as any)) - .affected || 0; + ( + await this.getRepository().softDelete( + beforeDeleteBy.query as any + ) + ).affected || 0; } // hit workflow. @@ -969,10 +972,10 @@ class DatabaseService { if (!tableColumnMetadata.modelType) { throw new BadDataException( 'Populate not supported on ' + - key + - ' of ' + - this.model.singularName + - ' because this column modelType is not found.' + key + + ' of ' + + this.model.singularName + + ' because this column modelType is not found.' ); } @@ -1064,7 +1067,6 @@ class DatabaseService { true )) as QueryDeepPartialEntity; - if (!(updateBy.skip instanceof PositiveNumber)) { updateBy.skip = new PositiveNumber(updateBy.skip); } diff --git a/CommonServer/Services/ScheduledMaintenanceService.ts b/CommonServer/Services/ScheduledMaintenanceService.ts index e738effe04..de0f9b66e1 100644 --- a/CommonServer/Services/ScheduledMaintenanceService.ts +++ b/CommonServer/Services/ScheduledMaintenanceService.ts @@ -110,7 +110,7 @@ export class Service extends DatabaseService { currentScheduledMaintenanceStateId: scheduledMaintenanceStateId.id, }, - skip: 0, + skip: 0, limit: LIMIT_PER_PROJECT, query: { _id: scheduledMaintenanceId.toString()!, diff --git a/CommonServer/Types/Database/DeleteBy.ts b/CommonServer/Types/Database/DeleteBy.ts index db964acb80..210ad4345a 100644 --- a/CommonServer/Types/Database/DeleteBy.ts +++ b/CommonServer/Types/Database/DeleteBy.ts @@ -2,9 +2,10 @@ import DeleteOneBy from './DeleteOneBy'; import BaseModel from 'Common/Models/BaseModel'; import PositiveNumber from 'Common/Types/PositiveNumber'; -interface DeleteBy extends DeleteOneBy{ - limit: PositiveNumber | number; - skip: PositiveNumber | number; +interface DeleteBy + extends DeleteOneBy { + limit: PositiveNumber | number; + skip: PositiveNumber | number; } export default DeleteBy; diff --git a/CommonServer/Types/Database/UpdateBy.ts b/CommonServer/Types/Database/UpdateBy.ts index d250b3bae0..70bb80e714 100644 --- a/CommonServer/Types/Database/UpdateBy.ts +++ b/CommonServer/Types/Database/UpdateBy.ts @@ -2,9 +2,10 @@ import BaseModel from 'Common/Models/BaseModel'; import PositiveNumber from 'Common/Types/PositiveNumber'; import UpdateOneBy from './UpdateOneBy'; -interface UpdateBy extends UpdateOneBy{ - limit: PositiveNumber | number; - skip: PositiveNumber | number; +interface UpdateBy + extends UpdateOneBy { + limit: PositiveNumber | number; + skip: PositiveNumber | number; } export default UpdateBy; diff --git a/CommonServer/Types/Workflow/Components/CreateManyBaseModel.ts b/CommonServer/Types/Workflow/Components/CreateManyBaseModel.ts index 310fd7d53f..dabbfa0083 100644 --- a/CommonServer/Types/Workflow/Components/CreateManyBaseModel.ts +++ b/CommonServer/Types/Workflow/Components/CreateManyBaseModel.ts @@ -51,7 +51,9 @@ export default class CreateManyBaseModel< ); if (!successPort) { - throw options.onError(new BadDataException('Success port not found')); + throw options.onError( + new BadDataException('Success port not found') + ); } const errorPort: Port | undefined = this.getMetadata().outPorts.find( @@ -66,11 +68,15 @@ export default class CreateManyBaseModel< try { if (!this.modelService) { - throw options.onError(new BadDataException('modelService is undefined.')); + throw options.onError( + new BadDataException('modelService is undefined.') + ); } if (!args['json-array']) { - throw options.onError(new BadDataException('json-array is undefined.')); + throw options.onError( + new BadDataException('json-array is undefined.') + ); } if (typeof args['json-array'] === 'string') { @@ -78,9 +84,11 @@ export default class CreateManyBaseModel< } if (!Array.isArray(args['json-array'])) { - throw options.onError(new BadDataException( - 'json-array is should be of type object.' - )); + throw options.onError( + new BadDataException( + 'json-array is should be of type object.' + ) + ); } const array: Array = []; diff --git a/CommonServer/Types/Workflow/Components/CreateOneBaseModel.ts b/CommonServer/Types/Workflow/Components/CreateOneBaseModel.ts index 05e647f0e4..0255355577 100644 --- a/CommonServer/Types/Workflow/Components/CreateOneBaseModel.ts +++ b/CommonServer/Types/Workflow/Components/CreateOneBaseModel.ts @@ -51,7 +51,9 @@ export default class CreateOneBaseModel< ); if (!successPort) { - throw options.onError(new BadDataException('Success port not found')); + throw options.onError( + new BadDataException('Success port not found') + ); } const errorPort: Port | undefined = this.getMetadata().outPorts.find( @@ -66,11 +68,15 @@ export default class CreateOneBaseModel< try { if (!this.modelService) { - throw options.onError(new BadDataException('modelService is undefined.')); + throw options.onError( + new BadDataException('modelService is undefined.') + ); } if (!args['json']) { - throw options.onError(new BadDataException('JSON is undefined.')); + throw options.onError( + new BadDataException('JSON is undefined.') + ); } if (typeof args['json'] === 'string') { @@ -78,7 +84,9 @@ export default class CreateOneBaseModel< } if (typeof args['json'] !== 'object') { - throw options.onError(new BadDataException('JSON is should be of type object.')); + throw options.onError( + new BadDataException('JSON is should be of type object.') + ); } if (this.modelService.getModel().getTenantColumn()) { diff --git a/CommonServer/Types/Workflow/Components/DeleteManyBaseMoidel.ts b/CommonServer/Types/Workflow/Components/DeleteManyBaseMoidel.ts index 73eac5b274..5fd7a1bcd2 100644 --- a/CommonServer/Types/Workflow/Components/DeleteManyBaseMoidel.ts +++ b/CommonServer/Types/Workflow/Components/DeleteManyBaseMoidel.ts @@ -52,7 +52,9 @@ export default class DeleteManyBaseModel< ); if (!successPort) { - throw options.onError(new BadDataException('Success port not found')); + throw options.onError( + new BadDataException('Success port not found') + ); } const errorPort: Port | undefined = this.getMetadata().outPorts.find( @@ -67,11 +69,15 @@ export default class DeleteManyBaseModel< try { if (!this.modelService) { - throw options.onError(new BadDataException('modelService is undefined.')); + throw options.onError( + new BadDataException('modelService is undefined.') + ); } if (!args['query']) { - throw options.onError(new BadDataException('Query is undefined.')); + throw options.onError( + new BadDataException('Query is undefined.') + ); } if (typeof args['query'] === 'string') { @@ -79,9 +85,9 @@ export default class DeleteManyBaseModel< } if (typeof args['query'] !== 'object') { - throw options.onError(new BadDataException( - 'Query is should be of type object.' - )); + throw options.onError( + new BadDataException('Query is should be of type object.') + ); } if (args['skip'] && typeof args['skip'] === 'string') { diff --git a/CommonServer/Types/Workflow/Components/DeleteOneBaseModel.ts b/CommonServer/Types/Workflow/Components/DeleteOneBaseModel.ts index 3c21baf84a..82576afb4c 100644 --- a/CommonServer/Types/Workflow/Components/DeleteOneBaseModel.ts +++ b/CommonServer/Types/Workflow/Components/DeleteOneBaseModel.ts @@ -50,7 +50,9 @@ export default class DeleteOneBaseModel< ); if (!successPort) { - throw options.onError(new BadDataException('Success port not found')); + throw options.onError( + new BadDataException('Success port not found') + ); } const errorPort: Port | undefined = this.getMetadata().outPorts.find( @@ -65,11 +67,15 @@ export default class DeleteOneBaseModel< try { if (!this.modelService) { - throw options.onError(new BadDataException('modelService is undefined.')); + throw options.onError( + new BadDataException('modelService is undefined.') + ); } if (!args['query']) { - throw options.onError(new BadDataException('Query is undefined.')); + throw options.onError( + new BadDataException('Query is undefined.') + ); } if (typeof args['query'] === 'string') { @@ -77,9 +83,9 @@ export default class DeleteOneBaseModel< } if (typeof args['query'] !== 'object') { - throw options.onError(new BadDataException( - 'Query is should be of type object.' - )); + throw options.onError( + new BadDataException('Query is should be of type object.') + ); } if (this.modelService.getModel().getTenantColumn()) { diff --git a/CommonServer/Types/Workflow/Components/FindManyBaseModel.ts b/CommonServer/Types/Workflow/Components/FindManyBaseModel.ts index 3d82c00fa9..357e985a5f 100644 --- a/CommonServer/Types/Workflow/Components/FindManyBaseModel.ts +++ b/CommonServer/Types/Workflow/Components/FindManyBaseModel.ts @@ -54,7 +54,9 @@ export default class FindManyBaseModel< ); if (!successPort) { - throw options.onError(new BadDataException('Success port not found')); + throw options.onError( + new BadDataException('Success port not found') + ); } const errorPort: Port | undefined = this.getMetadata().outPorts.find( @@ -69,11 +71,15 @@ export default class FindManyBaseModel< try { if (!this.modelService) { - throw options.onError(new BadDataException('modelService is undefined.')); + throw options.onError( + new BadDataException('modelService is undefined.') + ); } if (!args['query']) { - throw options.onError(new BadDataException('Query is undefined.')); + throw options.onError( + new BadDataException('Query is undefined.') + ); } if (typeof args['query'] === 'string') { @@ -81,9 +87,9 @@ export default class FindManyBaseModel< } if (typeof args['query'] !== 'object') { - throw options.onError(new BadDataException( - 'Query is should be of type object.' - )); + throw options.onError( + new BadDataException('Query is should be of type object.') + ); } if (this.modelService.getModel().getTenantColumn()) { @@ -93,7 +99,9 @@ export default class FindManyBaseModel< } if (!args['select']) { - throw options.onError(new BadDataException('Select Fields is undefined.')); + throw options.onError( + new BadDataException('Select Fields is undefined.') + ); } if (typeof args['select'] === 'string') { @@ -101,9 +109,11 @@ export default class FindManyBaseModel< } if (typeof args['select'] !== 'object') { - throw options.onError(new BadDataException( - 'Select Fields is should be of type object.' - )); + throw options.onError( + new BadDataException( + 'Select Fields is should be of type object.' + ) + ); } if (args['skip'] && typeof args['skip'] === 'string') { diff --git a/CommonServer/Types/Workflow/Components/FindOneBaseModel.ts b/CommonServer/Types/Workflow/Components/FindOneBaseModel.ts index 3f6dc0dd83..3608c8a18f 100644 --- a/CommonServer/Types/Workflow/Components/FindOneBaseModel.ts +++ b/CommonServer/Types/Workflow/Components/FindOneBaseModel.ts @@ -33,8 +33,8 @@ export default class FindOneBaseModel< if (!BaseModelComponent) { throw new BadDataException( 'Find one component for ' + - modelService.getModel().tableName + - ' not found.' + modelService.getModel().tableName + + ' not found.' ); } this.setMetadata(BaseModelComponent); @@ -52,7 +52,9 @@ export default class FindOneBaseModel< ); if (!successPort) { - throw options.onError(new BadDataException('Success port not found')); + throw options.onError( + new BadDataException('Success port not found') + ); } const errorPort: Port | undefined = this.getMetadata().outPorts.find( @@ -67,11 +69,15 @@ export default class FindOneBaseModel< try { if (!this.modelService) { - throw options.onError(new BadDataException('modelService is undefined.')); + throw options.onError( + new BadDataException('modelService is undefined.') + ); } if (!args['query']) { - throw options.onError(new BadDataException('Query is undefined.')); + throw options.onError( + new BadDataException('Query is undefined.') + ); } if (typeof args['query'] === 'string') { @@ -79,9 +85,9 @@ export default class FindOneBaseModel< } if (typeof args['query'] !== 'object') { - throw options.onError(new BadDataException( - 'Query is should be of type object.' - )); + throw options.onError( + new BadDataException('Query is should be of type object.') + ); } if (this.modelService.getModel().getTenantColumn()) { @@ -91,7 +97,9 @@ export default class FindOneBaseModel< } if (!args['select']) { - throw options.onError(new BadDataException('Select Fields is undefined.')); + throw options.onError( + new BadDataException('Select Fields is undefined.') + ); } if (typeof args['select'] === 'string') { @@ -99,9 +107,11 @@ export default class FindOneBaseModel< } if (typeof args['select'] !== 'object') { - throw options.onError(new BadDataException( - 'Select Fields is should be of type object.' - )); + throw options.onError( + new BadDataException( + 'Select Fields is should be of type object.' + ) + ); } const model: TBaseModel | null = await this.modelService.findOneBy({ @@ -116,15 +126,14 @@ export default class FindOneBaseModel< returnValues: { model: model ? JSONFunctions.toJSON( - model, - this.modelService.entityType - ) + model, + this.modelService.entityType + ) : null, }, executePort: successPort, }; } catch (err: any) { - options.log('Error runnning component'); options.log( diff --git a/CommonServer/Types/Workflow/Components/JavaScript.ts b/CommonServer/Types/Workflow/Components/JavaScript.ts index eac49d46e2..5e0804ad04 100644 --- a/CommonServer/Types/Workflow/Components/JavaScript.ts +++ b/CommonServer/Types/Workflow/Components/JavaScript.ts @@ -38,7 +38,9 @@ export default class JavaScriptCode extends ComponentCode { ); if (!successPort) { - throw options.onError(new BadDataException('Success port not found')); + throw options.onError( + new BadDataException('Success port not found') + ); } const errorPort: Port | undefined = this.getMetadata().outPorts.find( diff --git a/CommonServer/Types/Workflow/Components/OnTriggerBaseModel.ts b/CommonServer/Types/Workflow/Components/OnTriggerBaseModel.ts index a9d869121f..59b6d691f4 100644 --- a/CommonServer/Types/Workflow/Components/OnTriggerBaseModel.ts +++ b/CommonServer/Types/Workflow/Components/OnTriggerBaseModel.ts @@ -102,7 +102,7 @@ export default class OnTriggerBaseModel< workflowId: workflow.id!, returnValues: { data: req.body.data, - } + }, }; promises.push(props.executeWorkflow(executeWorkflow)); diff --git a/CommonServer/Types/Workflow/Components/UpdateManyBaseModel.ts b/CommonServer/Types/Workflow/Components/UpdateManyBaseModel.ts index d0d2afd8d0..1d40b4d081 100644 --- a/CommonServer/Types/Workflow/Components/UpdateManyBaseModel.ts +++ b/CommonServer/Types/Workflow/Components/UpdateManyBaseModel.ts @@ -53,7 +53,9 @@ export default class UpdateManyBaseModel< ); if (!successPort) { - throw options.onError(new BadDataException('Success port not found')); + throw options.onError( + new BadDataException('Success port not found') + ); } const errorPort: Port | undefined = this.getMetadata().outPorts.find( @@ -68,11 +70,15 @@ export default class UpdateManyBaseModel< try { if (!this.modelService) { - throw options.onError(new BadDataException('modelService is undefined.')); + throw options.onError( + new BadDataException('modelService is undefined.') + ); } if (!args['data']) { - throw options.onError(new BadDataException('JSON is undefined.')); + throw options.onError( + new BadDataException('JSON is undefined.') + ); } if (typeof args['data'] === 'string') { @@ -80,7 +86,9 @@ export default class UpdateManyBaseModel< } if (typeof args['data'] !== 'object') { - throw options.onError(new BadDataException('JSON is should be of type object.')); + throw options.onError( + new BadDataException('JSON is should be of type object.') + ); } if (this.modelService.getModel().getTenantColumn()) { @@ -90,7 +98,9 @@ export default class UpdateManyBaseModel< } if (!args['query']) { - throw options.onError(new BadDataException('Query is undefined.')); + throw options.onError( + new BadDataException('Query is undefined.') + ); } if (typeof args['query'] === 'string') { @@ -98,9 +108,9 @@ export default class UpdateManyBaseModel< } if (typeof args['query'] !== 'object') { - throw options.onError(new BadDataException( - 'Query is should be of type object.' - )); + throw options.onError( + new BadDataException('Query is should be of type object.') + ); } if (args['skip'] && typeof args['skip'] === 'string') { diff --git a/CommonServer/Types/Workflow/Components/UpdateOneBaseModel.ts b/CommonServer/Types/Workflow/Components/UpdateOneBaseModel.ts index 539e1be091..4310003923 100644 --- a/CommonServer/Types/Workflow/Components/UpdateOneBaseModel.ts +++ b/CommonServer/Types/Workflow/Components/UpdateOneBaseModel.ts @@ -51,7 +51,9 @@ export default class UpdateOneBaseModel< ); if (!successPort) { - throw options.onError(new BadDataException('Success port not found')); + throw options.onError( + new BadDataException('Success port not found') + ); } const errorPort: Port | undefined = this.getMetadata().outPorts.find( @@ -66,11 +68,15 @@ export default class UpdateOneBaseModel< try { if (!this.modelService) { - throw options.onError(new BadDataException('modelService is undefined.')); + throw options.onError( + new BadDataException('modelService is undefined.') + ); } if (!args['data']) { - throw options.onError(new BadDataException('JSON is undefined.')); + throw options.onError( + new BadDataException('JSON is undefined.') + ); } if (typeof args['data'] === 'string') { @@ -78,7 +84,9 @@ export default class UpdateOneBaseModel< } if (typeof args['data'] !== 'object') { - throw options.onError(new BadDataException('JSON is should be of type object.')); + throw options.onError( + new BadDataException('JSON is should be of type object.') + ); } if (this.modelService.getModel().getTenantColumn()) { @@ -88,7 +96,9 @@ export default class UpdateOneBaseModel< } if (!args['query']) { - throw options.onError(new BadDataException('Query is undefined.')); + throw options.onError( + new BadDataException('Query is undefined.') + ); } if (typeof args['query'] === 'string') { @@ -96,9 +106,9 @@ export default class UpdateOneBaseModel< } if (typeof args['query'] !== 'object') { - throw options.onError(new BadDataException( - 'Query is should be of type object.' - )); + throw options.onError( + new BadDataException('Query is should be of type object.') + ); } if (this.modelService.getModel().getTenantColumn()) { diff --git a/CommonUI/src/Components/CodeEditor/CodeEditor.tsx b/CommonUI/src/Components/CodeEditor/CodeEditor.tsx index 8c8125899a..76bc029f51 100644 --- a/CommonUI/src/Components/CodeEditor/CodeEditor.tsx +++ b/CommonUI/src/Components/CodeEditor/CodeEditor.tsx @@ -32,35 +32,33 @@ const CodeEditor: FunctionComponent = ( const [placeholder, setPlaceholder] = useState(''); - useEffect(()=>{ + useEffect(() => { if (props.type === CodeType.Markdown) { setPlaceholder(``) + -->`); } if (props.type === CodeType.HTML) { setPlaceholder(``) + -->`); } if (props.type === CodeType.JavaScript) { - setPlaceholder(`// ${props.placeholder}. This is in JavaScript.`) + setPlaceholder(`// ${props.placeholder}. This is in JavaScript.`); } if (props.type === CodeType.JSON) { - setPlaceholder(`// ${props.placeholder}. This is in JSON.`) + setPlaceholder(`// ${props.placeholder}. This is in JSON.`); } if (props.type === CodeType.CSS) { - setPlaceholder(`/* ${props.placeholder}. This is in JavaScript. */`) + setPlaceholder( + `/* ${props.placeholder}. This is in JavaScript. */` + ); } - - }, [props.placeholder, props.type]) - - - + }, [props.placeholder, props.type]); if (!props.className) { className = @@ -164,7 +162,7 @@ const CodeEditor: FunctionComponent = ( scrollBeyondLastColumn: 5, scrollBeyondLastLine: true, selectOnLineNumbers: true, - lineNumbers: "off", + lineNumbers: 'off', selectionClipboard: true, selectionHighlight: true, showFoldingControls: 'mouseover', diff --git a/CommonUI/src/Components/Forms/BasicForm.tsx b/CommonUI/src/Components/Forms/BasicForm.tsx index 9e396c844c..6d79228cd3 100644 --- a/CommonUI/src/Components/Forms/BasicForm.tsx +++ b/CommonUI/src/Components/Forms/BasicForm.tsx @@ -130,7 +130,7 @@ const BasicForm: Function = ( if (props.showAsColumns && props.showAsColumns > 2) { throw new BadDataException( 'showAsCOlumns should be <= 2. It is currently ' + - props.showAsColumns + props.showAsColumns ); } @@ -174,7 +174,7 @@ const BasicForm: Function = ( ( placeholder={field.placeholder || ''} initialValue={ initialValues && - (initialValues as any)[fieldName] + (initialValues as any)[fieldName] ? (initialValues as any)[ - fieldName - ] + fieldName + ] : '' } /> @@ -217,61 +217,61 @@ const BasicForm: Function = ( {(field.fieldType === FormFieldSchemaType.Dropdown || field.fieldType === - FormFieldSchemaType.MultiSelectDropdown) && ( - - {({ form }: any) => { - return ( - - | null - ) => { - setCurrentValue({ - ...currentValue, - [fieldName]: value, - }); - field.onChange && - field.onChange(value, form); - await form.setFieldValue( - fieldName, - value, - true - ); - }} - onBlur={async () => { - await form.setFieldTouched( - fieldName, - true - ); - }} - isMultiSelect={ - field.fieldType === - FormFieldSchemaType.MultiSelectDropdown - } - options={field.dropdownOptions || []} - placeholder={field.placeholder || ''} - initialValue={ - initialValues && - (initialValues as any)[fieldName] - ? (initialValues as any)[ - fieldName - ] - : '' - } - /> - ); - }} - - )} + FormFieldSchemaType.MultiSelectDropdown) && ( + + {({ form }: any) => { + return ( + + | null + ) => { + setCurrentValue({ + ...currentValue, + [fieldName]: value, + }); + field.onChange && + field.onChange(value, form); + await form.setFieldValue( + fieldName, + value, + true + ); + }} + onBlur={async () => { + await form.setFieldTouched( + fieldName, + true + ); + }} + isMultiSelect={ + field.fieldType === + FormFieldSchemaType.MultiSelectDropdown + } + options={field.dropdownOptions || []} + placeholder={field.placeholder || ''} + initialValue={ + initialValues && + (initialValues as any)[fieldName] + ? (initialValues as any)[ + fieldName + ] + : '' + } + /> + ); + }} + + )} {field.fieldType === FormFieldSchemaType.RadioButton && ( @@ -280,7 +280,7 @@ const BasicForm: Function = ( ( options={field.radioButtonOptions || []} initialValue={ initialValues && - (initialValues as any)[fieldName] + (initialValues as any)[fieldName] ? (initialValues as any)[ - fieldName - ] + fieldName + ] : '' } /> @@ -320,11 +320,10 @@ const BasicForm: Function = (