Skip to content

DM-6135: vo search simplified panel #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 30, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions src/firefly/js/ui/CatalogSearchMethodType.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,16 @@
import React, {Component, PropTypes} from 'react';
import {get} from 'lodash';

import FormPanel from './FormPanel.jsx';
import {FieldGroup} from '../ui/FieldGroup.jsx';
import {ValidationField} from '../ui/ValidationField.jsx';
import {TargetPanel} from '../ui/TargetPanel.jsx';
import {InputGroup} from '../ui/InputGroup.jsx';
import {ServerParams} from '../data/ServerParams.js';

import Validate from '../util/Validate.js';
import {dispatchHideDropDownUi} from '../core/LayoutCntlr.js';

import Enum from 'enum';
import FieldGroupUtils from '../fieldGroup/FieldGroupUtils.js';
import {dispatchSetupTblTracking} from '../visualize/TableStatsCntlr.js';
import {dispatchTableSearch} from '../tables/TablesCntlr.js';
import {FieldGroupTabs, Tab} from './panel/TabPanel.jsx';
import {CheckboxGroupInputField} from './CheckboxGroupInputField.jsx';
import {RadioGroupInputField} from './RadioGroupInputField.jsx';
import {ListBoxInputField} from './ListBoxInputField.jsx';
import {SizeInputFields, sizeFromDeg} from './SizeInputField.jsx';
import {SizeInputFields} from './SizeInputField.jsx';
import {InputAreaFieldConnected} from './InputAreaField.jsx';
import {parseWorldPt} from '../visualize/Point.js';
import * as TblUtil from '../tables/TableUtil.js';
import {dispatchAddImages,getAViewFromMultiView} from '../visualize/MultiViewCntlr.js';
import WebPlotRequest from '../visualize/WebPlotRequest.js';
import {dispatchPlotImage} from '../visualize/ImagePlotCntlr.js';
import {FileUpload} from '../ui/FileUpload.jsx';
import {getActiveTarget} from '../core/AppDataCntlr.js';

import './CatalogSearchMethodType.css';
/*
Expand Down Expand Up @@ -230,7 +213,7 @@ function sizeArea(searchType, max) {
function renderTargetPanel(groupKey, searchType) {
const visible = searchType === SpatialMethod.Cone.value || searchType === SpatialMethod.Box.value || searchType === SpatialMethod.Elliptical.value;
return (
visible && <div className="intarget">
visible && <div className='intarget'>
<TargetPanel wrapperStyle={{width:'200px'}} labelWidth={90} groupKey={groupKey}/>
<ListBoxInputField
fieldKey='targettry'
Expand Down
41 changes: 33 additions & 8 deletions src/firefly/js/ui/VoSearchPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
* License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
*/

import React, {Component, PropTypes} from 'react';
import React from 'react';
import {TargetPanel} from '../ui/TargetPanel.jsx';
import {SizeInputFields, sizeFromDeg} from './SizeInputField.jsx';
import {ValidationField} from './ValidationField.jsx';
import FieldGroupUtils from '../fieldGroup/FieldGroupUtils.js';
import {ListBoxInputField} from './ListBoxInputField.jsx';
import {gkey} from '../visualize/ui/CatalogSelectViewPanel.jsx';
import './VoSearchPanel.css';

export class VoSearchPanel extends Component {
export class VoSearchPanel extends React.Component {

constructor(props) {
super(props);
Expand All @@ -22,7 +24,7 @@ export class VoSearchPanel extends Component {

componentDidMount() {
this.iAmMounted = true;
this.removeListener = FieldGroupUtils.bindToStore('CATALOG_PANEL', (fields) => {
this.removeListener = FieldGroupUtils.bindToStore(gkey, (fields) => {
if (this.iAmMounted) this.setState(fields);
});
}
Expand All @@ -39,6 +41,10 @@ export class VoSearchPanel extends Component {
</div>
<div className={'voarea'}>
{ voSearchArea() }
<div style={{padding:'20px 0 20px 0'}}>
<a target='_blank' href='http://nvo.stsci.edu/vor10/index.aspx'>Find Astronomical Data
Resources </a>
</div>
</div>
</div>
);
Expand All @@ -50,7 +56,7 @@ export class VoSearchPanel extends Component {
function targetPanelArea() {
return (
<div className={'intarget'}>
<TargetPanel groupKey={'CATALOG_PANEL'}/>
<TargetPanel groupKey={gkey}/>
<ListBoxInputField
fieldKey='targettry'
options={[
Expand All @@ -66,7 +72,7 @@ function targetPanelArea() {

var sizeArea = () => {
return (
<SizeInputFields fieldKey='sizefield' showFeedback={true}
<SizeInputFields fieldKey='conesize' showFeedback={true}
initialState={{
value: parseFloat(500/3600).toString(),
tooltip: 'Please select an option',
Expand All @@ -79,8 +85,27 @@ var sizeArea = () => {
);
};

function voSearchArea() {
var voSearchArea = () => {
return (
<div>Search registry box, table result and cone search field here!</div>
<ValidationField
fieldKey={'vourl'}
/*validator={urlValidator}*/
tooltip='Enter the VO cone search URL directly (or use the link below to open external NVO search and find the VO cone search URL)'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check if this tooltip is shown?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, it doesn't. I will fix that. Need to be in a 'initialState' object to be set properly.

label='VO URL:'
size={75}
actOn={['blur','enter']}
wrapperStyle={{margin: '5px 0'}}
labelWidth={50}
/>
);
}
};

function urlValidator(val) {
//Check value that match
const regEx = new RegExp('#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#iS');
let valid = true;//isValid...
if (!regEx.test(val)) {
valid = false;
}
return {valid, value: val, message: 'VO cone search should be a well-defined URL string'};
}
23 changes: 14 additions & 9 deletions src/firefly/js/visualize/ui/CatalogSelectViewPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import './CatalogSelectViewPanel.css';
/**
* group key for fieldgroup comp
*/
const gkey = 'CATALOG_PANEL';
export const gkey = 'CATALOG_PANEL';

/**define the helpButton*/
const helpIdStyle = {'textAlign': 'center', display: 'inline-block', height: 40, marginRight: 20};
Expand Down Expand Up @@ -213,17 +213,18 @@ function validateSql(sqlTxt) {
import {FilterInfo} from '../../tables/FilterInfo.js';

function doVoSearch(request) {
// tReq = makeIrsaCatalogRequest(title, request.project, request.cattable, null, {

var tReq = makeIrsaCatalogRequest(request.catalog, request.project, request.cattable,
//VO url that work http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/402/549
const radius = convertAngle('deg', 'arcsec', request.conesize);
const accessUrl = request.vourl.trim().replace('&', 'URL_PARAM_SEP');
const wp = parseWorldPt(request[ServerParams.USER_TARGET_WORLD_PT]);
var tReq = makeTblRequest('ConeSearchByURL', `${wp.getObjName()} (VO SCS ${radius}")`,
{
[ServerParams.USER_TARGET_WORLD_PT]: request[ServerParams.USER_TARGET_WORLD_PT],
SearchMethod: request.spatial,
RequestedDataSet: request.catalog,
radius: request.conesize,
SearchMethod: 'ConeSearchByURL',
radius,
accessUrl
});
console.log('Does not dispatch yet ' + tReq);
//dispatchTableSearch(tReq);
dispatchTableSearch(tReq);
}

function doLoadTable(request) {
Expand Down Expand Up @@ -701,6 +702,10 @@ function fieldInit() {
'ddform': {
fieldKey: 'ddform',
value: 'true'
},
'vourl': {
fieldKey: 'vourl',
value: ''
}

}
Expand Down