Skip to content

Commit

Permalink
Firefly-1243: Merge pPR #1376 from FIREFLY-1243-spaces
Browse files Browse the repository at this point in the history
Firefly-1243: make sure the string conversion has spaces between number
  • Loading branch information
robyww authored May 4, 2023
2 parents df4bee4 + 0442611 commit 0b86e11
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/firefly/js/ui/dynamic/DLGeneratedDropDown.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ import {getHiPSZoomLevelForFOV} from '../../visualize/HiPSUtil.js';
import {dispatchChangeCenterOfProjection, dispatchZoom} from '../../visualize/ImagePlotCntlr.js';
import {getPlotViewById, primePlot} from '../../visualize/PlotViewUtil.js';
import {pointEquals} from '../../visualize/Point.js';
import {CONE_CHOICE_KEY} from '../../visualize/ui/CommonUIKeys.js';
import {isHiPS} from '../../visualize/WebPlot.js';
import {UserZoomTypes} from '../../visualize/ZoomUtil.js';
import {getSpacialSearchType, hasValidSpacialSearch} from './DynComponents.jsx';
import {confirmDLMenuItem} from './FetchDatalinkTable.js';
import {
getStandardIdType, ingestInitArgs,
Expand Down Expand Up @@ -511,6 +513,14 @@ function DLGeneratedTableSearch({currentTblId, initArgs, sideBar, regHasUrl, url

const submitSearch= (r) => {
const {fds, standardID, idx}= findFieldDefInfo(r);

if (!hasValidSpacialSearch(r,fds)) {
showInfoPopup( getSpacialSearchType(r,fds)===CONE_CHOICE_KEY ?
'Target is required' :
'Search Area is require and must have at least 3 point pairs, each separated by commas');
return false;
}

const convertedR= convertRequest(r,fds,getStandardIdType(standardID));

const numKeys= [...new Set(fds.map( ({key}) => key))].length;
Expand Down
10 changes: 8 additions & 2 deletions src/firefly/js/ui/dynamic/DynamicUISearchPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ export function DynamicForm({DynLayoutPanel, groupKey,fieldDefAry, onSubmit, onE
);
}

function cleanupPolygonString(inStr='') {
return inStr.replaceAll(',', ' ')
.split(' ')
.filter( (s) => s)
.join(' ');
}

export function convertRequest(request, fieldDefAry, standardIDType) {
const retReq= fieldDefAry.reduce( (out, {key,type, targetDetails:{raKey,decKey, targetKey,polygonKey, sizeKey}={} }) => {
Expand All @@ -77,8 +83,8 @@ export function convertRequest(request, fieldDefAry, standardIDType) {
case UNKNOWN:
return out;
case POLYGON:
if (standardIDType===standardIDs.sia) out[key]= 'POLYGON ' +request[polygonKey].replaceAll(',', '');
else if (standardIDType===standardIDs.soda) out[key]= request[polygonKey].replaceAll(',', '');
if (standardIDType===standardIDs.sia) out[key]= 'POLYGON ' +cleanupPolygonString(request[polygonKey]);
else if (standardIDType===standardIDs.soda) out[key]= cleanupPolygonString(request[polygonKey]);
else out[key]=request[polygonKey];
return out;
case CHECKBOX:
Expand Down

0 comments on commit 0b86e11

Please sign in to comment.