From f6feb56f201bd9f75a647be6888edb11577999c4 Mon Sep 17 00:00:00 2001 From: Filip Barl Date: Thu, 5 Jan 2017 17:14:59 +0100 Subject: [PATCH] Renamed NodeDetailsLabels to NodeDetailsPropertyList in the UI --- client/app/scripts/components/node-details.js | 6 +++--- ...ls-labels.js => node-details-property-list.js} | 15 ++++++++------- .../scripts/utils/__tests__/search-utils-test.js | 4 ++-- client/app/scripts/utils/search-utils.js | 2 +- client/app/styles/main.less | 2 +- probe/overlay/weave.go | 13 +++++++------ report/table.go | 2 +- 7 files changed, 23 insertions(+), 21 deletions(-) rename client/app/scripts/components/node-details/{node-details-labels.js => node-details-property-list.js} (80%) diff --git a/client/app/scripts/components/node-details.js b/client/app/scripts/components/node-details.js index 387565ea68..cc5465b4a8 100644 --- a/client/app/scripts/components/node-details.js +++ b/client/app/scripts/components/node-details.js @@ -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'; @@ -242,9 +242,9 @@ class NodeDetails extends React.Component { ); } else if (isPropertyList(table)) { return ( - ); } diff --git a/client/app/scripts/components/node-details/node-details-labels.js b/client/app/scripts/components/node-details/node-details-property-list.js similarity index 80% rename from client/app/scripts/components/node-details/node-details-labels.js rename to client/app/scripts/components/node-details/node-details-property-list.js index e25ec4ccd8..4375248ca3 100644 --- a/client/app/scripts/components/node-details/node-details-labels.js +++ b/client/app/scripts/components/node-details/node-details-property-list.js @@ -8,14 +8,13 @@ import MatchedText from '../matched-text'; import ShowMore from '../show-more'; const Controls = controls => ( -
+
{sortBy(controls, 'rank').map(control => )}
); -export default class NodeDetailsLabels extends React.Component { - +export default class NodeDetailsPropertyList extends React.Component { constructor(props, context) { super(props, context); this.state = { @@ -45,16 +44,18 @@ export default class NodeDetailsLabels extends React.Component { } return ( -
+
{controls && Controls(controls)} {rows.map(field => ( -
+
{field.entries.label}
-
+
diff --git a/client/app/scripts/utils/__tests__/search-utils-test.js b/client/app/scripts/utils/__tests__/search-utils-test.js index 278cff1b73..dde59e6799 100644 --- a/client/app/scripts/utils/__tests__/search-utils-test.js +++ b/client/app/scripts/utils/__tests__/search-utils-test.js @@ -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', () => { diff --git a/client/app/scripts/utils/search-utils.js b/client/app/scripts/utils/search-utils.js index 2ea844c230..aec25f632f 100644 --- a/client/app/scripts/utils/search-utils.js +++ b/client/app/scripts/utils/search-utils.js @@ -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')); }); diff --git a/client/app/styles/main.less b/client/app/styles/main.less index 801ad53db0..b209661cd1 100644 --- a/client/app/styles/main.less +++ b/client/app/styles/main.less @@ -864,7 +864,7 @@ h2 { } } - &-labels { + &-property-list { &-controls { margin-left: -4px; } diff --git a/probe/overlay/weave.go b/probe/overlay/weave.go index c69b3a15d2..b87cb88eb6 100644 --- a/probe/overlay/weave.go +++ b/probe/overlay/weave.go @@ -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, @@ -141,6 +135,13 @@ var ( }, }, }, + // Kept for backward-compatibility. + WeaveConnectionsTablePrefix: { + ID: WeaveConnectionsTablePrefix, + Label: "Connections", + Type: report.PropertyListType, + Prefix: WeaveConnectionsTablePrefix, + }, } ) diff --git a/report/table.go b/report/table.go index f1e0ab3180..c5cf69a2af 100644 --- a/report/table.go +++ b/report/table.go @@ -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"`