diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js b/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js index c78fbeeb6a3c1e1e4eb08e850365e7781256fb0c..5ee9017565ddf8d6259b73a8b32f1b5a8ec8bc74 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js @@ -531,10 +531,11 @@ function Jeditor(props) { if(editor?.editors[channelPath]?.formname) { let channelsPerPartElement = document.getElementsByName(editor.editors[channelPath].formname)[0]; if(channelsPerPartElement) { + let freqResolution = null; channelsPerPartElement.addEventListener('keyup', (event) => { if(event.currentTarget.value) { - updatePipelineFrequencyResolution(channelPath, event.currentTarget.value, true); - updatePipelineTimeResolution(channelPath, event.currentTarget.value, null); + freqResolution = updatePipelineFrequencyResolution(channelPath, event.currentTarget.value, true); + updatePipelineTimeResolution(channelPath, freqResolution, null); } }); // Add event listener for Integration Time field @@ -545,7 +546,7 @@ function Jeditor(props) { let intTimeElement = document.getElementsByName(editor.editors[intTimePath].formname)[0]; if(intTimeElement) { intTimeElement.addEventListener('keyup', (event) => { - updatePipelineTimeResolution(intTimePath, null, event.currentTarget.value || 0); + updatePipelineTimeResolution(intTimePath, freqResolution, event.currentTarget.value || 0); }); } } @@ -555,8 +556,8 @@ function Jeditor(props) { if(intTimeElement) { intTimeElement.addEventListener('change', (event) => { singlePulseSearch =event.currentTarget.value === '1'?true:false; - updatePipelineFrequencyResolution(channelPath, null, true); - updatePipelineTimeResolution(channelPath, null, null); + freqResolution = updatePipelineFrequencyResolution(channelPath, null, true); + updatePipelineTimeResolution(channelPath, freqResolution, null); }); } } @@ -999,13 +1000,16 @@ function Jeditor(props) { if (editorInput['integration_time_factor']) { isDigifil = true; // Add calculated values for custom fields frequency_resolution and time_resolution - editorInput['frequency_resolution'] = getPipelineFrequencyResolution(inputValue, isDigifil); + const freqResolution = getPipelineFrequencyResolution(inputValue, isDigifil); + editorInput['frequency_resolution'] = freqResolution!=='N/A'?(freqResolution/1000).toFixed(2):freqResolution; const integrationTime = editorInput['integration_time_factor']; //editorInput['integration_time'] || editorInput['time_integration_factor']; - editorInput['time_resolution'] = getPipelineTimeResolution(inputValue, integrationTime); + const timeResolution = getPipelineTimeResolution(freqResolution, integrationTime) + editorInput['time_resolution'] = timeResolution!=='N/A'?(timeResolution*1000):timeResolution;; } else { isDigifil = false; filterBankEnabled = editorInput['enabled']; - editorInput['frequency_resolution'] = getPipelineFrequencyResolution(inputValue, isDigifil); + const freqResolution = getPipelineFrequencyResolution(inputValue, isDigifil); + editorInput['frequency_resolution'] = freqResolution!=='N/A'?(freqResolution/1000).toFixed(2):freqResolution; } } } @@ -1244,10 +1248,13 @@ function Jeditor(props) { let freqResPath = channelsPropPath.split("."); freqResPath[freqResPath.length-1] = "frequency_resolution"; freqResPath = freqResPath.join("."); + let freqResolution = null; if(editor.editors[freqResPath]?.formname) { // Set values for Frequency Resolution field. - document.getElementById(editor.editors[freqResPath]?.formname).value = getPipelineFrequencyResolution(channelsPerPart, isDigifil); + freqResolution = getPipelineFrequencyResolution(channelsPerPart, isDigifil); + document.getElementById(editor.editors[freqResPath]?.formname).value = freqResolution!=='N/A'?(freqResolution/1000).toFixed(2):freqResolution; } + return freqResolution; } /** @@ -1348,7 +1355,8 @@ function Jeditor(props) { } if(editor.editors[timeResPath]?.formname) { // Set values for Time Resolution field. - document.getElementById(editor.editors[timeResPath]?.formname).value = getPipelineTimeResolution(channelsPerPart, integrationTime); + const timeResolution = getPipelineTimeResolution(channelsPerPart, integrationTime); + document.getElementById(editor.editors[timeResPath]?.formname).value = timeResolution!=='N/A'?(timeResolution*1000):timeResolution; } }