Skip to content

Commit

Permalink
Merge pull request #701 from weaveworks/693-no-filter-details
Browse files Browse the repository at this point in the history
Don't apply filters to node endpoints & update details panel logic
  • Loading branch information
tomwilkie committed Nov 30, 2015
2 parents a532c26 + f5aafb7 commit f16db9d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
15 changes: 14 additions & 1 deletion app/api_topologies.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ func renderedForRequest(r *http.Request, topology APITopologyDesc) render.Render
return renderer
}

func (r *registry) captureRenderer(rep Reporter, f func(Reporter, render.Renderer, http.ResponseWriter, *http.Request)) http.HandlerFunc {
type reportRenderHandler func(Reporter, render.Renderer, http.ResponseWriter, *http.Request)

func (r *registry) captureRenderer(rep Reporter, f reportRenderHandler) http.HandlerFunc {
return func(w http.ResponseWriter, req *http.Request) {
topology, ok := r.get(mux.Vars(req)["topology"])
if !ok {
Expand All @@ -256,3 +258,14 @@ func (r *registry) captureRenderer(rep Reporter, f func(Reporter, render.Rendere
f(rep, renderer, w, req)
}
}

func (r *registry) captureRendererWithoutFilters(rep Reporter, f reportRenderHandler) http.HandlerFunc {
return func(w http.ResponseWriter, req *http.Request) {
topology, ok := r.get(mux.Vars(req)["topology"])
if !ok {
http.NotFound(w, req)
return
}
f(rep, topology.renderer, w, req)
}
}
2 changes: 1 addition & 1 deletion app/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func registerTopologyRoutes(c collector, router *mux.Router) {
get.HandleFunc("/api/topology/{topology}/ws",
topologyRegistry.captureRenderer(c, handleWs)) // NB not gzip!
get.MatcherFunc(URLMatcher("/api/topology/{topology}/{id}")).HandlerFunc(
gzipHandler(topologyRegistry.captureRenderer(c, handleNode)))
gzipHandler(topologyRegistry.captureRendererWithoutFilters(c, handleNode)))
get.MatcherFunc(URLMatcher("/api/topology/{topology}/{local}/{remote}")).HandlerFunc(
gzipHandler(topologyRegistry.captureRenderer(c, handleEdge)))
get.HandleFunc("/api/report", gzipHandler(makeRawReportHandler(c)))
Expand Down
11 changes: 8 additions & 3 deletions client/app/scripts/components/node-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,19 @@ const NodeDetails = React.createClass({
const details = this.props.details;
const nodeExists = this.props.nodes && this.props.nodes.has(this.props.nodeId);

if (details) {
return this.renderDetails();
}

if (!nodeExists) {
return this.renderNotAvailable();
}

if (!details) {
return this.renderLoading();
}
return this.renderLoading();
},

renderDetails: function() {
const details = this.props.details;
const nodeColor = this.getNodeColorDark(details.rank, details.label_major);
const styles = {
controls: {
Expand Down

0 comments on commit f16db9d

Please sign in to comment.