diff --git a/src/__tests__/api/_test-utils/_all.ts b/src/__tests__/api/_test-utils/_all.ts index a602d46e7..bb9acb1d5 100644 --- a/src/__tests__/api/_test-utils/_all.ts +++ b/src/__tests__/api/_test-utils/_all.ts @@ -1,5 +1,6 @@ import { ConfigDomain } from "backend/lib/config-persistence/types"; import { KeyValueDomain } from "backend/lib/key-value/types"; +import { createCacheService } from "backend/lib/cache"; import { setupAppConfigTestData } from "./_app-config"; import { setupIntegrationsConstantsTestData } from "./_integrations-constants"; import { setupCredentialsTestData } from "./_credentials"; @@ -33,6 +34,8 @@ export const setupAllTestData = async (domains: DomainTypes[]) => { ...portalTestData, ]; + createCacheService().purge(); + await Promise.all( allTestData .filter(([domain]) => { diff --git a/src/backend/lib/cache/RedisCacheAdaptor.ts b/src/backend/lib/cache/RedisCacheAdaptor.ts index db5011fde..39f00d1e5 100644 --- a/src/backend/lib/cache/RedisCacheAdaptor.ts +++ b/src/backend/lib/cache/RedisCacheAdaptor.ts @@ -35,7 +35,9 @@ export class RedisCacheAdaptor extends AbstractCacheService { } async persistData(key: string, data: unknown): Promise { - await (await this.getRedisInstance()).set(key, JSON.stringify(data)); + await ( + await this.getRedisInstance() + ).set(key, JSON.stringify(data), { EX: 60 * 60 }); // I hour } async clearItem(key: string) { diff --git a/src/backend/lib/config-persistence/AbstractConfigDataPersistenceService.ts b/src/backend/lib/config-persistence/AbstractConfigDataPersistenceService.ts index 0b18c003c..1e004ce3b 100644 --- a/src/backend/lib/config-persistence/AbstractConfigDataPersistenceService.ts +++ b/src/backend/lib/config-persistence/AbstractConfigDataPersistenceService.ts @@ -71,6 +71,7 @@ export abstract class AbstractConfigDataPersistenceService { } public async resetState(keyField: keyof T, data: T[]) { + await cacheService.purge(); await this.resetToEmpty(); await this.saveAllItems(keyField, data); } diff --git a/src/frontend/_layouts/utils.ts b/src/frontend/_layouts/utils.ts index df09360b0..476d8759c 100644 --- a/src/frontend/_layouts/utils.ts +++ b/src/frontend/_layouts/utils.ts @@ -1,8 +1,9 @@ import { DataStateKeys } from "frontend/lib/data/types"; -import { ColorSchemes, IThemeSettings } from "shared/types/ui"; +import { AppConfigurationValueType } from "shared/configurations/constants"; +import { ColorSchemes } from "shared/types/ui"; export const getThemePrimaryColor = ( theme: ColorSchemes, - themeColor: DataStateKeys + themeColor: DataStateKeys> ) => theme === "dark" ? themeColor.data?.primaryDark : themeColor.data?.primary; diff --git a/src/frontend/components/SchemaForm/_RenderFormInput.tsx b/src/frontend/components/SchemaForm/_RenderFormInput.tsx index d825b85ae..837560ede 100644 --- a/src/frontend/components/SchemaForm/_RenderFormInput.tsx +++ b/src/frontend/components/SchemaForm/_RenderFormInput.tsx @@ -45,7 +45,7 @@ export function RenderFormInput({ label, required, disabled, - placeholder, + placeholder: placeholder || label, description, ...renderProps, }; diff --git a/src/frontend/design-system/components/Form/FormInput.tsx b/src/frontend/design-system/components/Form/FormInput.tsx index b2cb47af7..5c4594588 100644 --- a/src/frontend/design-system/components/Form/FormInput.tsx +++ b/src/frontend/design-system/components/Form/FormInput.tsx @@ -8,7 +8,7 @@ interface IFormInput extends ISharedFormInput { } export const FormInput: React.FC = (formInput) => { - const { input, type, label, disabled, meta, ...rest } = formInput; + const { input, type, disabled, meta, placeholder, ...rest } = formInput; return wrapLabelAndError( = (formInput) => { {...generateFormArias(meta)} type={type} id={formInput.input.name} - placeholder={label} + placeholder={placeholder} disabled={disabled} />, formInput diff --git a/src/frontend/design-system/components/Form/FormNumberInput.tsx b/src/frontend/design-system/components/Form/FormNumberInput.tsx index 5ad894fd3..338514957 100644 --- a/src/frontend/design-system/components/Form/FormNumberInput.tsx +++ b/src/frontend/design-system/components/Form/FormNumberInput.tsx @@ -18,7 +18,7 @@ const getNumberValue = (value: string | number | null, required: boolean) => { }; export const FormNumberInput: React.FC = (formInput) => { - const { input, label, disabled, meta, allowNegative, required, sm } = + const { input, placeholder, disabled, meta, allowNegative, required, sm } = formInput; if (typeof input.value === "string") { input.onChange(getNumberValue(input.value, !!required)); @@ -35,7 +35,7 @@ export const FormNumberInput: React.FC = (formInput) => { onChange={(e) => { input.onChange(getNumberValue(e.target.value, !!required)); }} - placeholder={label} + placeholder={placeholder} type="number" disabled={disabled} />, diff --git a/src/frontend/design-system/components/Form/FormRichTextArea/index.tsx b/src/frontend/design-system/components/Form/FormRichTextArea/index.tsx index 10973bbbd..386d284a4 100644 --- a/src/frontend/design-system/components/Form/FormRichTextArea/index.tsx +++ b/src/frontend/design-system/components/Form/FormRichTextArea/index.tsx @@ -83,10 +83,6 @@ const Root = styled.div` } `; -interface IFormRichText extends ISharedFormInput { - nothingForNow?: string; -} - const modules = { toolbar: [ [{ size: [] }, { font: [] }], @@ -105,11 +101,12 @@ const modules = { }, }; -export const FormRichTextArea: React.FC = (formInput) => { +export const FormRichTextArea: React.FC = (formInput) => { const { input: { onFocus, onBlur, ...inputProps }, disabled, meta, + placeholder, } = formInput; noop(onBlur, onFocus); return wrapLabelAndError( @@ -120,7 +117,7 @@ export const FormRichTextArea: React.FC = (formInput) => { readOnly={disabled} modules={modules} id={formInput.input.name} - placeholder="Write something..." + placeholder={placeholder} theme="snow" /> , diff --git a/src/frontend/design-system/components/Form/FormSelect/Async/index.tsx b/src/frontend/design-system/components/Form/FormSelect/Async/index.tsx index 6be5266c4..904c75816 100644 --- a/src/frontend/design-system/components/Form/FormSelect/Async/index.tsx +++ b/src/frontend/design-system/components/Form/FormSelect/Async/index.tsx @@ -54,6 +54,7 @@ export function AsyncFormSelect(props: IProps) { label: formLabel, disabledOptions = [], nullable, + placeholder, defaultLabel, } = props; @@ -108,6 +109,7 @@ export function AsyncFormSelect(props: IProps) { classNamePrefix={SharedSelectProps.classNamePrefix} isDisabled={disabled} isLoading={isLoading} + placeholder={placeholder} className={generateClassNames(meta)} value={{ value: input.value, label: valueLabelToUse.value }} loadOptions={(inputValue) => diff --git a/src/frontend/design-system/components/Form/FormSelect/index.tsx b/src/frontend/design-system/components/Form/FormSelect/index.tsx index cab132fb7..07687855c 100644 --- a/src/frontend/design-system/components/Form/FormSelect/index.tsx +++ b/src/frontend/design-system/components/Form/FormSelect/index.tsx @@ -59,6 +59,7 @@ export const FormSelect: React.FC = (props) => { disabledOptions, nullable, defaultLabel, + placeholder, } = props; const selectDataWithDefault = [ { @@ -78,6 +79,7 @@ export const FormSelect: React.FC = (props) => { label: "", } } + placeholder={placeholder} inputId={input.name} onChange={({ value }: any) => { input.onChange(nullable && !value ? null : value); diff --git a/src/frontend/design-system/components/Form/FormTextArea.tsx b/src/frontend/design-system/components/Form/FormTextArea.tsx index 9ca343fc9..4b51e9842 100644 --- a/src/frontend/design-system/components/Form/FormTextArea.tsx +++ b/src/frontend/design-system/components/Form/FormTextArea.tsx @@ -15,7 +15,7 @@ interface IFormTextArea extends ISharedFormInput { } export const FormTextArea: React.FC = (formInput) => { - const { input, rows = 3, label, disabled, meta } = formInput; + const { input, rows = 3, placeholder, disabled, meta } = formInput; return wrapLabelAndError(