Skip to content

Commit 26f965d

Browse files
authored
Merge PR Caltech-IPAC#1697 from FIREFLY_1651-refactor
Firefly-1651: Refactor tapObsCore to dataServiceOptions and related code
2 parents 5e9f31b + d362e17 commit 26f965d

29 files changed

+352
-318
lines changed

src/firefly/html/firefly-dev.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
image : {
5858
defaultColorTable : 5
5959
},
60-
tapObsCore: {
60+
dataServiceOptions: {
6161
productTitleTemplate: '${obs_collection}-${instrument_name}: ${obs_id}',
6262
enableObsCoreDownload: true,
6363
filterDefinitions: [

src/firefly/js/Firefly.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {initApi} from './api/ApiBuild.js';
2121
import {dispatchUpdateLayoutInfo} from './core/LayoutCntlr.js';
2222
import {FireflyRoot} from './ui/FireflyRoot.jsx';
2323
import {SIAv2SearchPanel} from './ui/tap/SIASearchRootPanel';
24-
import {getSIAv2Services} from './ui/tap/SiaUtil';
24+
import {getSIAv2ServicesByName} from './ui/tap/SiaUtil';
2525
import {TapSearchPanel} from './ui/tap/TapSearchRootPanel';
2626
import {mergeServices} from './ui/tap/TapUtil';
2727
import {dispatchChangeReadoutPrefs} from './visualize/MouseReadoutCntlr.js';
@@ -41,7 +41,7 @@ import {showLostConnection} from './ui/LostConnection.jsx';
4141
import {recordHistory} from './core/History.js';
4242
import {setDefaultImageColorTable} from './visualize/WebPlotRequest.js';
4343
import {initWorkerContext} from './threadWorker/WorkerAccess.js';
44-
import {getTAPServices} from './ui/tap/TapKnownServices.js';
44+
import {getTAPServicesByName} from './ui/tap/TapKnownServices.js';
4545
import {loadAllJobs} from './core/background/BackgroundUtil.js';
4646
import {
4747
makeDefImageSearchActions, makeDefTableSearchActions, makeDefTapSearchActions, makeExternalSearchActions
@@ -196,7 +196,7 @@ const defFireflyOptions = {
196196
defaultColorTable: 1,
197197
canCreateExtractionTable: false,
198198
},
199-
tapObsCore: {
199+
dataServiceOptions: {
200200
enableObsCoreDownload: true,
201201
// debug: true,
202202
},
@@ -218,12 +218,12 @@ const defFireflyOptions = {
218218
...makeDefImageSearchActions(),
219219
],
220220
tap : {
221-
services: getTAPServices( ['IRSA', 'NED', 'NASA Exoplanet Archive', 'KOA', 'HEASARC', 'MAST Images',
222-
'CADC', 'VizieR (CDS)', 'Simbad (CDS)', 'Gaia', 'GAVO', 'HSA', 'NOIR Lab'] ),
221+
services: getTAPServicesByName( ['IRSA', 'NED', 'ExoplanetArchive', 'KOA', 'HEASARC', 'MASTImages',
222+
'CADC', 'VizieR', 'Simbad', 'Gaia', 'GAVO', 'HSA', 'NOIRLab'] ),
223223
defaultMaxrec: 50000
224224
},
225225
SIAv2 : {
226-
services: getSIAv2Services( ['IRSA', 'CADC', ]),
226+
services: getSIAv2ServicesByName( ['IRSA', 'CADC', ]),
227227
defaultMaxrec: 50000
228228
},
229229
};

src/firefly/js/data/MetaConst.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export const MetaConst = {
200200
/**
201201
* any ID can be added to a table search to identify the source for the purpose of getting source specific obscore preferences
202202
*/
203-
OBSCORE_SOURCE_ID: 'OBSCORE_SOURCE_ID',
203+
DATA_SERVICE_ID: 'DATA_SERVICE_ID',
204204

205205
/**
206206
* If we are doing cutout, this is the default type, either: ROW_POSITION or SEARCH_POSITION

src/firefly/js/metaConvert/vo/DataLinkProcessor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {getPreferCutout} from '../../ui/tap/ObsCoreOptions';
1+
import {getPreferCutout} from '../../ui/tap/Cutout';
22
import { getSearchTarget, makeWorldPtUsingCenterColumns } from '../../voAnalyzer/TableAnalysis.js';
33
import {
44
getDataLinkData, isDownloadType, isGzipType, isSimpleImageType, isTarType, isVoTable

src/firefly/js/metaConvert/vo/DataLinkStandAloneConverter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {getPreferCutout} from '../../ui/tap/ObsCoreOptions';
1+
import {getPreferCutout} from '../../ui/tap/Cutout';
22
import {getDataLinkData} from '../../voAnalyzer/VoDataLinkServDef.js';
33
import {DEFAULT_DATA_PRODUCTS_COMPONENT_KEY} from '../DataProductsCntlr';
44
import {createDataLinkSingleRowItem} from './DataLinkProcessor.js';

src/firefly/js/metaConvert/vo/DatalinkProducts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {getCellValue} from '../../tables/TableUtil.js';
2-
import {getPreferCutout} from '../../ui/tap/ObsCoreOptions';
2+
import {getPreferCutout} from '../../ui/tap/Cutout';
33
import {getSizeAsString} from '../../util/WebUtil';
44
import {getDataLinkData} from '../../voAnalyzer/VoDataLinkServDef.js';
55
import {Band} from '../../visualize/Band.js';

src/firefly/js/metaConvert/vo/ObsCoreConverter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {isEmpty, isUndefined} from 'lodash';
22
import {getAppOptions} from '../../core/AppDataCntlr.js';
33
import {getCellValue, getColumns, hasRowAccess} from '../../tables/TableUtil.js';
4+
import {getDataServiceOption} from '../../ui/tap/DataServicesOptions';
45
import {
56
getObsCoreAccessURL, getObsCoreProdTypeCol, getObsReleaseDate, getObsTitle, getProdTypeGuess, getSearchTarget,
67
isFormatDataLink,
@@ -243,7 +244,7 @@ export function getObsCoreRowMetaInfo(table,row) {
243244

244245
function createObsCoreTitle(table,row) {
245246
// 1. try a template
246-
const template= getAppOptions().tapObsCore?.productTitleTemplate;
247+
const template= getDataServiceOption('productTitleTemplate');
247248
if (template?.trim()==='') return ''; // setting template to empty string disables all title guessing
248249
if (!template) {
249250
const templateColNames= template && getColNameFromTemplate(template);

src/firefly/js/metaConvert/vo/ServDescProducts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {getComponentState} from '../../core/ComponentCntlr.js';
33
import {getCellValue} from '../../tables/TableUtil.js';
44
import {makeCircleString} from '../../ui/dynamic/DynamicUISearchPanel';
55
import {isSIAStandardID} from '../../ui/dynamic/ServiceDefTools';
6-
import {findCutoutTarget, getCutoutErrorStr, getCutoutSize, setCutoutSize, } from '../../ui/tap/ObsCoreOptions';
6+
import {findCutoutTarget, getCutoutErrorStr, getCutoutSize, setCutoutSize} from '../../ui/tap/Cutout';
77
import {PlotAttribute} from '../../visualize/PlotAttribute';
88
import {isObsCoreLike} from '../../voAnalyzer/TableAnalysis';
99
import {CUTOUT_UCDs, DEC_UCDs, RA_UCDs} from '../../voAnalyzer/VoConst';

src/firefly/js/templates/common/ttFeatureWatchers.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import React from 'react';
22
import {cloneDeep, once} from 'lodash';
3-
import {getAppOptions} from '../../core/AppDataCntlr.js';
43
import {dispatchAddTableTypeWatcherDef} from '../../core/MasterSaga.js';
4+
import {MetaConst} from '../../data/MetaConst';
55
import {dispatchTableUiUpdate, TABLE_LOADED} from '../../tables/TablesCntlr.js';
66
import {getActiveTableId, getMetaEntry, getTableUiByTblId, getTblById} from '../../tables/TableUtil.js';
77
import {DownloadButton, DownloadOptionPanel} from '../../ui/DownloadDialog.jsx';
8-
import {getTapObsCoreOptions, getTapObsCoreOptionsGuess} from '../../ui/tap/ObsCoreOptions';
9-
import {hasObsCoreLikeDataProducts, isObsCoreLikeWithProducts} from '../../voAnalyzer/TableAnalysis.js';
8+
import {
9+
getDataServiceOption, getDataServiceOptionByTable, getDataServiceOptions, getDataServiceOptionsFallback,
10+
} from '../../ui/tap/DataServicesOptions';
11+
import {hasObsCoreLikeDataProducts} from '../../voAnalyzer/TableAnalysis.js';
1012
import {getCatalogWatcherDef} from '../../visualize/saga/CatalogWatcher.js';
1113
import {getUrlLinkWatcherDef} from '../../visualize/saga/UrlLinkWatcher.js';
1214
import {getActiveRowToImageDef } from '../../visualize/saga/ActiveRowToImageWatcher.js';
@@ -57,11 +59,11 @@ function setupObsCorePackaging(tbl_id) {
5759

5860
const {request}=table;
5961
let enabled;
60-
if (request.QUERY && request.serviceUrl && getMetaEntry(table,'serviceLabel')) { // if known TAP service request
61-
enabled= getTapObsCoreOptions(getMetaEntry(table,'serviceLabel'))?.enableObsCoreDownload;
62+
if (request.QUERY && request.serviceUrl) { // if known TAP service request
63+
enabled= getDataServiceOptionByTable('enableObsCoreDownload',table);
6264
}
6365
else {
64-
enabled= getAppOptions()?.tapObsCore?.enableObsCoreDownload;
66+
enabled= getDataServiceOption('enableObsCoreDownload');
6567
}
6668
if (!enabled) return;
6769

@@ -72,8 +74,10 @@ function setupObsCorePackaging(tbl_id) {
7274

7375
function updateSearchRequest( tbl_id='', dlParams='', sRequest=null) {
7476
const hostname= new URL(sRequest.source ? sRequest.source : sRequest.serviceUrl)?.hostname;
75-
const template= getTapObsCoreOptionsGuess(hostname)?.productTitleTemplate;
76-
const useSourceUrlFileName= getTapObsCoreOptionsGuess(hostname)?.packagerUsesSourceUrlFileName;
77+
const serviceId= getMetaEntry(tbl_id,MetaConst.DATA_SERVICE_ID);
78+
const ops= getDataServiceOptionsFallback(serviceId, hostname) ?? {};
79+
const template= ops.productTitleTemplate;
80+
const useSourceUrlFileName= ops.packagerUsesSourceUrlFileName;
7781
const templateColNames= template && getColNameFromTemplate(template);
7882
const searchRequest = cloneDeep( sRequest);
7983
searchRequest.template = template;

src/firefly/js/ui/CutoutSizeDialog.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {RadioGroupInputField} from './RadioGroupInputField';
1717
import {
1818
getCutoutSize, getCutoutTargetType, ROW_POSITION, SEARCH_POSITION, setAllCutoutParams, setPreferCutout,
1919
USER_ENTERED_POSITION
20-
} from './tap/ObsCoreOptions';
20+
} from './tap/Cutout';
2121
import {intValidator} from '../util/Validate';
2222
import CompleteButton from './CompleteButton.jsx';
2323
import DialogRootContainer from './DialogRootContainer.jsx';

0 commit comments

Comments
 (0)