mirror of
https://github.com/nasa/openmct.git
synced 2024-12-23 15:02:23 +00:00
d48cc2deee
* Add a toolbar provider for display layout. * Move toolbar provider to the plugin * basic toolbar generation * componentize different toolbar control types Break toolbar control types down into different parts and provide a test toolbar generator in index.html that utilizes all the controls. * Get the 'Show frame' checkbox working in the toolbar * - Remove extra listener. - Display toolbar only when editing. * Modify the Selection API to set s-selected and s-selected-parent attributes instead of adding to the css class names. * Move the logic for allowing the toolbar in the edit mode to the provider. * Use toggle-button component to toggle frame * Delete old files * Remove MCTToolbar * Modify the toggle button component to return the computed value * Remove reload=true * Revert to the original setting * use value from props * Always update toolbars on edit status change * restore fixed position bundle * bring back reload when hmr unavailable
79 lines
2.1 KiB
JavaScript
79 lines
2.1 KiB
JavaScript
/*global require,process,console*/
|
|
|
|
/**
|
|
* Usage:
|
|
*
|
|
* npm install minimist express
|
|
* node app.js [options]
|
|
*/
|
|
|
|
|
|
const options = require('minimist')(process.argv.slice(2));
|
|
const express = require('express');
|
|
const app = express();
|
|
const fs = require('fs');
|
|
const request = require('request');
|
|
|
|
// Defaults
|
|
options.port = options.port || options.p || 8080;
|
|
options.host = options.host || options.h || 'localhost';
|
|
options.directory = options.directory || options.D || '.';
|
|
|
|
// Show command line options
|
|
if (options.help || options.h) {
|
|
console.log("\nUsage: node app.js [options]\n");
|
|
console.log("Options:");
|
|
console.log(" --help, -h Show this message.");
|
|
console.log(" --port, -p <number> Specify port.");
|
|
console.log(" --directory, -D <bundle> Serve files from specified directory.");
|
|
console.log("");
|
|
process.exit(0);
|
|
}
|
|
|
|
app.disable('x-powered-by');
|
|
|
|
app.use('/proxyUrl', function proxyRequest(req, res, next) {
|
|
console.log('Proxying request to: ', req.query.url);
|
|
req.pipe(request({
|
|
url: req.query.url,
|
|
strictSSL: false
|
|
}).on('error', next)).pipe(res);
|
|
});
|
|
|
|
const webpack = require('webpack');
|
|
const webpackConfig = require('./webpack.config.js');
|
|
webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
|
|
webpackConfig.plugins.push(function() { this.plugin('watch-run', function(watching, callback) { console.log('Begin compile at ' + new Date()); callback(); }) });
|
|
|
|
webpackConfig.entry.openmct = [
|
|
'webpack-hot-middleware/client?reload=true',
|
|
webpackConfig.entry.openmct
|
|
];
|
|
|
|
const compiler = webpack(webpackConfig);
|
|
|
|
app.use(require('webpack-dev-middleware')(
|
|
compiler,
|
|
{
|
|
publicPath: '/dist',
|
|
logLevel: 'warn'
|
|
}
|
|
));
|
|
|
|
app.use(require('webpack-hot-middleware')(
|
|
compiler,
|
|
{
|
|
|
|
}
|
|
));
|
|
|
|
// Expose index.html for development users.
|
|
app.get('/', function (req, res) {
|
|
fs.createReadStream('index.html').pipe(res);
|
|
});
|
|
|
|
// Finally, open the HTTP server and log the instance to the console
|
|
app.listen(options.port, options.host, function() {
|
|
console.log('Open MCT application running at %s:%s', options.host, options.port)
|
|
});
|