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

@@ -83,17 +83,18 @@ type Neighbour struct {
Id string `json:"id"`
// Mandatory fields
Address string `json:"address"`
Asn int `json:"asn"`
State string `json:"state"`
Description string `json:"description"`
RoutesReceived int `json:"routes_received"`
RoutesFiltered int `json:"routes_filtered"`
RoutesExported int `json:"routes_exported"`
RoutesPreferred int `json:"routes_preferred"`
RoutesAccepted int `json:"routes_accepted"`
Uptime time.Duration `json:"uptime"`
LastError string `json:"last_error"`
Address string `json:"address"`
Asn int `json:"asn"`
State string `json:"state"`
Description string `json:"description"`
RoutesReceived int `json:"routes_received"`
RoutesFiltered int `json:"routes_filtered"`
RoutesExported int `json:"routes_exported"`
RoutesPreferred int `json:"routes_preferred"`
RoutesAccepted int `json:"routes_accepted"`
RoutesPipeFiltered int `json:"routes_pipe_filtered"`
Uptime time.Duration `json:"uptime"`
LastError string `json:"last_error"`
// Original response
Details map[string]interface{} `json:"details"`

View File

@@ -131,11 +131,12 @@ func parseNeighbours(bird ClientResponse, config Config) ([]api.Neighbour, error
State: mustString(protocol["state"], "unknown"),
Description: mustString(protocol["description"], "no description"),
//TODO make these changes configurable
RoutesReceived: mustInt(routes["imported"], 0),
RoutesExported: mustInt(routes["exported"], 0), //TODO protocol_exported?
RoutesFiltered: mustInt(routes["pipe_filtered"], 0),
RoutesPreferred: mustInt(routes["preferred"], 0),
RoutesAccepted: mustInt(routes["pipe_imported"], mustInt(routes["imported"], 0)),
RoutesReceived: mustInt(routes["imported"], 0),
RoutesExported: mustInt(routes["exported"], 0), //TODO protocol_exported?
RoutesFiltered: mustInt(routes["filtered"], 0),
RoutesPreferred: mustInt(routes["preferred"], 0),
RoutesAccepted: mustInt(routes["pipe_imported"], mustInt(routes["imported"], 0)),
RoutesPipeFiltered: mustInt(routes["pipe_filtered"], mustInt(routes["filtered"], 0)),
Uptime: uptime,
LastError: lastError,

View File

@@ -67,6 +67,9 @@ class NeighboursTable extends React.Component {
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 (
<tr key={n.id}>
<td>
@@ -110,7 +113,7 @@ class NeighboursTable extends React.Component {
<RoutesLink routeserverId={this.props.routeserverId}
protocol={n.id}
state={n.state}>
{received_count - accepted_count}
{filtered_print}
</RoutesLink>
</td>
<td>