Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class NodeInfo extends React.Component {
</ul>
</div>
}
<li>Sponsor: { this.props.node.sponsor_name || "—" }</li>
</ul>
</Tooltip>
</span>
Expand Down
15 changes: 15 additions & 0 deletions app/javascript/packs/forkMonitorApp/components/nodeName.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@

import React from 'react';

class NodeName extends React.Component {
// Convert country code to flag emoji
countryCodeToFlag(countryCode) {
if (!countryCode || countryCode.length !== 2) {
return '';
}
const codePoints = countryCode
.toUpperCase()
.split('')
.map(char => 127397 + char.charCodeAt());
return String.fromCodePoint(...codePoints);
}

render() {
const flag = this.countryCodeToFlag(this.props.node.country);
return(
<span>
{this.props.node.name_with_version}
{flag && <span title={this.props.node.country}>{flag}&nbsp;</span>}
</span>
)
}
Expand Down
20 changes: 20 additions & 0 deletions app/javascript/packs/forkMonitorApp/components/nodesAdmin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ const client_choices = [
{ id: "bu", name: "Bitcoin Unlimited"},
];

const country_choices = [
{ id: "US", name: "United States" },
{ id: "DE", name: "Germany" },
{ id: "UK", name: "United Kingdom" },
{ id: "FI", name: "Finland" },
{ id: "SG", name: "Singapore" },
{ id: "JP", name: "Japan" },
{ id: "QA", name: "Qatar" },
{ id: "CA", name: "Canada" },
{ id: "CH", name: "Chile" },
{ id: "FR", name: "France" },
// Add more countries as needed
];



export const NodeList = props => (
<List {...props}
sort={{ field: "id"}}
Expand Down Expand Up @@ -57,6 +73,8 @@ export const NodeEdit = props => (
<TextInput source="rpcpassword" />
<BooleanInput source="pruned" />
<BooleanInput source="txindex" />
<SelectInput source="country" choices={country_choices} />
<TextInput source="sponsor_name" />
<TextInput source="os" />
<TextInput source="cpu" />
<NumberInput source="ram" />
Expand Down Expand Up @@ -85,6 +103,8 @@ export const NodeCreate = props => (
<TextInput source="rpcpassword" />
<BooleanInput source="pruned" />
<BooleanInput source="txindex" />
<SelectInput source="country" choices={country_choices} />
<TextInput source="sponsor_name" />
<TextInput source="os" />
<TextInput source="cpu" />
<NumberInput source="ram" />
Expand Down
2 changes: 2 additions & 0 deletions app/models/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ def as_json(options = nil)
cve_2018_17144
released
sync_height
country
Comment thread
jonathanbier marked this conversation as resolved.
link
link_text
mempool_count
mempool_bytes
mempool_max
mirror_ibd
to_destroy
sponsor_name
]
fields << :id << :rpchost << :mirror_rpchost << :rpcport << :mirror_rpcport << :rpcuser << :rpcpassword << :version_extra << :name << :enabled if options && options[:admin]
super({ only: fields }.merge(options || {})).merge({
Expand Down
Loading