Skip to content

Commit c68a439

Browse files
committed
DM-8385: PDAC v1 deployment
- setup LSST/suit repo - added lsst logo onto the banner - make sure build scripts are fully functional - minor code refactoring
1 parent 7fb7394 commit c68a439

File tree

6 files changed

+77
-92
lines changed

6 files changed

+77
-92
lines changed

buildScript/webpack.config.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* eslint-env node */
22

33
import webpack from 'webpack';
4-
import HtmlWebpackPlugin from 'html-webpack-plugin';
54
import ExtractTextPlugin from 'extract-text-webpack-plugin';
65
import path from 'path';
76
import fs from 'fs';
@@ -33,7 +32,6 @@ export default function makeWebpackConfig(config) {
3332
env : process.env.NODE_ENV || 'development',
3433
dist : process.env.WP_BUILD_DIR || path.resolve(config.project, `build/${config.name}/gwt/${config.name}`),
3534
do_lint : process.env.DO_LINT || process.env.DO_LINT_STRICT || false,
36-
index_html : 'index.html',
3735
html_dir : 'html',
3836
use_loader : true,
3937
filename : '[name]-dev.js',
@@ -116,20 +114,6 @@ export default function makeWebpackConfig(config) {
116114
);
117115
}
118116

119-
// if index_html exists, insert script tag to load built javascript bundles(s).
120-
if (fs.existsSync(path.resolve(config.dist, config.index_html))) {
121-
plugins.push(
122-
new HtmlWebpackPlugin({
123-
template : path.resolve(config.src, config.html_dir, config.index_html),
124-
hash : false,
125-
filename : config.index_html,
126-
minify : PROD,
127-
inject : 'body'
128-
})
129-
);
130-
}
131-
132-
133117
/*------------------------ MODULE -----------------------------*/
134118
var loaders = [
135119
{ test : /\.(js|jsx)$/,

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"style-loader": "^0.12.3",
5353
"url-loader": "^0.5.7",
5454
"file-loader": "^0.9.0",
55-
"html-webpack-plugin": "^1.6.1",
5655
"extract-text-webpack-plugin": "^0.8.0",
5756
"eslint" : "^3.4.0",
5857
"eslint-loader" : "^1.5.0",

src/firefly/js/FFEntryPoint.js

Lines changed: 24 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,10 @@
33
*/
44

55

6-
import React from 'react';
7-
import ReactDOM from 'react-dom';
86
import {get} from 'lodash';
97

10-
import {firefly} from './Firefly.js';
11-
import {FireflyViewer} from './templates/fireflyviewer/FireflyViewer.js';
12-
import {LcViewer} from './templates/lightcurve/LcViewer.jsx';
13-
import {initApi} from './api/ApiBuild.js';
8+
import {firefly, Templates} from './Firefly.js';
149
import {HELP_LOAD} from './core/AppDataCntlr.js';
15-
import {dispatchAppOptions} from './core/AppDataCntlr.js';
16-
17-
firefly.bootstrap();
18-
19-
20-
/**
21-
* A list of available templates
22-
* @enum {string}
23-
*/
24-
const Templates = {
25-
/**
26-
* This templates has multiple views: 'images', 'tables', and 'xyPlots'.
27-
* They can be combined with ' | ', i.e. 'images | tables'
28-
*/
29-
FireflyViewer,
30-
LightCurveViewer : LcViewer
31-
};
32-
33-
3410

3511

3612
/**
@@ -50,7 +26,11 @@ const Templates = {
5026

5127
/**
5228
* This entry point allows dynamic application loading. Use firefly.app to configure
53-
* what this application should do
29+
* what this application should do.
30+
* By default, firefly.js will startup in api mode.
31+
* If you want it to startup as an application, you need to at least
32+
* define a firefly.app under window.
33+
*
5434
* @namespace firefly
5535
* @type {object}
5636
* @prop {Templates} template the name of the template to use. defaults to 'FireflyViewer'
@@ -70,39 +50,25 @@ const Templates = {
7050
* window.firefly = {app: {views: 'images | tables', menu}};
7151
* </script>
7252
*/
73-
const app = get(window, 'firefly.app');
74-
75-
if (get(app, 'options')) {
76-
const defOps = {
77-
MenuItemKeys: {},
78-
imageTabs: undefined,
79-
irsaCatalogFilter: undefined,
80-
catalogSpacialOp: undefined
81-
};
82-
dispatchAppOptions(Object.assign({},defOps, app.options));
83-
}
84-
85-
if (get(app, 'template')) {
86-
const defaults = {
87-
div: 'app',
88-
template: 'FireflyViewer',
89-
menu: [ {label:'Data Sets: Catalogs & Images', action:'AnyDataSetSearch'},
90-
{label:'Catalogs CLASSIC', action:'IrsaCatalogDropDown'},
91-
{label:'Test Searches', action:'TestSearches'},
92-
{label:'Images', action:'ImageSelectDropDownCmd'},
93-
{label:'Charts', action:'ChartSelectDropDownCmd'},
94-
{label:'Help', action:HELP_LOAD, type:'COMMAND'},
95-
{label:'Example Js Dialog', action:'exampleDialog', type:'COMMAND'}
96-
]
97-
};
98-
const props = Object.assign(defaults, app);
99-
const viewer = Templates[props.template];
53+
const defaults = {
54+
div: 'app',
55+
template: 'FireflyViewer',
56+
menu: [ {label:'Data Sets: Catalogs & Images', action:'AnyDataSetSearch'},
57+
{label:'Catalogs CLASSIC', action:'IrsaCatalogDropDown'},
58+
{label:'Test Searches', action:'TestSearches'},
59+
{label:'Images', action:'ImageSelectDropDownCmd'},
60+
{label:'Charts', action:'ChartSelectDropDownCmd'},
61+
{label:'Help', action:HELP_LOAD, type:'COMMAND'},
62+
{label:'Example Js Dialog', action:'exampleDialog', type:'COMMAND'}
63+
]
64+
};
10065

101-
ReactDOM.render(React.createElement(viewer, props),
102-
document.getElementById(props.div));
103-
}
104-
else {
105-
initApi();
66+
const app = get(window, 'firefly.app', {});
67+
var viewer, props;
68+
if (app.template) {
69+
props = Object.assign({}, defaults, app);
70+
viewer = Templates[props.template];
10671
}
10772

73+
firefly.bootstrap(app.options, viewer, props);
10874

src/firefly/js/Firefly.js

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
/*global __$version_tag*/
55

66

7-
import 'babel-polyfill';
7+
// import 'babel-polyfill';
88
import 'isomorphic-fetch';
99
import React from 'react';
10+
import ReactDOM from 'react-dom';
1011
import 'styles/global.css';
1112

1213
import {APP_LOAD} from './core/AppDataCntlr.js';
@@ -15,6 +16,9 @@ import {ExtensionResult } from './gwtinterface/ExtensionResult.js';
1516
import {PlotCmdExtension } from './visualize/PlotCmdExtension.js';
1617
import {ReactJavaInterface } from './gwtinterface/ReactJavaInterface.jsx';
1718
import {showExampleDialog} from './ui/ExampleDialog.jsx';
19+
import {FireflyViewer} from './templates/fireflyviewer/FireflyViewer.js';
20+
import {LcViewer} from './templates/lightcurve/LcViewer.jsx';
21+
import {initApi} from './api/ApiBuild.js';
1822

1923
import {ServerRequest } from './data/ServerRequest.js';
2024
import PlotState from './visualize/PlotState.js';
@@ -24,9 +28,25 @@ import ExternalAccessUtils from './core/ExternalAccessUtils.js';
2428
import {reduxFlux} from './core/ReduxFlux.js';
2529
import {wsConnect} from './core/messaging/WebSocketClient.js';
2630
import {ActionEventHandler} from './core/messaging/MessageHandlers.js';
31+
import {dispatchAppOptions} from './core/AppDataCntlr.js';
2732

2833
export const flux = reduxFlux;
2934

35+
/**
36+
* A list of available templates
37+
* @enum {string}
38+
*/
39+
export const Templates = {
40+
/**
41+
* This templates has multiple views: 'images', 'tables', and 'xyPlots'.
42+
* They can be combined with ' | ', i.e. 'images | tables'
43+
*/
44+
FireflyViewer,
45+
LightCurveViewer : LcViewer
46+
};
47+
48+
49+
3050
/**
3151
* work around for transition from flummox to redux
3252
*/
@@ -90,15 +110,9 @@ export function getVersion() {
90110
}
91111

92112

93-
export var firefly = {
113+
export const firefly = {
94114

95-
bootstrap() {
96-
return new Promise(function(resolve, reject) {
97-
fireflyInit();
98-
flux.process( {type : APP_LOAD} );
99-
resolve();
100-
});
101-
},
115+
bootstrap,
102116

103117
process(rawAction, condition) {
104118
return flux.process(rawAction, condition);
@@ -111,4 +125,33 @@ export var firefly = {
111125
};
112126

113127

128+
/**
129+
* boostrap Firefly api or application.
130+
* @param options global options used by both application and api
131+
* @param viewer render this viewer onto the document. if viewer does not exists, it will init api instead.
132+
* @param props viewer's props used for rendering.
133+
* @returns {Promise.<boolean>}
134+
*/
135+
function bootstrap(options, viewer, props) {
136+
137+
fireflyInit();
138+
flux.process( {type : APP_LOAD} );
114139

140+
if (options) {
141+
const defOps = {
142+
MenuItemKeys: {},
143+
imageTabs: undefined,
144+
irsaCatalogFilter: undefined,
145+
catalogSpacialOp: undefined
146+
};
147+
dispatchAppOptions(Object.assign({},defOps, options));
148+
}
149+
if (viewer) {
150+
ReactDOM.render(React.createElement(viewer, props),
151+
document.getElementById(props.div));
152+
} else {
153+
initApi();
154+
155+
}
156+
return Promise.resolve(true);
157+
}

src/firefly/js/core/ReduxFlux.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,7 @@ function bootstrap() {
235235
redux = createRedux();
236236
startCoreSagas();
237237
}
238-
return new Promise(
239-
function (resolve, reject) {
240-
// there may be async logic here..
241-
// if not, simply invoke resolve.
242-
resolve('success');
243-
});
238+
return Promise.resolve('success');
244239
}
245240

246241
/**

src/firefly/js/ui/Banner.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
.banner__left {
1111
flex-grow: 0;
12-
width: 75px;
13-
height: 75px;
1412
}
1513

1614
.banner__middle {

0 commit comments

Comments
 (0)