refactor: remove support for non-linkable nodes

since they are now always linkable.
This commit is contained in:
Matthias Radestock
2018-01-02 10:19:22 +00:00
parent 3582c221fe
commit 9754bf2385
4 changed files with 11 additions and 31 deletions
@@ -32,24 +32,17 @@ class NodeDetailsTableNodeLink extends React.Component {
}
render() {
const { label, labelMinor, linkable } = this.props;
const { label, labelMinor } = this.props;
const title = !labelMinor ? label : `${label} (${labelMinor})`;
if (linkable) {
return (
<span
className="node-details-table-node-link"
title={title}
ref={this.saveNodeRef}
onClick={this.handleClick}
{...dismissRowClickProps}
>
{label}
</span>
);
}
return (
<span className="node-details-table-node" title={title}>
<span
className="node-details-table-node-link"
title={title}
ref={this.saveNodeRef}
onClick={this.handleClick}
{...dismissRowClickProps}
>
{label}
</span>
);
-7
View File
@@ -37,9 +37,7 @@ func TestMakeDetailedHostNode(t *testing.T) {
containerImageNodeSummary := child(t, render.ContainerImageRenderer, expected.ClientContainerImageNodeID)
containerNodeSummary := child(t, render.ContainerRenderer, fixture.ClientContainerNodeID)
process1NodeSummary := child(t, render.ProcessRenderer, fixture.ClientProcess1NodeID)
process1NodeSummary.Linkable = true
process2NodeSummary := child(t, render.ProcessRenderer, fixture.ClientProcess2NodeID)
process2NodeSummary.Linkable = true
podNodeSummary := child(t, render.PodRenderer, fixture.ClientPodNodeID)
want := detailed.Node{
NodeSummary: detailed.NodeSummary{
@@ -50,7 +48,6 @@ func TestMakeDetailedHostNode(t *testing.T) {
Rank: "hostname.com",
Pseudo: false,
Shape: "circle",
Linkable: true,
},
Adjacency: report.MakeIDList(fixture.ServerHostNodeID),
Metadata: []report.MetadataRow{
@@ -188,7 +185,6 @@ func TestMakeDetailedContainerNode(t *testing.T) {
have := detailed.MakeNode("containers", detailed.RenderContext{Report: fixture.Report}, renderableNodes, renderableNode)
serverProcessNodeSummary := child(t, render.ProcessRenderer, fixture.ServerProcessNodeID)
serverProcessNodeSummary.Linkable = true
want := detailed.Node{
NodeSummary: detailed.NodeSummary{
BasicNodeSummary: detailed.BasicNodeSummary{
@@ -197,7 +193,6 @@ func TestMakeDetailedContainerNode(t *testing.T) {
LabelMinor: "server.hostname.com",
Rank: fixture.ServerContainerImageName,
Shape: "hexagon",
Linkable: true,
Pseudo: false,
},
Metadata: []report.MetadataRow{
@@ -321,7 +316,6 @@ func TestMakeDetailedPodNode(t *testing.T) {
containerNodeSummary := child(t, render.ContainerWithImageNameRenderer, fixture.ServerContainerNodeID)
serverProcessNodeSummary := child(t, render.ProcessRenderer, fixture.ServerProcessNodeID)
serverProcessNodeSummary.Linkable = true // Temporary workaround for: https://github.com/weaveworks/scope/issues/1295
want := detailed.Node{
NodeSummary: detailed.NodeSummary{
BasicNodeSummary: detailed.BasicNodeSummary{
@@ -330,7 +324,6 @@ func TestMakeDetailedPodNode(t *testing.T) {
LabelMinor: "1 container",
Rank: "ping/pong-b",
Shape: "heptagon",
Linkable: true,
Pseudo: false,
},
Metadata: []report.MetadataRow{
+3 -5
View File
@@ -50,7 +50,6 @@ type BasicNodeSummary struct {
Rank string `json:"rank"`
Shape string `json:"shape,omitempty"`
Stack bool `json:"stack,omitempty"`
Linkable bool `json:"linkable,omitempty"` // Whether this node can be linked-to
Pseudo bool `json:"pseudo,omitempty"`
}
@@ -104,10 +103,9 @@ var primaryAPITopology = map[string]string{
// possible. This summary is sufficient for rendering links to the node.
func MakeBasicNodeSummary(r report.Report, n report.Node) (BasicNodeSummary, bool) {
summary := BasicNodeSummary{ // This is unlikely to look very good, but is a reasonable fallback
ID: n.ID,
Label: n.ID,
Shape: report.Triangle,
Linkable: true,
ID: n.ID,
Label: n.ID,
Shape: report.Triangle,
}
if t, ok := r.Topology(n.Topology); ok {
summary.Shape = t.GetShape()
-4
View File
@@ -130,7 +130,6 @@ func TestMakeNodeSummary(t *testing.T) {
LabelMinor: fixture.ClientHostName,
Rank: fixture.ClientContainerImageName,
Shape: "hexagon",
Linkable: true,
},
Metadata: []report.MetadataRow{
{ID: docker.ImageName, Label: "Image", Value: fixture.ClientContainerImageName, Priority: 1},
@@ -150,7 +149,6 @@ func TestMakeNodeSummary(t *testing.T) {
LabelMinor: "1 container",
Rank: fixture.ClientContainerImageName,
Shape: "hexagon",
Linkable: true,
Stack: true,
},
Metadata: []report.MetadataRow{
@@ -170,7 +168,6 @@ func TestMakeNodeSummary(t *testing.T) {
LabelMinor: "hostname.com",
Rank: "hostname.com",
Shape: "circle",
Linkable: true,
},
Metadata: []report.MetadataRow{
{ID: host.HostName, Label: "Hostname", Value: fixture.ClientHostName, Priority: 11},
@@ -190,7 +187,6 @@ func TestMakeNodeSummary(t *testing.T) {
Rank: "apache",
Shape: "square",
Stack: true,
Linkable: true,
},
},
},