diff --git a/packages/ui/src/assets/settingsSchema.json b/packages/ui/src/assets/settingsSchema.json index 0b152c257..d7d9a84ef 100644 --- a/packages/ui/src/assets/settingsSchema.json +++ b/packages/ui/src/assets/settingsSchema.json @@ -24,6 +24,20 @@ "default": "onHover", "type": "string", "enum": ["onHover", "onSelection"] + }, + "experimentalFeatures": { + "title": "Experimental features", + "description": "Enable / disable experimental features", + "type": "object", + "additionalProperties": false, + "properties": { + "enableDragAndDrop": { + "title": "Enable Drag & Drop", + "description": "Control whether to enable drag and drop feature", + "type": "boolean", + "default": false + } + } } } } diff --git a/packages/ui/src/components/Form/CustomAutoForm.scss b/packages/ui/src/components/Form/CustomAutoForm.scss new file mode 100644 index 000000000..ceed71465 --- /dev/null +++ b/packages/ui/src/components/Form/CustomAutoForm.scss @@ -0,0 +1,4 @@ +form.pf-v5-c-form > div { + display: grid; + gap: var(--pf-v5-c-form--GridGap); +} diff --git a/packages/ui/src/components/Form/CustomAutoForm.tsx b/packages/ui/src/components/Form/CustomAutoForm.tsx index 837cccb63..54b61394e 100644 --- a/packages/ui/src/components/Form/CustomAutoForm.tsx +++ b/packages/ui/src/components/Form/CustomAutoForm.tsx @@ -4,6 +4,7 @@ import { useSchemaBridgeContext } from '../../hooks'; import { IDataTestID } from '../../models'; import { CustomAutoFieldDetector } from './CustomAutoField'; import { CustomAutoFields } from './CustomAutoFields'; +import './CustomAutoForm.scss'; interface CustomAutoFormProps extends IDataTestID { model: unknown; diff --git a/packages/ui/src/models/settings/localstorage-settings-adapter.test.ts b/packages/ui/src/models/settings/localstorage-settings-adapter.test.ts index a5490c442..e2b4cee73 100644 --- a/packages/ui/src/models/settings/localstorage-settings-adapter.test.ts +++ b/packages/ui/src/models/settings/localstorage-settings-adapter.test.ts @@ -15,6 +15,9 @@ describe('LocalStorageSettingsAdapter', () => { catalogUrl: 'http://example.com', nodeLabel: NodeLabelType.Description, nodeToolbarTrigger: NodeToolbarTrigger.onSelection, + experimentalFeatures: { + enableDragAndDrop: true, + }, }; adapter.saveSettings(newSettings); @@ -38,6 +41,9 @@ describe('LocalStorageSettingsAdapter', () => { catalogUrl: 'http://example.com', nodeLabel: NodeLabelType.Description, nodeToolbarTrigger: NodeToolbarTrigger.onSelection, + experimentalFeatures: { + enableDragAndDrop: true, + }, }; adapter.saveSettings(newSettings); diff --git a/packages/ui/src/models/settings/settings.model.ts b/packages/ui/src/models/settings/settings.model.ts index a540d46be..bfa077fac 100644 --- a/packages/ui/src/models/settings/settings.model.ts +++ b/packages/ui/src/models/settings/settings.model.ts @@ -12,6 +12,9 @@ export interface ISettingsModel { catalogUrl: string; nodeLabel: NodeLabelType; nodeToolbarTrigger: NodeToolbarTrigger; + experimentalFeatures: { + enableDragAndDrop: boolean; + }; } export interface AbstractSettingsAdapter { @@ -23,6 +26,9 @@ export class SettingsModel implements ISettingsModel { catalogUrl: string = ''; nodeLabel: NodeLabelType = NodeLabelType.Description; nodeToolbarTrigger: NodeToolbarTrigger = NodeToolbarTrigger.onHover; + experimentalFeatures = { + enableDragAndDrop: false, + }; constructor(options: Partial = {}) { Object.assign(this, options); diff --git a/packages/ui/src/multiplying-architecture/KaotoEditorFactory.test.ts b/packages/ui/src/multiplying-architecture/KaotoEditorFactory.test.ts index d13b153c2..7186abee8 100644 --- a/packages/ui/src/multiplying-architecture/KaotoEditorFactory.test.ts +++ b/packages/ui/src/multiplying-architecture/KaotoEditorFactory.test.ts @@ -16,6 +16,9 @@ describe('KaotoEditorFactory', () => { catalogUrl: 'catalog-url', nodeLabel: NodeLabelType.Id, nodeToolbarTrigger: NodeToolbarTrigger.onHover, + experimentalFeatures: { + enableDragAndDrop: false, + }, }; const envelopeContext = { @@ -41,6 +44,9 @@ describe('KaotoEditorFactory', () => { catalogUrl: 'catalog-url', nodeLabel: NodeLabelType.Id, nodeToolbarTrigger: NodeToolbarTrigger.onHover, + experimentalFeatures: { + enableDragAndDrop: false, + }, }; const getVSCodeKaotoSettingsSpy = jest.fn().mockResolvedValue(settingsModel); @@ -91,11 +97,17 @@ describe('KaotoEditorFactory', () => { catalogUrl: '', nodeLabel: NodeLabelType.Id, nodeToolbarTrigger: NodeToolbarTrigger.onHover, + experimentalFeatures: { + enableDragAndDrop: false, + }, }; const expectedSettings: ISettingsModel = { catalogUrl: 'path-prefix/camel-catalog/index.json', nodeLabel: NodeLabelType.Id, nodeToolbarTrigger: NodeToolbarTrigger.onHover, + experimentalFeatures: { + enableDragAndDrop: false, + }, }; const getVSCodeKaotoSettingsSpy = jest.fn().mockResolvedValue(settingsModel);