ngrx Store And some other enhancements

ngrx Store And some other enhancements
pull/47/head
ShahanaFarooqui 6 years ago
parent 5f47a9d0ef
commit 26fc18d0c0

@ -23,9 +23,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
@angular/router
MIT
hammerjs hammerjs
MIT MIT
The MIT License (MIT) The MIT License (MIT)
@ -316,7 +313,7 @@ Apache-2.0
@angular/common @ngrx/store
MIT MIT
@angular/material/dialog @angular/material/dialog
@ -374,6 +371,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
@angular/common
MIT
@angular/platform-browser @angular/platform-browser
MIT MIT
@ -622,6 +622,9 @@ MIT
@angular/material/progress-spinner @angular/material/progress-spinner
@angular/router
MIT
@angular/material/form-field @angular/material/form-field
@angular/material/progress-bar @angular/material/progress-bar
@ -634,6 +637,9 @@ MIT
@angular/material/table @angular/material/table
@ngrx/effects
MIT
@angular/material/select @angular/material/select
angular2-qrcode angular2-qrcode

@ -6,8 +6,8 @@
<base href="/"> <base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="assets/images/favicon.ico"> <link rel="icon" type="image/x-icon" href="assets/images/favicon.ico">
<link rel="stylesheet" href="styles.e8ad9595401679e5b3a6.css"></head> <link rel="stylesheet" href="styles.e4aab088ea7dc1035ccf.css"></head>
<body> <body>
<rtl-app></rtl-app> <rtl-app></rtl-app>
<script type="text/javascript" src="runtime.ec2944dd8b20ec099bf3.js"></script><script type="text/javascript" src="polyfills.b2575713cefb95077d85.js"></script><script type="text/javascript" src="main.8d1245ca4bf0bc75a28f.js"></script></body> <script type="text/javascript" src="runtime.ec2944dd8b20ec099bf3.js"></script><script type="text/javascript" src="polyfills.b2575713cefb95077d85.js"></script><script type="text/javascript" src="main.1f46d61aa2787c42811c.js"></script></body>
</html> </html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -2,9 +2,9 @@ var request = require("request-promise");
var options = require("../connect"); var options = require("../connect");
var common = require('../common'); var common = require('../common');
getAlias = (channel, channelType) => { getAliasForChannel = (channel, channelType) => {
// console.log('CHANNEL: '); console.log('CHANNEL: ');
// console.log(channel); console.log(channel);
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
if (undefined === channelType || channelType === 'all') { if (undefined === channelType || channelType === 'all') {
options.url = common.lnd_server_url + '/graph/node/' + channel.remote_pubkey; options.url = common.lnd_server_url + '/graph/node/' + channel.remote_pubkey;
@ -43,11 +43,15 @@ exports.getChannels = (req, res, next) => {
} }
Promise.all( Promise.all(
channels.map(channel => { channels.map(channel => {
return getAlias(channel, req.params.channelType); // console.log(`\nChannel before getting Alias: ${JSON.stringify(channel)} \nAnd Channel Type: ${req.params.channelType}`);
})) return getAliasForChannel(channel, req.params.channelType);
})
)
.then(function(values) { .then(function(values) {
console.log(`\nChannels Fetched with Alias: ${JSON.stringify(body)}`); console.log(`\nChannels Fetched with Alias: ${JSON.stringify(body)}`);
res.status(200).json(body); res.status(200).json(body);
}).catch(err => {
console.error(err.error);
}); });
}); });
}; };

@ -57,7 +57,7 @@ exports.getGraphNode = (req, res, next) => {
console.error(`Fetching node Info failed! ${err}`); console.error(`Fetching node Info failed! ${err}`);
res.status(500).json({ res.status(500).json({
message: "Fetching node Info failed!", message: "Fetching node Info failed!",
error: (undefined === body) ? 'Error From Server!' : body.error error: (undefined !== err.error) ? err.error : 'Error From Server!'
}); });
}); });
}; };

@ -1,20 +1,33 @@
var fs = require('fs'); var fs = require('fs');
var request = require('request'); var request = require('request-promise');
var options = require("../connect"); var options = require("../connect");
var common = require('../common'); var common = require('../common');
getAliasForPeers = (peer) => {
return new Promise(function(resolve, reject) {
options.url = common.lnd_server_url + '/graph/node/' + peer.pub_key;
request(options)
.then(function(aliasBody) {
console.log('Alias: ' + JSON.stringify(aliasBody.node.alias));
peer.alias = aliasBody.node.alias;
resolve(aliasBody.node.alias);
})
.catch(err => reject(err));
});
}
exports.getPeers = (req, res, next) => { exports.getPeers = (req, res, next) => {
options.url = common.lnd_server_url + '/peers'; options.url = common.lnd_server_url + '/peers';
request.get(options, (error, response, body) => { request(options).then(function (body) {
console.log('Peers Received: ' + JSON.stringify(body)); let peers = (undefined === body.peers) ? [] : body.peers;
if(error) { Promise.all(
res.status(500).json({ peers.map(peer => {
message: "Fetching peers failed!", return getAliasForPeers(peer);
error: error }))
}); .then(function(values) {
} else { console.log(`\nPeers Fetched with Alias: ${JSON.stringify(body)}`);
res.status(200).json(body.peers); res.status(200).json(body.peers);
} });
}); });
}; };

Loading…
Cancel
Save