Merge branch 'master' into ng-accounts-backup

This commit is contained in:
Nicolas Gotchac
2016-10-26 18:43:05 +02:00
76 changed files with 824 additions and 599 deletions

1
js/.gitignore vendored
View File

@@ -3,4 +3,5 @@ npm-debug.log
build
.build
.coverage
.dist
.happypack

View File

@@ -24,17 +24,38 @@ var express = require('express');
var proxy = require('http-proxy-middleware');
var app = express();
var wsProxy = proxy('ws://127.0.0.1:8180', { changeOrigin: true });
app.use(express.static('build'));
app.use(express.static('.build'));
app.use('/api/*', proxy({
target: 'http://127.0.0.1:8080',
changeOrigin: true
}));
app.use('/app/*', proxy({
target: 'http://127.0.0.1:8080',
changeOrigin: true,
pathRewrite: {
'^/app': ''
}
}));
app.use('/parity-utils/*', proxy({
target: 'http://127.0.0.1:3000',
changeOrigin: true,
pathRewrite: {
'^/parity-utils': ''
}
}));
app.use('/rpc/*', proxy({
target: 'http://127.0.0.1:8080',
changeOrigin: true
}));
app.listen(3000);
app.use(wsProxy);
var server = app.listen(3000);
server.on('upgrade', wsProxy.upgrade);

View File

@@ -23,17 +23,22 @@
"Promise"
],
"scripts": {
"build": "npm run build:dll && npm run build:app",
"build": "npm run build:dll && npm run build:app && npm run build:lib",
"build:app": "webpack --progress",
"build:dll": "webpack --config webpack.vendor.js --progress",
"ci:build": "npm run ci:build:dll && npm run ci:build:app",
"build:lib": "webpack --config webpack.libraries --progress",
"build:dll": "webpack --config webpack.vendor --progress",
"ci:build": "npm run ci:build:dll && npm run ci:build:app && npm run ci:build:lib",
"ci:build:app": "NODE_ENV=production webpack",
"ci:build:dll": "NODE_ENV=production webpack --config webpack.vendor.js",
"ci:build:lib": "NODE_ENV=production webpack --config webpack.libraries",
"ci:build:dll": "NODE_ENV=production webpack --config webpack.vendor",
"start": "npm install && npm run build:dll && npm run start:app",
"start:app": "webpack-dev-server -d --history-api-fallback --open --hot --inline --progress --colors --port 3000",
"clean": "rm -rf ./build ./coverage",
"coveralls": "npm run testCoverage && coveralls < coverage/lcov.info",
"lint": "eslint --ignore-path .gitignore ./src/",
"start": "npm install && npm run build:dll && npm run start:app",
"start:app": "webpack-dev-server -d --history-api-fallback --open --hot --inline --progress --colors --port 3000",
"test": "mocha 'src/**/*.spec.js'",
"test:coverage": "istanbul cover _mocha -- 'src/**/*.spec.js'",
"test:e2e": "mocha 'src/**/*.e2e.js'"

View File

@@ -6,8 +6,15 @@ cd ..
# run build (production) and store the exit code
EXITCODE=0
rm -rf .build
npm run ci:build || EXITCODE=1
BUILDDIR=./.dist
rm -rf $BUILDDIR
mkdir -p $BUILDDIR/src
BUILD_DEST=$BUILDDIR/build npm run ci:build || EXITCODE=1
# Copy rust files
cp Cargo.precompiled.toml $BUILDDIR/Cargo.toml
cp build.rs $BUILDDIR
cp src/lib.rs* $BUILDDIR/src
# back to root
popd

View File

@@ -13,21 +13,11 @@ function setup_git_user {
BASEDIR=`dirname $0`
GITLOG=./.git/gitcommand.log
pushd $BASEDIR
cd ../.build
cd ../.dist
# variables
UTCDATE=`date -u "+%Y%m%d-%H%M%S"`
# Create proper directory structure
mkdir -p build
mv *.* build
mkdir -p src
# Copy rust files
cp ../Cargo.precompiled.toml Cargo.toml
cp ../build.rs .
cp ../src/lib.rs* ./src/
# init git
rm -rf ./.git
git init
@@ -40,21 +30,23 @@ git checkout -b $CI_BUILD_REF_NAME
git add .
git commit -m "$UTCDATE [compiled]"
git merge origin/$CI_BUILD_REF_NAME -X ours --commit -m "$UTCDATE [release]"
git push origin $CI_BUILD_REF_NAME 2>$GITLOG
git push origin HEAD:refs/heads/$CI_BUILD_REF_NAME 2>$GITLOG
# back to root
popd
# bump js-precompiled
cargo update -p parity-ui-precompiled
# add to git and push
# inti git with right origin
setup_git_user
git remote set-url origin https://${GITHUB_JS_PRECOMPILED}:@github.com/ethcore/parity.git
git fetch origin 2>$GITLOG
# at this point we have a detached head on GitLab, reset
git reset --hard origin/$CI_BUILD_REF_NAME 2>$GITLOG
# bump js-precompiled, add, commit & push
cargo update -p parity-ui-precompiled
git add . || true
git commit -m "[ci skip] js-precompiled $UTCDATE" || true
git push origin $CI_BUILD_REF_NAME 2>$GITLOG || true
git commit -m "[ci skip] js-precompiled $UTCDATE"
git push origin HEAD:refs/heads/$CI_BUILD_REF_NAME 2>$GITLOG
# exit with exit code
exit 0

View File

@@ -173,12 +173,12 @@ describe('api/contract/Contract', () => {
expect(log.event).to.equal('Message');
expect(log.address).to.equal('0x22bff18ec62281850546a664bb63a5c06ac5f76c');
expect(log.params).to.deep.equal({
at: new BigNumber('1457965151'),
message: 'post(message)',
messageId: new BigNumber('281474976731085'),
parentId: new BigNumber(0),
postId: new BigNumber('281474976731104'),
sender: '0x63Cf90D3f0410092FC0fca41846f596223979195'
at: { type: 'uint', value: new BigNumber('1457965151') },
message: { type: 'string', value: 'post(message)' },
messageId: { type: 'uint', value: new BigNumber('281474976731085') },
parentId: { type: 'uint', value: new BigNumber(0) },
postId: { type: 'uint', value: new BigNumber('281474976731104') },
sender: { type: 'address', value: '0x63Cf90D3f0410092FC0fca41846f596223979195' }
});
});
});
@@ -464,12 +464,12 @@ describe('api/contract/Contract', () => {
event: 'Message',
logIndex: new BigNumber(0),
params: {
at: new BigNumber(1457965151),
message: 'post(message)',
messageId: new BigNumber(281474976731085),
parentId: new BigNumber(0),
postId: new BigNumber(281474976731104),
sender: '0x63Cf90D3f0410092FC0fca41846f596223979195'
at: { type: 'uint', value: new BigNumber(1457965151) },
message: { type: 'string', value: 'post(message)' },
messageId: { type: 'uint', value: new BigNumber(281474976731085) },
parentId: { type: 'uint', value: new BigNumber(0) },
postId: { type: 'uint', value: new BigNumber(281474976731104) },
sender: { type: 'address', value: '0x63Cf90D3f0410092FC0fca41846f596223979195' }
},
topics: [
'0x954ba6c157daf8a26539574ffa64203c044691aa57251af95f4b48d85ec00dd5', '0x0000000000000000000000000000000000000000000000000001000000004fe0'

View File

@@ -93,21 +93,30 @@ export default class Ws extends JsonRpcBase {
}
_onMessage = (event) => {
const result = JSON.parse(event.data);
const { method, params, json, resolve, reject } = this._messages[result.id];
Logging.send(method, params, { json, result });
if (result.error) {
this.error(event.data);
reject(new Error(`${result.error.code}: ${result.error.message}`));
delete this._messages[result.id];
return;
// Event sent by Signer Broadcaster
if (event.data === 'new_message') {
return false;
}
resolve(result.result);
delete this._messages[result.id];
try {
const result = JSON.parse(event.data);
const { method, params, json, resolve, reject } = this._messages[result.id];
Logging.send(method, params, { json, result });
if (result.error) {
this.error(event.data);
reject(new Error(`${result.error.code}: ${result.error.message}`));
delete this._messages[result.id];
return;
}
resolve(result.result);
delete this._messages[result.id];
} catch (e) {
console.error('ws::_onMessage', event.data, e);
}
}
_send = (id) => {

View File

@@ -10,7 +10,7 @@
<div id="container"></div>
<script src="vendor.js"></script>
<script src="commons.js"></script>
<script src="parity.js"></script>
<script src="/parity-utils/parity.js"></script>
<script src="basiccoin.js"></script>
</body>
</html>

View File

@@ -10,7 +10,7 @@
<div id="container"></div>
<script src="vendor.js"></script>
<script src="commons.js"></script>
<script src="parity.js"></script>
<script src="/parity-utils/parity.js"></script>
<script src="gavcoin.js"></script>
</body>
</html>

View File

@@ -24,7 +24,7 @@ export default class Loading extends Component {
render () {
return (
<div className={ styles.loading }>
<CircularProgress size={ 2 } />
<CircularProgress size={ 120 } thickness={ 7 } />
</div>
);
}

View File

@@ -10,7 +10,7 @@
<div id="container"></div>
<script src="vendor.js"></script>
<script src="commons.js"></script>
<script src="parity.js"></script>
<script src="/parity-utils/parity.js"></script>
<script src="githubhint.js"></script>
</body>
</html>

View File

@@ -10,7 +10,7 @@
<div id="container"></div>
<script src="vendor.js"></script>
<script src="commons.js"></script>
<script src="parity.js"></script>
<script src="/parity-utils/parity.js"></script>
<script src="registry.js"></script>
</body>
</html>

View File

@@ -79,7 +79,7 @@ export default class Application extends Component {
</p>
</div>
) : (
<CircularProgress size={ 1 } />
<CircularProgress size={ 60 } />
) }
</div>
);

View File

@@ -10,7 +10,7 @@
<div id="container"></div>
<script src="vendor.js"></script>
<script src="commons.js"></script>
<script src="parity.js"></script>
<script src="/parity-utils/parity.js"></script>
<script src="signaturereg.js"></script>
</body>
</html>

View File

@@ -10,7 +10,7 @@
<div id="container"></div>
<script src="vendor.js"></script>
<script src="commons.js"></script>
<script src="parity.js"></script>
<script src="/parity-utils/parity.js"></script>
<script src="tokenreg.js"></script>
</body>
</html>

View File

@@ -25,9 +25,11 @@ export default class Loading extends Component {
};
render () {
const size = (this.props.size || 2) * 60;
return (
<div className={ styles.loading }>
<CircularProgress size={ this.props.size || 2 } />
<CircularProgress size={ size } />
</div>
);
}

View File

@@ -7,6 +7,6 @@
<title>dev::Parity.js</title>
</head>
<body>
<script src="parity.js"></script>
<script src="/parity-utils/parity.js"></script>
</body>
</html>

View File

@@ -7,6 +7,6 @@
<title>dev::Web3</title>
</head>
<body>
<script src="inject.js"></script>
<script src="/parity-utils/web3.js"></script>
</body>
</html>

View File

@@ -19,7 +19,13 @@
import './tests';
const parityNode = process.env.NODE_ENV === 'production' ? 'http://127.0.0.1:8080' : '';
const parityNode = (
process.env.PARITY_URL && `http://${process.env.PARITY_URL}`
) || (
process.env.NODE_ENV === 'production'
? 'http://127.0.0.1:8080'
: ''
);
export {
parityNode

View File

@@ -137,7 +137,7 @@ export default class EditMeta extends Component {
onTagsInputChange = (value) => {
const { meta } = this.state;
const { tags } = meta || [];
const { tags = [] } = meta;
const tokens = value.split(/[\s,;]+/);

View File

@@ -15,15 +15,17 @@
/* along with Parity. If not, see <http://www.gnu.org/licenses/>.
*/
.container {
flex: 1;
padding: 0em;
background: rgba(0, 0, 0, 0.8) !important;
}
.compact,
.padded {
background: rgba(0, 0, 0, 0.8) !important;
border-radius: 0 !important;
position: relative;
overflow: auto;
background-color: transparent !important;
}
.compact {

View File

@@ -39,8 +39,8 @@ export default class Summary extends Component {
}
const url = `/app/${app.builtin ? 'global' : 'local'}/${app.url || app.id}`;
const image = app.image
? <img src={ app.image } className={ styles.image } />
const image = app.image || app.iconUrl
? <img src={ app.image || `http://127.0.0.1:8080/${app.id}/${app.iconUrl}` } className={ styles.image } />
: <div className={ styles.image }>&nbsp;</div>;
return (

View File

@@ -43,7 +43,7 @@
.expanded {
right: 16px;
width: 964px;
height: 288px;
height: 300px;
border-radius: 4px 4px 0 0;
overflow-y: auto;
display: flex;
@@ -53,6 +53,7 @@
.expanded .content {
flex: 1;
overflow: auto;
display: flex;
}
.corner {

View File

@@ -80,7 +80,7 @@ export default class TransactionFinished extends Component {
if (!chain || !fromBalance || !toBalance) {
return (
<div className={ `${styles.container} ${className}` }>
<CircularProgress size={ 1 } />
<CircularProgress size={ 60 } />
</div>
);
}

View File

@@ -81,7 +81,7 @@ export default class TransactionPending extends Component {
if (!this.state.chain) {
return (
<div className={ `${styles.container} ${className}` }>
<CircularProgress size={ 1 } />
<CircularProgress size={ 60 } />
</div>
);
}

View File

@@ -41,7 +41,8 @@ module.exports = {
'signaturereg': ['./dapps/signaturereg.js'],
'tokenreg': ['./dapps/tokenreg.js'],
// library
'inject': ['./inject.js'],
'inject': ['./web3.js'],
'web3': ['./web3.js'],
'parity': ['./parity.js'],
// app
'index': ['./index.js']
@@ -136,10 +137,6 @@ module.exports = {
'babel?cacheDirectory=true'
]
}),
new webpack.DllReferencePlugin({
context: '.',
manifest: require(`./${DEST}/vendor-manifest.json`)
}),
new CopyWebpackPlugin([{ from: './error_pages.css', to: 'styles.css' }], {}),
new WebpackErrorNotificationPlugin(),
new webpack.DefinePlugin({
@@ -149,6 +146,11 @@ module.exports = {
PARITY_URL: JSON.stringify(process.env.PARITY_URL),
LOGGING: JSON.stringify(!isProd)
}
}),
new webpack.DllReferencePlugin({
context: '.',
manifest: require(`./${DEST}/vendor-manifest.json`)
})
];
@@ -164,16 +166,10 @@ module.exports = {
if (isProd) {
plugins.push(
new webpack.optimize.CommonsChunkPlugin({
chunks: [ 'index' ],
chunks: ['index'],
name: 'commons'
})
);
plugins.push(
new webpack.optimize.CommonsChunkPlugin({
chunks: [ 'parity' ],
name: 'parity'
})
);
plugins.push(new webpack.optimize.OccurrenceOrderPlugin(false));
plugins.push(new webpack.optimize.DedupePlugin());
@@ -208,8 +204,11 @@ module.exports = {
}
},
'/parity-utils/*': {
target: 'http://127.0.0.1:8080',
changeOrigin: true
target: 'http://127.0.0.1:3000',
changeOrigin: true,
pathRewrite: {
'^/parity-utils': ''
}
},
'/rpc/*': {
target: 'http://localhost:8080',

89
js/webpack.libraries.js Normal file
View File

@@ -0,0 +1,89 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
// Run with `webpack --config webpack.libraries.js --progress`
const HappyPack = require('happypack');
const path = require('path');
const webpack = require('webpack');
const ENV = process.env.NODE_ENV || 'development';
const isProd = ENV === 'production';
const DEST = process.env.BUILD_DEST || '.build';
module.exports = {
context: path.join(__dirname, './src'),
entry: {
// library
'inject': ['./web3.js'],
'web3': ['./web3.js'],
'parity': ['./parity.js']
},
output: {
path: path.join(__dirname, DEST),
filename: '[name].js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'happypack/loader?id=js'
},
{
test: /\.json$/,
loaders: ['json']
},
{
test: /\.html$/,
loader: 'file?name=[name].[ext]'
}
]
},
plugins: (function () {
const plugins = [
new HappyPack({
id: 'js',
threads: 4,
loaders: [ 'babel' ]
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(ENV),
RPC_ADDRESS: JSON.stringify(process.env.RPC_ADDRESS),
PARITY_URL: JSON.stringify(process.env.PARITY_URL),
LOGGING: JSON.stringify(!isProd)
}
})
];
if (isProd) {
plugins.push(new webpack.optimize.OccurrenceOrderPlugin(false));
plugins.push(new webpack.optimize.DedupePlugin());
plugins.push(new webpack.optimize.UglifyJsPlugin({
screwIe8: true,
compress: {
warnings: false
},
output: {
comments: false
}
}));
}
return plugins;
}())
};