Skip to content

Commit

Permalink
Renamed NodeDetailsLabels to NodeDetailsPropertyList in the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
fbarl committed Jan 13, 2017
1 parent 703fffd commit f6feb56
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 21 deletions.
6 changes: 3 additions & 3 deletions client/app/scripts/components/node-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { resetDocumentTitle, setDocumentTitle } from '../utils/title-utils';
import MatchedText from './matched-text';
import NodeDetailsControls from './node-details/node-details-controls';
import NodeDetailsGenericTable from './node-details/node-details-generic-table';
import NodeDetailsPropertyList from './node-details/node-details-property-list';
import NodeDetailsHealth from './node-details/node-details-health';
import NodeDetailsInfo from './node-details/node-details-info';
import NodeDetailsLabels from './node-details/node-details-labels';
import NodeDetailsRelatives from './node-details/node-details-relatives';
import NodeDetailsTable from './node-details/node-details-table';
import Warning from './warning';
Expand Down Expand Up @@ -242,9 +242,9 @@ class NodeDetails extends React.Component {
);
} else if (isPropertyList(table)) {
return (
<NodeDetailsLabels
<NodeDetailsPropertyList
rows={table.rows} controls={table.controls}
matches={nodeMatches.get('labels')}
matches={nodeMatches.get('property-lists')}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import MatchedText from '../matched-text';
import ShowMore from '../show-more';

const Controls = controls => (
<div className="node-details-labels-controls">
<div className="node-details-property-list-controls">
{sortBy(controls, 'rank').map(control => <NodeDetailsControlButton
nodeId={control.nodeId} control={control} key={control.id} />)}
</div>
);

export default class NodeDetailsLabels extends React.Component {

export default class NodeDetailsPropertyList extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {
Expand Down Expand Up @@ -45,16 +44,18 @@ export default class NodeDetailsLabels extends React.Component {
}

return (
<div className="node-details-labels">
<div className="node-details-property-list">
{controls && Controls(controls)}
{rows.map(field => (
<div className="node-details-labels-field" key={field.id}>
<div className="node-details-property-list-field" key={field.id}>
<div
className="node-details-labels-field-label truncate"
className="node-details-property-list-field-label truncate"
title={field.entries.label} key={field.id}>
{field.entries.label}
</div>
<div className="node-details-labels-field-value truncate" title={field.entries.value}>
<div
className="node-details-property-list-field-value truncate"
title={field.entries.value}>
<MatchedText text={field.entries.value} match={matches.get(field.id)} />
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions client/app/scripts/utils/__tests__/search-utils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ describe('SearchUtils', () => {
const nodes = nodeSets.someNodes;
const matches = fun(nodes, {query: 'Value 1'});
expect(matches.size).toEqual(2);
expect(matches.getIn(['n2', 'labels']).size).toEqual(1);
expect(matches.getIn(['n2', 'labels', 'label1']).text).toBe('Label Value 1');
expect(matches.getIn(['n2', 'property-lists']).size).toEqual(1);
expect(matches.getIn(['n2', 'property-lists', 'label1']).text).toBe('Label Value 1');
});

it('should match on a generic table values', () => {
Expand Down
2 changes: 1 addition & 1 deletion client/app/scripts/utils/search-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export function searchTopology(nodes, { prefix, query, metric, comp, value }) {
(node.get('tables') || []).filter(isPropertyList).forEach((propertyList) => {
(propertyList.get('rows') || []).forEach((row) => {
const entries = row.get('entries');
const keyPath = [nodeId, 'labels', row.get('id')];
const keyPath = [nodeId, 'property-lists', row.get('id')];
nodeMatches = findNodeMatch(nodeMatches, keyPath, entries.get('value'),
query, prefix, entries.get('label'));
});
Expand Down
2 changes: 1 addition & 1 deletion client/app/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ h2 {
}
}

&-labels {
&-property-list {
&-controls {
margin-left: -4px;
}
Expand Down
13 changes: 7 additions & 6 deletions probe/overlay/weave.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,6 @@ var (
WeavePluginDriver: "Driver Name",
},
},
WeaveConnectionsTablePrefix: {
ID: WeaveConnectionsTablePrefix,
Label: "Connections (old)",
Type: report.PropertyListType,
Prefix: WeaveConnectionsTablePrefix,
},
WeaveConnectionsMulticolumnTablePrefix: {
ID: WeaveConnectionsMulticolumnTablePrefix,
Type: report.MulticolumnTableType,
Expand All @@ -141,6 +135,13 @@ var (
},
},
},
// Kept for backward-compatibility.
WeaveConnectionsTablePrefix: {
ID: WeaveConnectionsTablePrefix,
Label: "Connections",
Type: report.PropertyListType,
Prefix: WeaveConnectionsTablePrefix,
},
}
)

Expand Down
2 changes: 1 addition & 1 deletion report/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ type Column struct {
DataType string `json:"dataType"`
}

// Row is the type that holds the table data for the UI.
// Row is the type that holds the table data for the UI. Entries map from column ID to cell value.
type Row struct {
ID string `json:"id"`
Entries map[string]string `json:"entries"`
Expand Down

0 comments on commit f6feb56

Please sign in to comment.