Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(dashboard): accept fractional values in bounded number fields
Yudhi Armyndharis73df6cc6ca72
diff --git a/dashboard/src/pages/Plugins.test.ts b/dashboard/src/pages/Plugins.test.tsindex d4cce0b9e..3a2f899a6 100644--- a/dashboard/src/pages/Plugins.test.ts+++ b/dashboard/src/pages/Plugins.test.ts@@ -249,3 +249,20 @@ test('a config schema without properties opens the config modal and the Sessionsawait screen.findByText('Run for');assert.equal(screen.queryByRole('combobox', { name: 'Select a session…' }), null);});++test('a fractional value in a bounded number field does not block the override save', async () => {+ const { screen, fireEvent, waitFor } = rtl;+ pluginOverride = {+ config: { threshold: 0.7 },+ configSchema: { type: 'object', properties: { threshold: { type: 'number', title: 'Threshold', min: 0, max: 1 } } },+ };+ putReply = { success: true };+ await openSessionOverride('Main');+ const field = await screen.findByLabelText<HTMLInputElement>('Threshold');+ assert.equal(field.value, '0.7');+ fireEvent.change(field, { target: { value: '0.5' } });++ fireEvent.click(screen.getByRole('button', { name: 'Save override' }));+ await waitFor(() => assert.equal(putBodies.length, 1));+ assert.deepEqual(putBodies, [{ config: { threshold: 0.5 } }]);+});diff --git a/dashboard/src/pages/Plugins.tsx b/dashboard/src/pages/Plugins.tsxindex fb6b9c3a0..f33dcc547 100644--- a/dashboard/src/pages/Plugins.tsx+++ b/dashboard/src/pages/Plugins.tsx@@ -221,6 +221,8 @@ function ConfigField({required={field.required}min={field.type === 'number' ? field.min : undefined}max={field.type === 'number' ? field.max : undefined}+ // min/max are value bounds only; without step="any" the default step of 1 rejects 0.7.+ step={field.type === 'number' ? 'any' : undefined}minLength={field.type !== 'number' ? field.min : undefined}maxLength={field.type !== 'number' ? field.max : undefined}pattern={field.type !== 'number' ? field.pattern : undefined}