Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1621-frontend-upgrade-akazmie-171113 #1

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
3ff860c
sed -i 's#github.com/bitpay/insight#github.com/bitpay/insight-ui#g'
Codegenieur Apr 24, 2016
f002131
sed -i 's#github.com/bitpay/insight#github.com/bitpay/insight-ui#g'
Codegenieur Apr 24, 2016
923c596
Merge pull request #713 from Gitju/master
braydonf Apr 25, 2016
3532cd2
Change to use bitcoind/addresstxid event
May 18, 2016
f50abae
Fix url to transaciton sound
May 18, 2016
0a06f9a
Update compiled files
May 18, 2016
ffed19b
Unsubscribe to address event, and update addresstxid data format
May 18, 2016
d7c161d
Update compiled files
May 18, 2016
df19530
Merge pull request #718 from braydonf/bitcoind
kleetus May 27, 2016
ddcd05c
Bump package version to 0.4.0
braydonf May 27, 2016
62e1225
Fixed over-matching of index route.
Apr 4, 2017
795b518
Merge pull request #764 from kleetus/bug/index
kleetus Apr 4, 2017
d8fea29
Merge pull request #1 from bitpay/master
dabura667 Apr 9, 2017
d0a8b12
Fix Fee Rate to 8 decimal places
dabura667 Apr 9, 2017
cc7c6f8
Merge pull request #766 from dabura667/fix-BTC-places
matiu Apr 10, 2017
340decd
Route caching bug fix, simplify routing (#763)
bitjson May 4, 2017
e94154b
chore(release): 5.0.0-beta.1
bitjson Aug 18, 2017
7155ff0
Added a build runner in line with starting the service.
Sep 26, 2017
6cbca55
Apparently pushd and popd are not available in the shell used by exec on
Sep 27, 2017
4931504
Bumped version.
Oct 1, 2017
37177c4
Bumped version.
Oct 2, 2017
a0ba1ef
Bumped version.
Oct 8, 2017
ba31444
Bumped version.
Oct 9, 2017
2010f73
Bumped version.
Oct 11, 2017
9195c90
Bumped version.
Oct 11, 2017
fbc38a7
Bumped version.
Oct 12, 2017
2cc88a2
Bumped version.
Oct 12, 2017
c52682b
Added test stubs.
Oct 12, 2017
65f88ef
Bumped version.
Oct 12, 2017
9c00ac8
Added a travis.yml file.
Oct 12, 2017
81155eb
Added mocha as a dependency.
Oct 12, 2017
a69ef92
Bumped version.
Oct 18, 2017
3ff0341
Bump version
Oct 20, 2017
f34006e
Bumped version.
Oct 24, 2017
8251807
Bumped version.
Oct 24, 2017
59c4bf2
Bumped version.
Oct 26, 2017
d4bb931
Bumped version.
Oct 26, 2017
96b44e2
Bumped version.
Oct 30, 2017
55e6427
Bumped version.
Nov 1, 2017
bc49b1d
Bumped version.
Nov 2, 2017
efb275b
Bumped version.
Nov 2, 2017
e87ad01
Bumped version.
Nov 2, 2017
0852a26
Bumped version.
Nov 5, 2017
d5d6191
Bumped version.
Nov 7, 2017
1e431f9
Bumped version.
Nov 7, 2017
9559af9
Bumped version.
Nov 7, 2017
e13e24d
Bumped version.
Nov 7, 2017
46821f0
Bumped version.
Nov 8, 2017
271bc41
Bumped version.
Nov 8, 2017
f41fb29
Bumped version.
Nov 9, 2017
24426b7
Bumped version.
Nov 10, 2017
35f19ab
Merge remote-tracking branch 'upstream/master' into 1621-frontend-upg…
akazmie Nov 13, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: node_js
node_js:
- 'v8'
install:
- npm install
23 changes: 21 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

// var config = require('insight-config.json');

module.exports = function(grunt) {

//Load NPM tasks
Expand All @@ -10,10 +12,27 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-markdown');
grunt.loadNpmTasks('grunt-macreload');
grunt.loadNpmTasks('grunt-angular-gettext');
grunt.loadNpmTasks('grunt-replace');

// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
replace: {
dist: {
options: {
patterns: [
{
match: 'INSIGHT_API_PREFIX',
replacement: '<%= pkg.insightConfig.apiPrefix %>'
}
],
usePrefix: false
},
files: [
{src: ['public/src/templates/api.js'], dest: 'public/src/js/services/api.js'}
]
}
},
concat: {
options: {
process: function(src, filepath) {
Expand Down Expand Up @@ -121,13 +140,13 @@ module.exports = function(grunt) {
grunt.option('force', true);

//Default task(s).
grunt.registerTask('default', ['watch']);
grunt.registerTask('default', ['replace', 'watch']);

//Update .pot file
grunt.registerTask('translate', ['nggettext_extract']);

//Compile task (concat + minify)
grunt.registerTask('compile', ['nggettext_compile', 'concat', 'uglify', 'cssmin']);
grunt.registerTask('compile', ['replace', 'nggettext_compile', 'concat', 'uglify', 'cssmin']);


};
34 changes: 26 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,42 @@ Open a web browser to `http://localhost:3001/insight/`

## Development

To run Insight UI locally in development mode:
To build Insight UI locally:

Install bower dependencies:
```
$ npm run build
```

A watch task is also available:

```
$ bower install
$ npm run watch
```

To compile and minify the web application's assets:
## Changing routePrefix and apiPrefix

By default, the `insightConfig` in `package.json` is:

```json
"insightConfig": {
"apiPrefix": "insight-api",
"routePrefix": "insight"
}
```
$ grunt compile

To change these routes, first make your changes to `package.json`, for example:

```json
"insightConfig": {
"apiPrefix": "api",
"routePrefix": ""
}
```

There is a convenient Gruntfile.js for automation during editing the code
Then rebuild the `insight-ui` service:

```
$ grunt
$ npm run build
```

## Multilanguage support
Expand Down Expand Up @@ -74,7 +92,7 @@ For more details about the [Insight API](https://github.com/bitpay/insight-api)

## Contribute

Contributions and suggestions are welcomed at the [Insight UI GitHub repository](https://github.com/bitpay/insight).
Contributions and suggestions are welcomed at the [Insight UI GitHub repository](https://github.com/bitpay/insight-ui).


## License
Expand Down
55 changes: 27 additions & 28 deletions bitcore-node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,35 @@
var BaseService = require('./service');
var inherits = require('util').inherits;
var fs = require('fs');
var exec = require('child_process').exec;
var pkg = require('../package.json');

var InsightUI = function(options) {
BaseService.call(this, options);
if (typeof options.apiPrefix !== 'undefined') {
this.apiPrefix = options.apiPrefix;
} else {
this.apiPrefix = 'insight-api';
}
if (typeof options.routePrefix !== 'undefined') {
this.routePrefix = options.routePrefix;
} else {
this.routePrefix = 'insight';
}
this.apiPrefix = options.apiPrefix || 'api';
this.routePrefix = options.routePrefix || '';
};

InsightUI.dependencies = ['insight-api'];

inherits(InsightUI, BaseService);

InsightUI.prototype.start = function(callback) {
this.indexFile = this.filterIndexHTML(fs.readFileSync(__dirname + '/../public/index.html', {encoding: 'utf8'}));
setImmediate(callback);

var self = this;
pkg.insightConfig.apiPrefix = self.apiPrefix;
pkg.insightConfig.routePrefix = self.routePrefix;

fs.writeFileSync(__dirname + '/../package.json', JSON.stringify(pkg, null, 2));
exec('cd ' + __dirname + '/../;' +
' npm run install-and-build', function(err) {
if (err) {
return callback(err);
}
self.indexFile = self.filterIndexHTML(fs.readFileSync(__dirname + '/../public/index-template.html', {encoding: 'utf8'}));
callback();
});

};

InsightUI.prototype.getRoutePrefix = function() {
Expand All @@ -33,27 +40,19 @@ InsightUI.prototype.getRoutePrefix = function() {

InsightUI.prototype.setupRoutes = function(app, express) {
var self = this;

app.use('/', function(req, res, next){
if (req.headers.accept && req.headers.accept.indexOf('text/html') !== -1 &&
req.headers["X-Requested-With"] !== 'XMLHttpRequest'
) {
res.setHeader('Content-Type', 'text/html');
res.send(self.indexFile);
} else {
express.static(__dirname + '/../public')(req, res, next);
}
app.use(express.static(__dirname + '/../public'));
// if not in found, fall back to indexFile (404 is handled client-side)
app.use(function(req, res) {
res.setHeader('Content-Type', 'text/html');
res.send(self.indexFile);
});
};

InsightUI.prototype.filterIndexHTML = function(data) {
var transformed = data
.replace(/apiPrefix = '\/api'/, "apiPrefix = '/" + this.apiPrefix + "'");

if (this.routePrefix) {
transformed = transformed.replace(/<base href=\"\/\"/, '<base href="/' + this.routePrefix + '/"');
var transformed = data;
if (this.routePrefix !== '') {
transformed = transformed.replace('<base href="/"', '<base href="/' + this.routePrefix + '/"');
}

return transformed;
};

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Insight",
"version": "0.0.1",
"version": "5.0.0-beta.1",
"dependencies": {
"angular": "~1.2.13",
"angular-resource": "~1.2.13",
Expand Down
Loading