From 4e1e12c872222c66939a85fe83b8b82202e4b6d3 Mon Sep 17 00:00:00 2001 From: NyashaMuusha Date: Mon, 2 Sep 2024 21:48:58 +0200 Subject: [PATCH 1/2] updated textfield type --- JeMPI_Apps/JeMPI_UI/src/pages/settings/Settings.tsx | 1 - .../pages/settings/probabilistic/Probabilistic.tsx | 7 ++++--- .../settings/probabilistic/ProbabilisticConstants.tsx | 11 ++++------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/JeMPI_Apps/JeMPI_UI/src/pages/settings/Settings.tsx b/JeMPI_Apps/JeMPI_UI/src/pages/settings/Settings.tsx index 431e4c1c1..24b1a9c9a 100644 --- a/JeMPI_Apps/JeMPI_UI/src/pages/settings/Settings.tsx +++ b/JeMPI_Apps/JeMPI_UI/src/pages/settings/Settings.tsx @@ -46,7 +46,6 @@ const Settings = () => { enqueueSnackbar(`Error saving configuration`, { variant: 'error' }) - console.log('handleSave error', response.data) } } diff --git a/JeMPI_Apps/JeMPI_UI/src/pages/settings/probabilistic/Probabilistic.tsx b/JeMPI_Apps/JeMPI_UI/src/pages/settings/probabilistic/Probabilistic.tsx index b9c4ff7f7..0670322ab 100644 --- a/JeMPI_Apps/JeMPI_UI/src/pages/settings/probabilistic/Probabilistic.tsx +++ b/JeMPI_Apps/JeMPI_UI/src/pages/settings/probabilistic/Probabilistic.tsx @@ -11,7 +11,6 @@ import { Configuration } from 'types/Configuration' import { useEffect, useState } from 'react' import { useSnackbar } from 'notistack' - interface Rule { vars: string[] text: string @@ -135,7 +134,6 @@ const Probabilistic = () => { padding: '20px' }} > -
{ name="linkThreshold" label="Enter floating point" variant="outlined" + type="number" size="small" value={values.linkThreshold} onChange={handleChange} @@ -216,6 +215,7 @@ const Probabilistic = () => { id="min-review-threshold" name="minReviewThreshold" label="Min" + type="number" variant="outlined" size="small" value={values.minReviewThreshold} @@ -258,6 +258,7 @@ const Probabilistic = () => { { name="marginWindowSize" label="Enter floating point" variant="outlined" + type="number" size="small" value={values.marginWindowSize} onChange={handleChange} @@ -323,7 +325,6 @@ const Probabilistic = () => { type="submit" variant="contained" color="primary" - disabled={isSubmitting} > Save diff --git a/JeMPI_Apps/JeMPI_UI/src/pages/settings/probabilistic/ProbabilisticConstants.tsx b/JeMPI_Apps/JeMPI_UI/src/pages/settings/probabilistic/ProbabilisticConstants.tsx index e63f3c579..1ed925e50 100644 --- a/JeMPI_Apps/JeMPI_UI/src/pages/settings/probabilistic/ProbabilisticConstants.tsx +++ b/JeMPI_Apps/JeMPI_UI/src/pages/settings/probabilistic/ProbabilisticConstants.tsx @@ -50,12 +50,9 @@ export const validationSchema = Yup.object({ export const initializeValues = (rule: Rule) => ({ minReviewThreshold: - rule.reviewThresholdRange?.low.toString() || - defaultValues.minReviewThreshold, - linkThreshold: rule.linkThreshold?.toString() || defaultValues.linkThreshold, + rule.reviewThresholdRange?.low || defaultValues.minReviewThreshold, + linkThreshold: rule.linkThreshold || defaultValues.linkThreshold, maxReviewThreshold: - rule.reviewThresholdRange?.high.toString() || - defaultValues.maxReviewThreshold, - marginWindowSize: - rule.marginWindowSize?.toString() || defaultValues.marginWindowSize + rule.reviewThresholdRange?.high || defaultValues.maxReviewThreshold, + marginWindowSize: rule.marginWindowSize || defaultValues.marginWindowSize }) From 19f829965f326dba8dd928a0c4bd5b4fdc9d18d3 Mon Sep 17 00:00:00 2001 From: NyashaMuusha Date: Mon, 2 Sep 2024 22:05:34 +0200 Subject: [PATCH 2/2] updated slider --- .../settings/probabilistic/Probabilistic.tsx | 63 +++++++++---------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/JeMPI_Apps/JeMPI_UI/src/pages/settings/probabilistic/Probabilistic.tsx b/JeMPI_Apps/JeMPI_UI/src/pages/settings/probabilistic/Probabilistic.tsx index 0670322ab..c8c385877 100644 --- a/JeMPI_Apps/JeMPI_UI/src/pages/settings/probabilistic/Probabilistic.tsx +++ b/JeMPI_Apps/JeMPI_UI/src/pages/settings/probabilistic/Probabilistic.tsx @@ -140,38 +140,37 @@ const Probabilistic = () => { spacing={2} sx={{ marginBottom: '80px', alignItems: 'center' }} > - { - if (Array.isArray(value)) { - setFieldValue('minReviewThreshold', value[0].toString()) - setFieldValue('linkThreshold', value[1].toString()) - setFieldValue('maxReviewThreshold', value[2].toString()) - } else { - setFieldValue('linkThreshold', value.toString()) - } - }} - sx={{ - width: '50%', - '& .MuiSlider-thumb': { - "&[data-index='0']": { backgroundColor: 'red' }, - "&[data-index='1']": { backgroundColor: 'green' }, - "&[data-index='2']": { backgroundColor: 'blue' } - }, - marginBottom: '80px' - }} - /> - + { + if (Array.isArray(value)) { + setFieldValue('minReviewThreshold', value[0].toString()) + setFieldValue('linkThreshold', value[1].toString()) + setFieldValue('maxReviewThreshold', value[2].toString()) + } else { + setFieldValue('linkThreshold', value.toString()) + } + }} + sx={{ + width: '50%', + '& .MuiSlider-thumb': { + "&[data-index='0']": { backgroundColor: 'red' }, + "&[data-index='1']": { backgroundColor: 'green' }, + "&[data-index='2']": { backgroundColor: 'blue' } + }, + marginBottom: '80px' + }} + />