Skip to content

Commit 6a7dbf2

Browse files
authored
Merge pull request #1504 from Caltech-IPAC/FIREFLY-1419_download_broken
FIREFLY-1419: Package download is no longer working
2 parents 1bb4090 + 6c341a4 commit 6a7dbf2

File tree

6 files changed

+15
-17
lines changed

6 files changed

+15
-17
lines changed

src/firefly/java/edu/caltech/ipac/table/TableUtil.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import java.util.Map;
2929
import java.util.stream.Collectors;
3030

31+
import static edu.caltech.ipac.util.StringUtils.groupFind;
32+
3133

3234
/**
3335
* Date: May 14, 2009
@@ -316,11 +318,12 @@ static List aryToList(Object val) {
316318
}
317319

318320
/**
319-
* @param cnames a string of column name(s)
320-
* @return an array of column names split from a comma separated string, ignoring commas inside double-quotes
321+
* @param cnames a string of column name(s). It can also be expression including functions.
322+
* ignore commas inside double-quotes or parentheses(e.g. function parameters) when parsing
323+
* @return an array of column names.
321324
*/
322325
public static String[] splitCols(String cnames) {
323-
return cnames == null ? new String[0] : cnames.split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)");
326+
return cnames == null ? new String[0] : cnames.split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)(?![^(]*\\))");
324327
}
325328

326329
//====================================================================

src/firefly/js/core/background/BackgroundCntlr.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ function bgPackage(action) {
198198
showInfoPopup(msg, 'Multipart download');
199199

200200
} else {
201-
const result= jobInfo?.results?.[0];
202-
const url= isObject(result) ? result?.href : result;
201+
const url= jobInfo?.results?.[0]?.href;
203202
download(url);
204203
}
205204
}

src/firefly/js/core/background/BackgroundMonitor.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ function PackageItem({SINGLE, jobId, index}) {
223223
const dlState = downloadState?.[index];
224224

225225
const doDownload = () => {
226-
const url = jobInfo?.results?.[index];
226+
const url = jobInfo?.results?.[index]?.href;
227227
if (!url) {
228228
showInfoPopup('Bad URL. Cannot download');
229229
return;

src/firefly/js/tables/SortInfo.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ export function sortInfoString(colName, isAscending=true) {
6060
}
6161

6262
serialize() {
63-
return this.direction === UNSORTED ? '' : `${this.direction},${this.sortColumns.map( (c) => `"${c}"`).join()}`;
63+
return this.direction === UNSORTED ? '' :
64+
`${this.direction},${this.sortColumns.map( (c) => c.includes('"') ? c : `"${c}"`).join()}`; // if there's quotes in column name, don't add quotes.
6465
}
6566

6667
static parse(sortInfo) {

src/firefly/js/ui/DownloadDialog.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export function DownloadOptionPanel ({groupKey, cutoutSize, help_id, children, s
196196
setBgKey(akey);
197197
}, [cutoutSize, dlParams, tbl_id]);
198198

199-
const showWarnings = hasProprietaryData(getTblById(tbl_id));
199+
// const showWarnings = hasProprietaryData(getTblById(tbl_id)); // it feature is not working correctly
200200

201201
const maskStyle = {
202202
position: 'absolute',
@@ -229,7 +229,6 @@ export function DownloadOptionPanel ({groupKey, cutoutSize, help_id, children, s
229229
onCancel = {() => dispatchHideDialog(DOWNLOAD_DIALOG_ID)}
230230
help_id = {help_id}>
231231
<FieldGroup groupKey={groupKey} keepState={true}>
232-
{showWarnings && <div style={noticeCss}>This table contains proprietary data. Only data to which you have access will be downloaded.</div>}
233232
{preTitleMessage && <div style={preTitleCss}>{preTitleMessage}</div>}
234233
<div className='FieldGroup__vertical--more'>
235234
{showTitle && <TitleField {...{labelWidth, value:dlTitle }}/>}

src/firefly/js/ui/dynamic/ServiceDefTools.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ export function makeSearchAreaInfo(cisxUI) {
307307
}
308308

309309
let tblCnt=1;
310-
const CHECK_SORT= false;
311310

312311
export function makeServiceDescriptorSearchRequest(request, serviceDescriptor, extraMeta={}) {
313312
const {standardID = '', accessURL, utype, serDefParams, title, cisxUI=[]} = serviceDescriptor;
@@ -319,14 +318,11 @@ export function makeServiceDescriptorSearchRequest(request, serviceDescriptor, e
319318
const hideObj= hiddenColumns ?
320319
Object.fromEntries(hiddenColumns.split(',').map((c) => [ `col.${c}.visibility`, 'hide'] )) : {};
321320

322-
const sAry= tblSortOrder?.split(',',2);
321+
const sAry= tblSortOrder?.match(/([^,]+),(.+)/);
323322
let sortObj= {};
324-
if (sAry?.length>1 && CHECK_SORT) {
325-
const dir= sAry[0].toUpperCase();
326-
sortObj= {sortInfo: sortInfoString(tblSortOrder.substring(dir.length+1), dir==='ASC')};
327-
// console.log('from service def: '+tblSortOrder);
328-
// console.log('using sortInfoString)(): '+sortObj.sortInfo);
329-
// sortObj= {sortInfo: tblSortOrder};
323+
if (sAry) {
324+
const [,dir,sortBy] = sAry;
325+
sortObj= {sortInfo: sortInfoString(sortBy, dir?.toUpperCase()==='ASC')};
330326
}
331327

332328
const options= {...sortObj, META_INFO: { ...hideObj, ...extraMeta }};

0 commit comments

Comments
 (0)