Skip to content

Commit 6bd691a

Browse files
authored
Merge pull request #12 from Councilbox/develop
Merge from develop
2 parents c72efee + 2b396de commit 6bd691a

File tree

19 files changed

+236
-97
lines changed

19 files changed

+236
-97
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@ database/
33
.DS_Store
44
http-api/services/__pycache__/
55
docker-compose.yaml
6+
docker-compose.yaml.template
7+
syncer/build.sh
8+
http-api/build.sh
9+
webapp/build.sh
10+
push.sh
11+
env.sh

http-api/services/blocks.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,24 @@ def get(self):
7575
if from_:
7676
if order == 'desc':
7777
query['number'] = {'$lt': from_}
78-
else:
78+
order = -1
79+
elif order == 'asc':
7980
query['number'] = {'$gt': from_}
81+
order = 1
82+
else:
83+
order = -1
8084

8185
collection = self.database.blocks
82-
result = collection.find(query, sort=[('number', -1)]).limit(limit)
86+
result = collection.find(query, sort=[('number', order)]).limit(limit)
8387
blocks = []
8488
for block in result:
8589
blocks.append({'timestamp': block['timestamp'],
8690
'number': block['number'],
8791
'hash': block['hash'],
8892
'transactions': len(block['transactions'])})
93+
94+
# Reverse list if asc
95+
if order == 1:
96+
blocks = blocks[::-1]
97+
8998
return get_output(blocks, 'latest blocks'), 200

http-api/services/transactions.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,12 @@ def get(self):
6868
if from_:
6969
if order == 'desc':
7070
query['_id'] = {'$lt': from_}
71-
else:
71+
order = -1
72+
elif order == 'asc':
7273
query['_id'] = {'$gt': from_}
74+
order = 1
75+
else:
76+
order = -1
7377

7478
address = request.args.get('address', type=str)
7579
if address:
@@ -92,8 +96,7 @@ def get(self):
9296
return {}, 400
9397

9498
result = self.database.transactions.find(
95-
query,
96-
sort=[('_id', -1)]).limit(limit)
99+
query, sort=[('_id', order)]).limit(limit)
97100

98101
block_timestamps = {}
99102
transactions = []
@@ -104,4 +107,9 @@ def get(self):
104107
transaction['timestamp'] = block_timestamps[transaction['blockNumber']]
105108
transaction = get_clean_transaction_row(transaction)
106109
transactions.append(transaction)
110+
111+
# Reverse list if asc
112+
if order == 1:
113+
blocks = blocks[::-1]
114+
107115
return get_output(transactions, 'latest transactions'), 200

misc/screenshot.png

-51.7 KB
Loading

webapp/public/index.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6-
<meta name="theme-color" content="#f9f9f9">
6+
<meta name="theme-color" content="#dcdcdc">
77
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
88
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
99
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
1010
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
1111
<link href="/styles/styles.css" rel="stylesheet">
1212
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
1313
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
14-
<title>Councilbox Quorum Explorer</title>
14+
<title>CBX Quorum Explorer by Councilbox</title>
15+
<meta name="description" content="CBX Quorum Explorer is a block explorer for Quorum-based blockchains provided by Councilbox. Explore blocks, transactions, accounts and smart contracts.">
16+
<meta name="keywords" content="alastria,councilbox,quorum,explorer,blockchain,ethereum,block,transaction,account,address,smart contract,ibft,open source">
17+
<meta name="author" content="Councilbox">
1518
<base href="/">
1619
</head>
1720

webapp/public/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"short_name": "Councilbox Quorum Explorer",
3-
"name": "Councilbox Quorum Explorer",
2+
"short_name": "CBX Quorum Explorer",
3+
"name": "CBX Quorum Explorer by Councilbox",
44
"icons": [
55
{
66
"sizes": "192x192",
@@ -9,6 +9,6 @@
99
],
1010
"start_url": "./index.html",
1111
"display": "standalone",
12-
"theme_color": "#7d2180",
12+
"theme_color": "#dcdcdc",
1313
"background_color": "#ffffff"
1414
}

webapp/src/assets/img/logo.png

51.5 KB
Loading

webapp/src/components/Blocks/Block.js

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,31 @@ import DataRow from "../../displayComponents/DataRow";
33
import { Paper } from 'material-ui';
44
import { isMobile } from 'react-device-detect';
55
import { overflowText } from '../../styles/commonStyles';
6+
import Scrollbar from '../../displayComponents/Scrollbar';
67

78
const Block = props => (
8-
<div>
9-
<Paper style={{margin: isMobile? '0' : '.6em', padding: '2em'}}>
10-
<h4 style={{marginTop: '0', textTransform: 'capitalize'}}>{props.title} #{props.data.number}</h4>
11-
<h5 style={{marginBottom: '2em', ...overflowText}}>{props.data.hash}</h5>
12-
{Object.keys(props.data).filter(key => key !== "hash" && key !== "number").map(key => (
13-
<DataRow
14-
valueId={props.match.params.value}
15-
location={props.location}
16-
history={props.history}
17-
key={key}
18-
valueKey={key}
19-
value={props.data[key]}
20-
/>
21-
))}
9+
<React.Fragment>
10+
<Paper style={{margin: isMobile? '0' : '.6em', height: 'calc(100% - 1.5em)'}}>
11+
<Scrollbar>
12+
<div style={{padding: '2em'}}>
13+
<h4 style={{marginTop: '0', textTransform: 'capitalize'}}>{props.title} #{props.data.number}</h4>
14+
<h5 style={{marginBottom: '2em', ...overflowText}}>{props.data.hash}</h5>
15+
{Object.keys(props.data).filter(key => key !== "hash" && key !== "number").map(key => (
16+
<React.Fragment key={key}>
17+
<DataRow
18+
valueId={props.match.params.value}
19+
location={props.location}
20+
history={props.history}
21+
valueKey={key}
22+
value={props.data[key]}
23+
/>
24+
<div style={{height: '1px', borderBottom: '1px solid gainsboro', marginTop: '0.2em'}} />
25+
</React.Fragment>
26+
))}
27+
</div>
28+
</Scrollbar>
2229
</Paper>
23-
</div>
30+
</React.Fragment>
2431
)
2532

2633
export default Block;

webapp/src/components/Blocks/BlockRow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const BlockRow = props => {
2121
)
2222

2323
return (
24-
<Grid style={{margin: 'auto', width: '98%'}}>
24+
<Grid style={{margin: 'auto', width: '98%'}} className="hoverable">
2525
{isMobile?
2626
<Paper style={{marginBottom: '0.9em'}}>
2727
<Grid style={{margin: 0, width: '100%', padding: '0.6em'}}>

webapp/src/components/Footer.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
import { darkGrey } from '../styles/colors';
3+
import { isMobile } from 'react-device-detect';
4+
5+
const Footer = props => (
6+
<div style={{fontSize: '11px', marginTop: isMobile? '1.2em' : '-0.2em', width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', height: '1em'}}>
7+
<div
8+
dangerouslySetInnerHTML={{ __html: `Copyright &copy 2018`}}
9+
/>
10+
<a href="https://www.councilbox.com" style={{marginLeft: '0.2em', marginRight: '0.2em', color: darkGrey}}>Councilbox Technology S.L.</a>
11+
<div
12+
dangerouslySetInnerHTML={{ __html: `&mdash;`}}
13+
/>
14+
<a href="https://github.com/Councilbox" style={{marginLeft: '0.2em', marginRight: '0.2em', color: darkGrey}}>
15+
<i class="fa fa-github" aria-hidden="true" style={{color: darkGrey, marginLeft: '0.2em'}}></i>
16+
</a>
17+
</div>
18+
)
19+
20+
export default Footer;

0 commit comments

Comments
 (0)