@@ -16,16 +16,13 @@ import {VisToolbar} from '../../visualize/ui/VisToolbar.jsx';
1616import { MultiImageViewerContainer } from '../../visualize/ui/MultiImageViewerContainer.jsx' ;
1717import { createContentWrapper } from '../../ui/panel/DockLayoutPanel.jsx' ;
1818import { LC } from './LcManager.js' ;
19- import { FormPanel } from '../../ui/FormPanel.jsx' ;
2019import { Tabs , Tab } from '../../ui/panel/TabPanel.jsx' ;
2120import { ValidationField } from '../../ui/ValidationField.jsx' ;
22- import Validate from '../../util/Validate.js' ;
23- import { FieldGroup } from '../../ui/FieldGroup.jsx' ;
24- import { InputGroup } from '../../ui/InputGroup.jsx' ;
2521import { UploadPanel } from './LcViewer.jsx' ;
2622import { LcImageToolbar } from './LcImageToolbar.jsx' ;
2723import { LcPFOptionsPanel } from './LcPhaseFoldingPanel.jsx' ;
2824import { LcPeriodFindingPanel } from './PeriodogramOptionsPanel.jsx' ;
25+ import { DownloadButton , DownloadOptionPanel } from '../../ui/DownloadDialog.jsx' ;
2926
3027
3128export class LcResult extends Component {
@@ -155,7 +152,27 @@ const StandardView = ({visToolbar, title, searchDesc, standard, imagePlot, xyPlo
155152 { visToolbar &&
156153 < div style = { { display : 'inline-flex' , justifyContent : 'space-between' , alignItems : 'center' } } >
157154 < div > { visToolbar } </ div >
158- < div > < DownloadButton /> </ div >
155+ < div >
156+ < DownloadButton >
157+ < DownloadOptionPanel
158+ cutoutSize = '200'
159+ dlParams = { {
160+ MaxBundleSize : 200 * 1024 * 1024 , // set it to 200mb to make it easier to test multi-parts download. each wise image is ~64mb
161+ FilePrefix : 'WISE_Files' ,
162+ BaseFileName : 'WISE_Files' ,
163+ DataSource : 'WISE images' ,
164+ FileGroupProcessor : 'LightCurveFileGroupsProcessor'
165+ } } >
166+ < ValidationField
167+ initialState = { {
168+ value : 'A sample download' ,
169+ label : 'Title for this download:'
170+ } }
171+ fieldKey = 'Title'
172+ labelWidth = { 110 } />
173+ </ DownloadOptionPanel >
174+ </ DownloadButton >
175+ </ div >
159176 </ div >
160177 }
161178 { searchDesc }
@@ -178,106 +195,3 @@ const StandardView = ({visToolbar, title, searchDesc, standard, imagePlot, xyPlo
178195 ) ;
179196} ;
180197
181-
182-
183-
184-
185- //*-------------------------------- TEST CODE FOR BACKGROUND MONITOR -------------------------------*/
186- import * as TblUtil from '../../tables/TableUtil.js' ;
187- import { dispatchPackage , doOnPackage } from '../../core/background/BackgroundCntlr.js' ;
188- import { SelectInfo } from '../../tables/SelectInfo.js' ;
189- import DialogRootContainer from '../../ui/DialogRootContainer.jsx' ;
190- import { dispatchShowDialog , dispatchHideDialog } from '../../core/ComponentCntlr.js' ;
191- import { PopupPanel } from '../../ui/PopupPanel.jsx' ;
192- import { dispatchAddSaga } from '../../core/MasterSaga.js' ;
193-
194-
195- const showDownloadDialog = ( show = true , mask ) => {
196- const content = (
197- < PopupPanel title = { 'Download Dialog' } >
198- < DownloadDialog mask = { mask } />
199- </ PopupPanel >
200- ) ;
201- DialogRootContainer . defineDialog ( 'Download Dialog' , content ) ;
202- if ( show ) {
203- dispatchShowDialog ( 'Download Dialog' ) ;
204- } else {
205- dispatchHideDialog ( 'Download Dialog' ) ;
206- }
207- } ;
208-
209- function DownloadDialog ( { mask= false } ) {
210-
211- const onSearchSubmit = ( request ) => {
212- const options = { } ;
213-
214- const searchParams = {
215- no_args : 'this is just a test processor. no parameter is needed'
216- } ;
217- const dlparams = {
218- MaxBundleSize : 1024 * 1024 * 1024 ,
219- FilePrefix : 'WISE_Files' ,
220- BaseFileName : 'WISE_Files' ,
221- DataSource : 'WISE images' ,
222- Title : request . Title
223- } ;
224- const rowCount = request . rowCount || 2 ;
225- const sreq = TblUtil . makeTblRequest ( searchParams . id , 'search request' , searchParams , options ) ;
226- const dreq = TblUtil . makeTblRequest ( 'LightCurveFileGroupsProcessor' , request . Title , dlparams ) ;
227- const selectionInfo = SelectInfo . newInstance ( { selectAll : true , rowCount} ) . toString ( ) ;
228- dispatchPackage ( dreq , sreq , selectionInfo ) ;
229- showDownloadDialog ( true , true ) ;
230- dispatchAddSaga ( doOnPackage , { title : request . Title , callback :( ) => {
231- showDownloadDialog ( false ) ;
232- } } ) ;
233- } ;
234-
235- const labelWidth = 150 ;
236- return (
237- < div style = { { position : 'relative' } } >
238- { mask && < div style = { { width : '100%' , height : '100%' } } className = 'loading-mask' /> }
239- < FormPanel
240- width = '300px' height = '100px'
241- groupKey = 'LC_DOWNLOAD'
242- onSubmit = { ( request ) => onSearchSubmit ( request ) }
243- onCancel = { ( ) => showDownloadDialog ( false ) } >
244- < FieldGroup groupKey = 'LC_DOWNLOAD' keepState = { true } >
245- < InputGroup labelWidth = { 150 } >
246- < ValidationField
247- initialState = { {
248- value : '2' ,
249- validator : Validate . intRange . bind ( null , 1 , 248 , 'Number of images' ) ,
250- groupKey : 'LC_DOWNLOAD' ,
251- label : 'Number of images:'
252- } }
253- fieldKey = 'rowCount'
254- labelWidth = { labelWidth } />
255- < ValidationField
256- initialState = { {
257- value : 'A sample download' ,
258- groupKey : 'LC_DOWNLOAD' ,
259- label : 'Title for this download:'
260- } }
261- fieldKey = 'Title'
262- labelWidth = { labelWidth } />
263- </ InputGroup >
264- </ FieldGroup >
265- </ FormPanel >
266- </ div >
267- ) ;
268-
269- }
270-
271-
272-
273- const DownloadButton = ( { } ) => {
274- return (
275- < div >
276- < button type = 'button'
277- className = 'button std hl'
278- onClick = { showDownloadDialog }
279- title = 'Download lighcurve images'
280- > Download</ button >
281- </ div >
282- ) ;
283- } ;
0 commit comments