diff --git a/client/app/scripts/actions/app-actions.js b/client/app/scripts/actions/app-actions.js index 90557c212..3db3b7c26 100644 --- a/client/app/scripts/actions/app-actions.js +++ b/client/app/scripts/actions/app-actions.js @@ -12,15 +12,6 @@ module.exports = { RouterUtils.updateRoute(); }, - clickGrouping: function(grouping) { - AppDispatcher.dispatch({ - type: ActionTypes.CLICK_GROUPING, - grouping: grouping - }); - RouterUtils.updateRoute(); - WebapiUtils.getNodesDelta(AppStore.getCurrentTopologyUrl()); - }, - clickNode: function(nodeId) { AppDispatcher.dispatch({ type: ActionTypes.CLICK_NODE, diff --git a/client/app/scripts/components/app.js b/client/app/scripts/components/app.js index b1df3f747..a9b0899d2 100644 --- a/client/app/scripts/components/app.js +++ b/client/app/scripts/components/app.js @@ -16,7 +16,6 @@ function getStateFromStores() { return { currentTopology: AppStore.getCurrentTopology(), errorUrl: AppStore.getErrorUrl(), - currentGrouping: AppStore.getCurrentGrouping(), highlightedEdgeIds: AppStore.getHighlightedEdgeIds(), highlightedNodeIds: AppStore.getHighlightedNodeIds(), selectedNodeId: AppStore.getSelectedNodeId(), diff --git a/client/app/scripts/components/explorer.js b/client/app/scripts/components/explorer.js deleted file mode 100644 index 606ea413e..000000000 --- a/client/app/scripts/components/explorer.js +++ /dev/null @@ -1,87 +0,0 @@ -const React = require('react'); -const _ = require('lodash'); - -const NodesChart = require('../charts/nodes-chart'); -const NodeDetails = require('./node-details'); - -const marginBottom = 64; -const marginTop = 64; -const marginLeft = 36; -const marginRight = 36; - -const Explorer = React.createClass({ - - getInitialState: function() { - return { - layout: 'solar', - width: window.innerWidth - marginLeft - marginRight, - height: window.innerHeight - marginBottom - marginTop - }; - }, - - componentDidMount: function() { - window.addEventListener('resize', this.handleResize); - }, - - componentWillUnmount: function() { - window.removeEventListener('resize', this.handleResize); - }, - - getSubTopology: function(topology) { - const subTopology = {}; - const nodeSet = []; - - _.each(this.props.expandedNodes, function(nodeId) { - if (topology[nodeId]) { - subTopology[nodeId] = topology[nodeId]; - nodeSet = _.union(subTopology[nodeId].adjacency, nodeSet); - _.each(subTopology[nodeId].adjacency, function(adjacentId) { - const node = _.assign({}, topology[adjacentId]); - - subTopology[adjacentId] = node; - }); - } - }); - - // weed out edges - _.each(subTopology, function(node) { - node.adjacency = _.intersection(node.adjacency, nodeSet); - }); - - return subTopology; - }, - - render: function() { - const subTopology = this.getSubTopology(this.props.nodes); - - return ( -
- -
- -
-
- ); - }, - - setDimensions: function() { - this.setState({ - height: window.innerHeight - marginBottom - marginTop, - width: window.innerWidth - marginLeft - marginRight - }); - }, - - handleResize: function() { - this.setDimensions(); - } - -}); - -module.exports = Explorer; diff --git a/client/app/scripts/components/groupings.js b/client/app/scripts/components/groupings.js deleted file mode 100644 index 66809a28c..000000000 --- a/client/app/scripts/components/groupings.js +++ /dev/null @@ -1,65 +0,0 @@ -const React = require('react'); -const _ = require('lodash'); - -const AppActions = require('../actions/app-actions'); - -const GROUPINGS = [{ - id: 'none', - iconClass: 'fa fa-th', - needsTopology: false -}, { - id: 'grouped', - iconClass: 'fa fa-th-large', - needsTopology: 'grouped_url' -}]; - -const Groupings = React.createClass({ - - onGroupingClick: function(ev) { - ev.preventDefault(); - AppActions.clickGrouping(ev.currentTarget.getAttribute('rel')); - }, - - getGroupingsSupportedByTopology: function(topology) { - return _.filter(GROUPINGS, _.partial(this.isGroupingSupportedByTopology, topology)); - }, - - renderGrouping: function(grouping, activeGroupingId) { - let className = 'groupings-item'; - const isSupportedByTopology = this.isGroupingSupportedByTopology(this.props.currentTopology, grouping); - - if (grouping.id === activeGroupingId) { - className += ' groupings-item-active'; - } else if (!isSupportedByTopology) { - className += ' groupings-item-disabled'; - } else { - className += ' groupings-item-default'; - } - - return ( -
- -
- ); - }, - - render: function() { - const activeGrouping = this.props.active; - const isGroupingSupported = _.size(this.getGroupingsSupportedByTopology(this.props.currentTopology)) > 1; - - return ( -
- {isGroupingSupported && GROUPINGS.map(function(grouping) { - return this.renderGrouping(grouping, activeGrouping); - }, this)} -
- ); - }, - - isGroupingSupportedByTopology: function(topology, grouping) { - return !grouping.needsTopology || topology && topology[grouping.needsTopology]; - } - -}); - -module.exports = Groupings; diff --git a/client/app/scripts/constants/action-types.js b/client/app/scripts/constants/action-types.js index ca6084a4b..bf9234a95 100644 --- a/client/app/scripts/constants/action-types.js +++ b/client/app/scripts/constants/action-types.js @@ -2,7 +2,6 @@ const keymirror = require('keymirror'); module.exports = keymirror({ CLICK_CLOSE_DETAILS: null, - CLICK_GROUPING: null, CLICK_NODE: null, CLICK_TOPOLOGY: null, CLOSE_WEBSOCKET: null, diff --git a/client/app/scripts/stores/__tests__/app-store-test.js b/client/app/scripts/stores/__tests__/app-store-test.js index bcbb9491e..b6d38a231 100644 --- a/client/app/scripts/stores/__tests__/app-store-test.js +++ b/client/app/scripts/stores/__tests__/app-store-test.js @@ -130,14 +130,14 @@ describe('AppStore', function() { registeredCallback(ReceiveNodesDeltaAction); expect(AppStore.getAppState()) - .toEqual({"topologyId":"topo1","grouping":"none","selectedNodeId": null}); + .toEqual({"topologyId":"topo1","selectedNodeId": null}); registeredCallback(ClickNodeAction); expect(AppStore.getAppState()) - .toEqual({"topologyId":"topo1","grouping":"none","selectedNodeId": 'n1'}); + .toEqual({"topologyId":"topo1","selectedNodeId": 'n1'}); // go back in browsing - RouteAction.state = {"topologyId":"topo1","grouping":"none","selectedNodeId": null}; + RouteAction.state = {"topologyId":"topo1","selectedNodeId": null}; registeredCallback(RouteAction); expect(AppStore.getSelectedNodeId()).toBe(null); expect(AppStore.getNodes()).toEqual(NODE_SET); diff --git a/client/app/scripts/stores/app-store.js b/client/app/scripts/stores/app-store.js index 00ba823cb..848dbf838 100644 --- a/client/app/scripts/stores/app-store.js +++ b/client/app/scripts/stores/app-store.js @@ -29,7 +29,6 @@ function findCurrentTopology(subTree, topologyId) { // Initial values -let currentGrouping = 'none'; let currentTopologyId = 'containers'; let errorUrl = null; let version = ''; @@ -50,7 +49,6 @@ const AppStore = assign({}, EventEmitter.prototype, { getAppState: function() { return { topologyId: currentTopologyId, - grouping: this.getCurrentGrouping(), selectedNodeId: this.getSelectedNodeId() }; }, @@ -67,10 +65,6 @@ const AppStore = assign({}, EventEmitter.prototype, { } }, - getCurrentGrouping: function() { - return currentGrouping; - }, - getErrorUrl: function() { return errorUrl; }, @@ -145,14 +139,6 @@ AppStore.registeredCallback = function(payload) { AppStore.emit(AppStore.CHANGE_EVENT); break; - case ActionTypes.CLICK_GROUPING: - if (payload.grouping !== currentGrouping) { - currentGrouping = payload.grouping; - nodes = {}; - AppStore.emit(AppStore.CHANGE_EVENT); - } - break; - case ActionTypes.CLICK_NODE: selectedNodeId = payload.nodeId; AppStore.emit(AppStore.CHANGE_EVENT); @@ -260,12 +246,10 @@ AppStore.registeredCallback = function(payload) { break; case ActionTypes.ROUTE_TOPOLOGY: - if (currentTopologyId !== payload.state.topologyId - || currentGrouping !== payload.state.grouping) { + if (currentTopologyId !== payload.state.topologyId) { nodes = {}; } currentTopologyId = payload.state.topologyId; - currentGrouping = payload.state.grouping; selectedNodeId = payload.state.selectedNodeId; AppStore.emit(AppStore.CHANGE_EVENT); break;