1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00

Remove unnecessary fields from JSON served by API.

Resolved merge conflictiun
    client/components/routeservers/protocols/index.jsx

used calculations taken from "decix/decix" (HEAD) branch
This commit is contained in:
Benedikt Rudolph
2018-02-15 14:38:00 +01:00
committed by Matthias Hannig
parent b9aba16303
commit 7bdaea30d7
3 changed files with 22 additions and 17 deletions

View File

@@ -92,6 +92,7 @@ type Neighbour struct {
RoutesExported int `json:"routes_exported"` RoutesExported int `json:"routes_exported"`
RoutesPreferred int `json:"routes_preferred"` RoutesPreferred int `json:"routes_preferred"`
RoutesAccepted int `json:"routes_accepted"` RoutesAccepted int `json:"routes_accepted"`
RoutesPipeFiltered int `json:"routes_pipe_filtered"`
Uptime time.Duration `json:"uptime"` Uptime time.Duration `json:"uptime"`
LastError string `json:"last_error"` LastError string `json:"last_error"`

View File

@@ -133,9 +133,10 @@ func parseNeighbours(bird ClientResponse, config Config) ([]api.Neighbour, error
//TODO make these changes configurable //TODO make these changes configurable
RoutesReceived: mustInt(routes["imported"], 0), RoutesReceived: mustInt(routes["imported"], 0),
RoutesExported: mustInt(routes["exported"], 0), //TODO protocol_exported? RoutesExported: mustInt(routes["exported"], 0), //TODO protocol_exported?
RoutesFiltered: mustInt(routes["pipe_filtered"], 0), RoutesFiltered: mustInt(routes["filtered"], 0),
RoutesPreferred: mustInt(routes["preferred"], 0), RoutesPreferred: mustInt(routes["preferred"], 0),
RoutesAccepted: mustInt(routes["pipe_imported"], mustInt(routes["imported"], 0)), RoutesAccepted: mustInt(routes["pipe_imported"], mustInt(routes["imported"], 0)),
RoutesPipeFiltered: mustInt(routes["pipe_filtered"], mustInt(routes["filtered"], 0)),
Uptime: uptime, Uptime: uptime,
LastError: lastError, LastError: lastError,

View File

@@ -67,6 +67,9 @@ class NeighboursTable extends React.Component {
pipe_filtered_count = n.pipe_filtered_count pipe_filtered_count = n.pipe_filtered_count
} }
var filtered_count:int = received_count-accepted_count;
var filtered_print:string = (filtered_count < 0) ? "0" : filtered_count.toString();
return ( return (
<tr key={n.id}> <tr key={n.id}>
<td> <td>
@@ -110,7 +113,7 @@ class NeighboursTable extends React.Component {
<RoutesLink routeserverId={this.props.routeserverId} <RoutesLink routeserverId={this.props.routeserverId}
protocol={n.id} protocol={n.id}
state={n.state}> state={n.state}>
{received_count - accepted_count} {filtered_print}
</RoutesLink> </RoutesLink>
</td> </td>
<td> <td>