Skip to content

Commit 20d8286

Browse files
committed
DM-7406: Create Light curve skeleton app
- introduce template into firefly entry point. - create light curve as a template. - create viewer, controller, and results component for light curve. - these components are place holders and are not fully implemented. - create upload form for use during development.
1 parent 8035128 commit 20d8286

17 files changed

+653
-70
lines changed

src/firefly/html/lc.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!doctype html>
2+
<html>
3+
4+
<head>
5+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6+
<link rel="icon" type="image/x-icon" href="images/fftools-logo-16x16.png">
7+
<meta name="apple-mobile-web-app-capable" content="yes" />
8+
<title>Light Curve Viewer</title>
9+
10+
<script>
11+
window.firefly = {
12+
app: {
13+
template: 'LightCurveViewer',
14+
menu: [
15+
{label:'Upload', action:'LCUpload'},
16+
{label:'Catalogs', action:'IrsaCatalogDropDown'},
17+
{label:'Help', action:'app_data.helpLoad', type:'COMMAND'},
18+
]
19+
},
20+
};
21+
</script>
22+
<script type="text/javascript" src="firefly_loader.js"></script>
23+
</head>
24+
25+
<body style="margin: 0; background-color: rgb(200,200,200)">
26+
<!-- attached loaction for firefly app -->
27+
<div id='app'/>
28+
29+
30+
31+
32+
</body>
33+
34+
</html>
35+
36+

src/firefly/js/FFEntryPoint.js

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,53 @@ import {get} from 'lodash';
99

1010
import {firefly} from './Firefly.js';
1111
import {FireflyViewer} from './core/FireflyViewer.js';
12+
import {LcViewer} from './templates/lightcurve/LcViewer.jsx';
1213
import {initApi} from './api/ApiBuild.js';
1314
import {HELP_LOAD} from './core/AppDataCntlr.js';
1415

16+
firefly.bootstrap();
17+
18+
1519
/**
16-
* By default, firefly.js will startup in api mode.
17-
* If you want it to startup as an application, you need to at least
18-
* define a firefly.app options variable under window.
19-
*
20-
* Options will be passed into <Application>'s props.
21-
* By default, the application will be mounted to the 'app' div.
22-
* Use firefly.app.div to set it to something else.
23-
* Read Application's doc for more details the firefly.app properties.
24-
*
25-
*
26-
* Below is an example of how to startup FireflyViewer with 2 menu items in an 'image_table' view.
20+
* A list of available templates
21+
* @enum {string}
22+
*/
23+
// eslint-disable-next-line
24+
const Template = {
25+
/**
26+
* This templates has multiple views: 'images', 'tables', and 'xyPlots'.
27+
* They can be combined with ' | ', i.e. 'images | tables'
28+
*/
29+
FFV: 'FireflyViewer',
30+
LCV: 'LightCurveViewer'
31+
};
32+
33+
34+
/**
35+
* This entry point allows dynamic application loading. Use firefly.app to configure
36+
* what this application should do
37+
* @namespace firefly
38+
* @type {object}
39+
* @prop {Template} template the name of the template to use. defaults to 'FireflyViewer'
40+
* @prop {string} appTitle title of this application.
41+
* @prop {string} div the div to load this application into. defaults to 'app'
42+
* @prop {Object} menu custom menu bar
43+
* @prop {string} menu.label button's label
44+
* @prop {string} menu.action action to fire on button clicked
45+
* @prop {string} menu.type use 'COMMAND' for actions that's not drop-down related.
46+
* @prop {string} views some template may have multiple views. use this to select specify
47+
* @example
48+
* This is an example of how to startup FireflyViewer with 2 menu items in an image and table view.
2749
* <script type="text/javascript" language='javascript'>
2850
* const menu = [{label:'Search', action:'TestSearches'},
2951
* {label:'Images', action:'ImageSelectDropDownCmd'}];
30-
* window.firefly = {app: {views: 'image_table', menu}};
52+
* window.firefly = {app: {views: 'images | tables', menu}};
3153
* </script>
32-
*
3354
*/
34-
35-
36-
firefly.bootstrap();
37-
3855
const app = get(window, 'firefly.app');
3956

4057
if (app) {
41-
const defProps = {
42-
appTitle: 'Firefly',
43-
views: 'images | tables | xyPlots',
58+
const defaults = {
4459
div: 'app',
4560
menu: [ {label:'Data Sets: Catalogs & Images', action:'AnyDataSetSearch'},
4661
{label:'Catalogs CLASSIC', action:'IrsaCatalogDropDown'},
@@ -51,9 +66,10 @@ if (app) {
5166
{label:'Example Js Dialog', action:'exampleDialog', type:'COMMAND'}
5267
]
5368
};
54-
const props = Object.assign({}, defProps, app);
69+
const props = Object.assign(defaults, app);
70+
const viewer = app.template === Template.LCV ? LcViewer : FireflyViewer;
5571

56-
ReactDOM.render(React.createElement(FireflyViewer, props),
72+
ReactDOM.render(React.createElement(viewer, props),
5773
document.getElementById(props.div));
5874
}
5975
else {

src/firefly/js/core/FireflyViewer.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import {flux, firefly} from '../Firefly.js';
1111
import {getMenu, isAppReady, dispatchSetMenu, dispatchOnAppReady} from '../core/AppDataCntlr.js';
1212
import {LO_VIEW, getLayouInfo, SHOW_DROPDOWN} from '../core/LayoutCntlr.js';
1313
import {layoutManager} from '../core/layout/FireflyLayoutManager.js';
14-
import {Menu, getDropDownNames} from '../ui/Menu.jsx';
15-
import Banner from '../ui/Banner.jsx';
14+
import {Menu} from '../ui/Menu.jsx';
15+
import {Banner} from '../ui/Banner.jsx';
1616
import {DropDownContainer} from '../ui/DropDownContainer.jsx';
1717
import {TriViewPanel} from '../ui/TriViewPanel.jsx';
1818
import {VisHeader} from '../visualize/ui/VisHeader.jsx';
@@ -34,7 +34,7 @@ import {dispatchAddSaga} from '../core/MasterSaga.js';
3434
* <li><b>appTitle</b>: The title of the FireflyViewer. It will appears at top left of the banner. Defaults to 'Firefly'. </li>
3535
* <li><b>appIcon</b>: A url string to the icon to appear on the banner. </li>
3636
* <li><b>footer</b>: A react elements to place on the footer when the menu drop down. </li>
37-
* <li><b>searchPanels</b>: An array of additional react elements which are mapped to a menu item's action. </li>
37+
* <li><b>dropdownPanels</b>: An array of additional react elements which are mapped to a menu item's action. </li>
3838
* <li><b>views</b>: The type of result view. Choices are 'images', 'tables', and 'xyPlots'. They can be combined with ' | ', i.e. 'images | tables'</li>
3939
*
4040
*/
@@ -82,9 +82,8 @@ export class FireflyViewer extends Component {
8282

8383
render() {
8484
var {isReady, menu={}, appTitle, appIcon, altAppIcon, dropDown,
85-
searchPanels, views, footer, style, showViewsSwitch} = this.state;
85+
dropdownPanels, views, footer, style, showViewsSwitch} = this.state;
8686
const {visible, view} = dropDown || {};
87-
const searches = getDropDownNames();
8887

8988
if (!isReady) {
9089
return (<div style={{top: 0}} className='loading-mask'/>);
@@ -98,7 +97,7 @@ export class FireflyViewer extends Component {
9897
footer={footer}
9998
visible={!!visible}
10099
selected={view}
101-
{...{searches, searchPanels} } />
100+
{...{dropdownPanels} } />
102101
</header>
103102
<main>
104103
<DynamicResults {...{views, showViewsSwitch}}/>
@@ -111,8 +110,8 @@ export class FireflyViewer extends Component {
111110

112111
/**
113112
* menu is an array of menu items {label, action, icon, desc, type}.
114-
* searchPanels is an array of additional react elements which are mapped to a menu item's action.
115-
* @type {{title: *, menu: *, appTitle: *, appIcon: *, altAppIcon: *, searchPanels: *, views: *}}
113+
* dropdownPanels is an array of additional react elements which are mapped to a menu item's action.
114+
* @type {{title: *, menu: *, appTitle: *, appIcon: *, altAppIcon: *, dropdownPanels: *, views: *}}
116115
*/
117116
FireflyViewer.propTypes = {
118117
title: PropTypes.string,
@@ -121,14 +120,15 @@ FireflyViewer.propTypes = {
121120
appIcon: PropTypes.string,
122121
altAppIcon: PropTypes.string,
123122
footer: PropTypes.element,
124-
searchPanels: PropTypes.arrayOf(PropTypes.element),
123+
dropdownPanels: PropTypes.arrayOf(PropTypes.element),
125124
views: PropTypes.string, // combination of LO_VIEW separated by ' | '. ie. 'images | tables'.
126125
style: PropTypes.object,
127126
showViewsSwitch: PropTypes.bool
128127
};
129128

130129
FireflyViewer.defaultProps = {
131-
views: 'tri_view'
130+
appTitle: 'Firefly',
131+
views: 'images | tables | xyPlots'
132132
};
133133

134134
function onReady({menu, views}) {

src/firefly/js/tables/ui/TablePanel.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@
6161
position: absolute;
6262
top: 0;
6363
left: 0;
64-
right: 0;}
64+
right: 0;
65+
white-space: nowrap;
66+
}
6567

6668
.TablePanel__table {
6769
background-color: white;

0 commit comments

Comments
 (0)