mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-20 22:10:30 +00:00
Add label_minor to tooltips in connections table
Sometimes label is not enough to distinguish between rows.
This commit is contained in:
@@ -18,17 +18,20 @@ class NodeDetailsTableNodeLink extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.props.linkable) {
|
||||
const { label, label_minor: labelMinor, linkable } = this.props;
|
||||
const title = !labelMinor ? label : `${label} (${labelMinor})`;
|
||||
|
||||
if (linkable) {
|
||||
return (
|
||||
<span className="node-details-table-node-link" title={this.props.label}
|
||||
<span className="node-details-table-node-link" title={title}
|
||||
onClick={this.handleClick}>
|
||||
{this.props.label}
|
||||
{label}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<span className="node-details-table-node" title={this.props.label}>
|
||||
{this.props.label}
|
||||
<span className="node-details-table-node" title={title}>
|
||||
{label}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -43,11 +43,12 @@ type ConnectionsSummary struct {
|
||||
|
||||
// Connection is a row in the connections table.
|
||||
type Connection struct {
|
||||
ID string `json:"id"` // ID of this element in the UI. Must be unique for a given ConnectionsSummary.
|
||||
NodeID string `json:"nodeId"` // ID of a node in the topology. Optional, must be set if linkable is true.
|
||||
Label string `json:"label"`
|
||||
Linkable bool `json:"linkable"`
|
||||
Metadata []report.MetadataRow `json:"metadata,omitempty"`
|
||||
ID string `json:"id"` // ID of this element in the UI. Must be unique for a given ConnectionsSummary.
|
||||
NodeID string `json:"nodeId"` // ID of a node in the topology. Optional, must be set if linkable is true.
|
||||
Label string `json:"label"`
|
||||
LabelMinor string `json:"label_minor,omitempty"`
|
||||
Linkable bool `json:"linkable"`
|
||||
Metadata []report.MetadataRow `json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
type connectionsByID []Connection
|
||||
@@ -128,13 +129,15 @@ func (c *connectionCounters) rows(r report.Report, ns report.Nodes, includeLocal
|
||||
// MakeNodeID(ns[row.remoteNodeID]). As we don't need the whole summary.
|
||||
summary, _ := MakeNodeSummary(r, ns[row.remoteNodeID])
|
||||
connection := Connection{
|
||||
ID: fmt.Sprintf("%s-%s-%s-%s", row.remoteNodeID, row.remoteAddr, row.localAddr, row.port),
|
||||
NodeID: summary.ID,
|
||||
Label: summary.Label,
|
||||
Linkable: true,
|
||||
ID: fmt.Sprintf("%s-%s-%s-%s", row.remoteNodeID, row.remoteAddr, row.localAddr, row.port),
|
||||
NodeID: summary.ID,
|
||||
Label: summary.Label,
|
||||
LabelMinor: summary.LabelMinor,
|
||||
Linkable: true,
|
||||
}
|
||||
if row.remoteAddr != "" {
|
||||
connection.Label = row.remoteAddr
|
||||
connection.LabelMinor = ""
|
||||
}
|
||||
if includeLocal {
|
||||
connection.Metadata = append(connection.Metadata,
|
||||
|
||||
@@ -153,10 +153,11 @@ func TestMakeDetailedHostNode(t *testing.T) {
|
||||
Columns: detailed.NormalColumns,
|
||||
Connections: []detailed.Connection{
|
||||
{
|
||||
ID: connectionID(fixture.ServerHostNodeID, ""),
|
||||
NodeID: fixture.ServerHostNodeID,
|
||||
Label: "server",
|
||||
Linkable: true,
|
||||
ID: connectionID(fixture.ServerHostNodeID, ""),
|
||||
NodeID: fixture.ServerHostNodeID,
|
||||
Label: "server",
|
||||
LabelMinor: "hostname.com",
|
||||
Linkable: true,
|
||||
Metadata: []report.MetadataRow{
|
||||
{
|
||||
ID: "port",
|
||||
@@ -259,10 +260,11 @@ func TestMakeDetailedContainerNode(t *testing.T) {
|
||||
Columns: detailed.NormalColumns,
|
||||
Connections: []detailed.Connection{
|
||||
{
|
||||
ID: connectionID(fixture.ClientContainerNodeID, ""),
|
||||
NodeID: fixture.ClientContainerNodeID,
|
||||
Label: "client",
|
||||
Linkable: true,
|
||||
ID: connectionID(fixture.ClientContainerNodeID, ""),
|
||||
NodeID: fixture.ClientContainerNodeID,
|
||||
Label: "client",
|
||||
LabelMinor: "client.hostname.com",
|
||||
Linkable: true,
|
||||
Metadata: []report.MetadataRow{
|
||||
{
|
||||
ID: "port",
|
||||
@@ -375,10 +377,11 @@ func TestMakeDetailedPodNode(t *testing.T) {
|
||||
Columns: detailed.NormalColumns,
|
||||
Connections: []detailed.Connection{
|
||||
{
|
||||
ID: connectionID(fixture.ClientPodNodeID, ""),
|
||||
NodeID: fixture.ClientPodNodeID,
|
||||
Label: "pong-a",
|
||||
Linkable: true,
|
||||
ID: connectionID(fixture.ClientPodNodeID, ""),
|
||||
NodeID: fixture.ClientPodNodeID,
|
||||
Label: "pong-a",
|
||||
LabelMinor: "1 container",
|
||||
Linkable: true,
|
||||
Metadata: []report.MetadataRow{
|
||||
{
|
||||
ID: "port",
|
||||
|
||||
Reference in New Issue
Block a user