Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't apply filters to node endpoints & update details panel logic #701

Merged
merged 1 commit into from
Nov 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

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