mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 10:11:03 +00:00
- term.js - Add eslintignore - Fix color and es2015 after rebase - Fix JS test, probably deleted during conflict resolution - Moves terminal close button to top-right of window - Consitent w/ details window. - Changes padding of details window close button so both close buttons are horizonally aligned. - Terminal resizes w/ browser window. - No longer can drag window around. - Add tiny big of padding between term and node-details. - Playing w/ terminal placement. This one's more drawer-like. - Send DELETE when we close a terminal window. - Dont lint or bable JS vendor files - Ignore ctags 'tags' files. - Adds popping out terminal out into a new browser window. - Simplify code as now we've just a single terminal window. - ESC is back to close the terminal, then the details panel. - Fixes bug w/ slow response to closing the details panel. - Moving away from "drawer-style" for terminal size and position to a simple window. - Just gotta handle the case for refreshing a popped out terminal. - Stop terminal text being auto-deselected. - window resizes will still deselect. - Adds state.connected to react.scu check. - Don't delete pipe when browser closes - To allow for nicer refresh flows - scope-app will time out pipe after a while. - Keep terminal-open/closed state in the url. - shouldComponentUpdate fix to prevent deselection of text has been rolled back so gotta come up w/ another way to handle that... - Fixes terminal text-selection again. - Make pipes work for non-raw terminals too. - Move document.title updating somewhere more sensible. - Pass rawTty prop along to all terminals. - Don't render react root into doc.body - Reconnect the websocket if we lose it. - First, slightly rough, attempt at displaying if pipe has been deleted - Refactor controlPipe structure in the AppStore/hash. - Merge controlPipeId, controlPipeRaw, controlPipeStatus into a single object. - Adds a status bar to the terminal window. - Error handling in popout working again. - Don't show terminal cursor when not connected. - Simplify controlPipe status and error handling. - Don't keep the status in the hash. - Use special new action receiveControlPipeFromParams rather than adding lots of branching to receiveControlPipe. - You can reload a terminal but it doesn't exist in history stack. - Pull out terminal into its own entry point! - Fixes prod webpack build - Fixes terminal-app websocket path when running on prod. - Fixes old terminals appearing when closing a terminal. - History hacking wasn't working, this is a little simpler.
93 lines
2.2 KiB
JavaScript
93 lines
2.2 KiB
JavaScript
var express = require('express');
|
|
var proxy = require('proxy-middleware');
|
|
var httpProxy = require('express-http-proxy');
|
|
var url = require('url');
|
|
|
|
var app = express();
|
|
|
|
|
|
/************************************************************
|
|
*
|
|
* Express routes for:
|
|
* - app.js
|
|
* - app-terminal.js
|
|
* - index.html
|
|
*
|
|
* Proxy requests to:
|
|
* - /api -> :4040/api
|
|
*
|
|
************************************************************/
|
|
|
|
// Serve application file depending on environment
|
|
app.get(/(app|terminal-app).js/, function(req, res) {
|
|
var filename = req.originalUrl;
|
|
if (process.env.NODE_ENV === 'production') {
|
|
res.sendFile(__dirname + '/build' + filename);
|
|
} else {
|
|
res.redirect('//localhost:4041/build' + filename);
|
|
}
|
|
});
|
|
|
|
// Proxy to backend
|
|
|
|
var BACKEND_HOST = process.env.BACKEND_HOST || 'localhost:4040';
|
|
|
|
// HACK need express-http-proxy, because proxy-middleware does
|
|
// not proxy to /api itself
|
|
app.use(httpProxy(BACKEND_HOST, {
|
|
filter: function(req) {
|
|
return url.parse(req.url).path === '/api';
|
|
},
|
|
forwardPath: function(req) {
|
|
return url.parse(req.url).path;
|
|
}
|
|
}));
|
|
|
|
app.use('/api', proxy('http://' + BACKEND_HOST + '/api/'));
|
|
|
|
// Serve index page
|
|
|
|
app.use(express.static('build'));
|
|
|
|
|
|
/*************************************************************
|
|
*
|
|
* Webpack Dev Server
|
|
*
|
|
* See: http://webpack.github.io/docs/webpack-dev-server.html
|
|
*
|
|
*************************************************************/
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
var webpack = require('webpack');
|
|
var WebpackDevServer = require('webpack-dev-server');
|
|
var config = require('./webpack.local.config');
|
|
|
|
new WebpackDevServer(webpack(config), {
|
|
publicPath: config.output.publicPath,
|
|
hot: true,
|
|
noInfo: true,
|
|
historyApiFallback: true,
|
|
stats: { colors: true }
|
|
}).listen(4041, 'localhost', function (err, result) {
|
|
if (err) {
|
|
console.log(err);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
/******************
|
|
*
|
|
* Express server
|
|
*
|
|
*****************/
|
|
|
|
var port = process.env.PORT || 4042;
|
|
var server = app.listen(port, function () {
|
|
var host = server.address().address;
|
|
var port = server.address().port;
|
|
|
|
console.log('Scope UI listening at http://%s:%s', host, port);
|
|
});
|