@@ -32,10 +32,10 @@ import {analyzeQueries, handleSearch} from './DLGenAnalyzeSearch.js';
32
32
import { SideBarAnimation , SideBarTable } from './DLuiDecoration.jsx' ;
33
33
import { DLuiServDescPanel , DLuiTabView } from './DLuiServDescPanel.jsx' ;
34
34
import { CIRCLE , POINT , POSITION , RANGE } from './DynamicDef.js' ;
35
- import { convertRequest , findTargetFromRequest } from './DynamicUISearchPanel.jsx' ;
35
+ import { convertRequest , DEFER_TO_CONTEXT , findTargetFromRequest } from './DynamicUISearchPanel.jsx' ;
36
36
import { getSpacialSearchType , hasValidSpacialSearch } from './DynComponents.jsx' ;
37
37
import { confirmDLMenuItem } from './FetchDatalinkTable.js' ;
38
- import { getStandardIdType , ingestInitArgs , makeFieldDefsWithOptions , makeSearchAreaInfo } from './ServiceDefTools.js' ;
38
+ import { getStandardIdType , ingestInitArgs , sdToFieldDefAry , makeSearchAreaInfo } from './ServiceDefTools.js' ;
39
39
40
40
41
41
export const DL_UI_LIST = 'DL_UI_LIST' ;
@@ -280,7 +280,7 @@ const executeInitTargetOnce= makeSearchOnce(false);
280
280
281
281
282
282
function DLGeneratedTableSearch ( { currentTblId, qAna, groupKey, initArgs, sideBar, regHasUrl, url,
283
- sideBarShowing, slotProps, regLoaded, dataServiceId,
283
+ sideBarShowing, slotProps, regLoaded, dataServiceId : inDataServiceId ,
284
284
setSideBarShowing, defaultMaxMOCFetchDepth} ) {
285
285
const [ , setCallId ] = useState ( 'none' ) ;
286
286
const [ { onClick} , setClickFuncImpl ] = useState ( { } ) ;
@@ -291,6 +291,7 @@ function DLGeneratedTableSearch({currentTblId, qAna, groupKey, initArgs, sideBar
291
291
if ( obj ?. onClick && ! onClick ) setClickFuncImpl ( obj ) ;
292
292
} ;
293
293
294
+ const dataServiceId = getCisxUIValue ( qAna , 'data_service_id' ) ?? inDataServiceId ;
294
295
295
296
useEffect ( ( ) => {
296
297
if ( initArgs ?. urlApi ?. execute && onClick && matchUrl ) {
@@ -328,7 +329,11 @@ function DLGeneratedTableSearch({currentTblId, qAna, groupKey, initArgs, sideBar
328
329
329
330
const isAllSky = toBoolean ( getCisxUI ( qAna ) ?. find ( ( e ) => e . name === 'data_covers_allsky' ) ?. value ) ;
330
331
const docRows = qAna ?. urlRows . filter ( ( { semantic} ) => semantic ?. toLowerCase ( ) . endsWith ( 'documentation' ) ) ;
331
- const submitSearch = ( request ) => doSubmitSearch ( request , dataServiceId , docRows , qAna , fdAry , searchObjFds , tabsKey ) ;
332
+
333
+ const submitSearch = ( request , siaCtx ) =>
334
+ doSubmitSearch ( request , siaCtx , dataServiceId , docRows , qAna , fdAry , searchObjFds , tabsKey ) ;
335
+
336
+
332
337
333
338
return (
334
339
< Sheet sx = { { width :1 , height :1 } } >
@@ -338,10 +343,10 @@ function DLGeneratedTableSearch({currentTblId, qAna, groupKey, initArgs, sideBar
338
343
< FieldGroup groupKey = { groupKey } keepState = { true } style = { { width :'100%' } } >
339
344
{ ( regLoaded && qAna ) ? searchObjFds . length === 1 ?
340
345
< DLuiServDescPanel { ...{ initArgs, setSideBarShowing, sideBarShowing, fds :searchObjFds [ 0 ] . fds ,
341
- setClickFunc, submitSearch, isAllSky, qAna, slotProps,
346
+ setClickFunc, submitSearch, isAllSky, qAna, slotProps, dataServiceId ,
342
347
sx :{ width :1 , height :1 } , desc :searchObjFds [ 0 ] . desc , docRows} } /> :
343
348
< DLuiTabView { ...{ initArgs, tabsKey, setSideBarShowing, sideBarShowing, searchObjFds, qAna,
344
- docRows, isAllSky, setClickFunc, submitSearch, slotProps} } />
349
+ docRows, isAllSky, setClickFunc, submitSearch, slotProps, dataServiceId } } />
345
350
:
346
351
< NotLoaded { ...{ regHasUrl, regLoaded, url} } />
347
352
}
@@ -370,11 +375,11 @@ function alignHiPS(currentTblId, qAna, groupKey, fieldDefAry) {
370
375
const tgt = findTargetFromRequest ( request , fieldDefAry ) ;
371
376
if ( tgt ) return ;
372
377
373
- const cisxUI = getCisxUI ( qAna ) ;
374
- const raStr = cisxUI . find ( ( e ) => e . name === 'hips_initial_ra' ) ?. value ;
375
- const decStr = cisxUI . find ( ( e ) => e . name === 'hips_initial_dec' ) ?. value ;
376
- const ucdStr = cisxUI . find ( ( e ) => e . name === 'hips_initial_ra' ) ?. UCD ;
377
- const fovStr = cisxUI . find ( ( e ) => e . name === 'hips_initial_fov' ) ?. value ;
378
+ const raStr = getCisxUIValue ( qAna , 'hips_initial_ra' ) ;
379
+ const decStr = getCisxUIValue ( qAna , 'hips_initial_dec' ) ;
380
+ const ucdStr = getCisxUIUCD ( 'hips_initial_ra' ) ;
381
+ const fovStr = getCisxUIValue ( qAna , 'hips_initial_fov' ) ;
382
+
378
383
const coordSys = ucdStr === 'pos.galactic.lon' ? CoordSys . GALACTIC : CoordSys . EQ_J2000 ;
379
384
const centerProjPt = makeWorldPt ( raStr , decStr , coordSys ) ;
380
385
if ( ! centerProjPt ) return ;
@@ -403,6 +408,17 @@ function getCisxUI(qAnaOrSd) {
403
408
}
404
409
return [ ] ;
405
410
}
411
+
412
+ function getCisxUIValue ( qAnaOrSd , name ) {
413
+ return getCisxUI ( qAnaOrSd ) . find ( ( e ) => e . name === name ) ?. value ;
414
+ }
415
+
416
+ function getCisxUIUCD ( qAnaOrSd , name ) {
417
+ return getCisxUI ( qAnaOrSd ) . find ( ( e ) => e . name === name ) ?. UCD ;
418
+ }
419
+
420
+
421
+
406
422
/**
407
423
* map the primarySearchDef (a SearchDefinition) array in QueryAnalysis to an array of FieldDef arrays.
408
424
* Usually there is only one primarySearchDef
@@ -416,21 +432,21 @@ function makePrimarySearchFieldDefAry(qAna, initArgs, defaultMaxMOCFetchDepth) {
416
432
return qAna ?. primarySearchDef . map ( ( fd ) => {
417
433
const { serviceDef} = fd ; //todo handle case with only an access url
418
434
if ( ! serviceDef ) return ;
419
- const standId = getStandardId ( serviceDef ) ;
420
- const utype = getUtype ( serviceDef ) ;
421
- let fdEntryAry ;
422
- if ( utype === cisxAdhocServiceUtype && standId . startsWith ( standardIDs . tap ) && serviceDef . cisxTokenSub ) {
423
- fdEntryAry = makeFieldDefsWithOptions ( {
424
- serDefParams : serviceDef . cisxTokenSub ,
425
- searchAreaInfo : makeSearchAreaInfo ( getCisxUI ( serviceDef ) , defaultMaxMOCFetchDepth ) ,
426
- hidePredefinedStringFields : false } ) ;
427
- }
428
- else {
429
- fdEntryAry = makeFieldDefsWithOptions ( {
430
- serDefParams : serviceDef . serDefParams ,
431
- searchAreaInfo :makeSearchAreaInfo ( getCisxUI ( serviceDef ) , defaultMaxMOCFetchDepth )
435
+ // const standId= getStandardId(serviceDef);
436
+ // const utype= getUtype(serviceDef);
437
+ // let fdEntryAry;
438
+ // TODO: figure out how to better do TAP support
439
+ // if (utype===cisxAdhocServiceUtype && standId.startsWith(standardIDs.tap) && serviceDef.cisxTokenSub) {
440
+ // fdEntryAry= sdParamsToFieldDefAry({
441
+ // serDefParams: serviceDef.cisxTokenSub ,
442
+ // searchAreaInfo:makeSearchAreaInfo(getCisxUI(serviceDef), defaultMaxMOCFetchDepth),
443
+ // hidePredefinedStringFields :false });
444
+ // }
445
+ // else {
446
+ const fdEntryAry = sdToFieldDefAry ( {
447
+ serviceDef , searchAreaInfo :makeSearchAreaInfo ( getCisxUI ( serviceDef ) , defaultMaxMOCFetchDepth )
432
448
} ) ;
433
- }
449
+ // }
434
450
if ( ! isEmpty ( initArgs . urlApi ) ) {
435
451
const originalWp = fdEntryAry . find ( ( fd ) => fd . type === POSITION ) ?. initValue ?? fdEntryAry . find ( ( fd ) => fd . type === CIRCLE ) ?. targetDetails ?. centerPt ;
436
452
const initFdEntryAry = ingestInitArgs ( fdEntryAry , initArgs . urlApi ) ;
@@ -463,7 +479,7 @@ const NotLoaded= ({regHasUrl,regLoaded, url}) => (
463
479
) ;
464
480
465
481
466
- const doSubmitSearch = ( r , dataServiceId , docRows , qAna , fdAry , searchObjFds , tabsKey ) => {
482
+ function doSubmitSearch ( r , siaCtx , dataServiceId , docRows , qAna , fdAry , searchObjFds , tabsKey ) {
467
483
const { fds, standardID, idx} =
468
484
searchObjFds . length === 1 ? searchObjFds [ 0 ] : searchObjFds . find ( ( { ID } ) => ID === r [ tabsKey ] ) ?? { } ;
469
485
@@ -475,17 +491,29 @@ const doSubmitSearch= (r,dataServiceId, docRows,qAna,fdAry,searchObjFds,tabsKey)
475
491
return false ;
476
492
}
477
493
478
- const convertedR = convertRequest ( r , fds , getStandardIdType ( standardID ) ) ;
494
+ const outReq = convertRequest ( r , fds , getStandardIdType ( standardID ) ) ;
495
+ const requestKeyCnt = Object . keys ( outReq ) . length ;
496
+ const convertedR = Object . fromEntries ( Object . entries ( outReq ) . filter ( ( [ k , v ] ) => v !== DEFER_TO_CONTEXT ) ) ;
479
497
const selectedConcurrent = r . searchOptions ?? '' ;
480
498
499
+
500
+ let siaContraints = [ ] ;
501
+ if ( siaCtx ) {
502
+ const cAry = [ ...siaCtx . values ( ) ] ;
503
+ siaContraints = cAry . map ( ( f ) => f . siaConstraints ) . filter ( ( c ) => c ?. length ) . flat ( ) ;
504
+ }
505
+
481
506
const numKeys = [ ...new Set ( fds . map ( ( { key} ) => key ) ) ] . length ;
482
- if ( Object . keys ( convertedR ) . length < numKeys ) {
507
+ if ( requestKeyCnt < numKeys ) {
483
508
showInfoPopup ( 'Please enter all of the fields' , 'Error' ) ;
484
509
return false ;
485
510
}
511
+
512
+
513
+
486
514
const extraMeta = docRows ?. [ 0 ] ? { [ META . doclink . url ] : docRows [ 0 ] . accessUrl , [ META . doclink . desc ] : docRows [ 0 ] . desc } : { } ;
487
515
extraMeta [ MetaConst . DATA_SERVICE_ID ] = dataServiceId ;
488
- handleSearch ( convertedR , qAna , fdAry , idx , extraMeta , selectedConcurrent ) ;
516
+ handleSearch ( convertedR , siaContraints , qAna , fdAry , idx , extraMeta , selectedConcurrent ) ;
489
517
return true ;
490
- } ;
518
+ }
491
519
0 commit comments