Move from /api/stat to /api/tps-reports (#1105)

Common blacklists have `/api/stat` in them. This causes the dashboard to not load.

`/api/tps-reports` is not in any blacklists, suggests what this route does and is slightly tongue in cheek. Fixes #970
This commit is contained in:
Thomas Rampelberg 2018-06-11 16:39:00 -07:00 committed by GitHub
parent 3ae8dcd369
commit c3dc20d64f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View File

@ -84,7 +84,7 @@ const ApiHelpers = (pathPrefix, defaultMetricsWindow = '1m') => {
type = "replicationcontroller"; type = "replicationcontroller";
} }
let baseUrl = '/api/stat?resource_type=' + type; let baseUrl = '/api/tps-reports?resource_type=' + type;
return !namespace ? baseUrl : baseUrl + '&namespace=' + namespace; return !namespace ? baseUrl : baseUrl + '&namespace=' + namespace;
}; };

View File

@ -250,24 +250,24 @@ describe('ApiHelpers', () => {
}); });
it('adds a ?window= if metricsWindow is the only param', () => { it('adds a ?window= if metricsWindow is the only param', () => {
api.fetchMetrics('/api/stat'); api.fetchMetrics('/api/tps-reports');
expect(fetchStub.calledOnce).to.be.true; expect(fetchStub.calledOnce).to.be.true;
expect(fetchStub.args[0][0]).to.equal('/api/stat?window=1m'); expect(fetchStub.args[0][0]).to.equal('/api/tps-reports?window=1m');
}); });
it('adds &window= if metricsWindow is not the only param', () => { it('adds &window= if metricsWindow is not the only param', () => {
api.fetchMetrics('/api/stat?foo=3&bar="me"'); api.fetchMetrics('/api/tps-reports?foo=3&bar="me"');
expect(fetchStub.calledOnce).to.be.true; expect(fetchStub.calledOnce).to.be.true;
expect(fetchStub.args[0][0]).to.equal('/api/stat?foo=3&bar="me"&window=1m'); expect(fetchStub.args[0][0]).to.equal('/api/tps-reports?foo=3&bar="me"&window=1m');
}); });
it('does not add another &window= if there is already a window param', () => { it('does not add another &window= if there is already a window param', () => {
api.fetchMetrics('/api/stat?foo=3&window=24h&bar="me"'); api.fetchMetrics('/api/tps-reports?foo=3&window=24h&bar="me"');
expect(fetchStub.calledOnce).to.be.true; expect(fetchStub.calledOnce).to.be.true;
expect(fetchStub.args[0][0]).to.equal('/api/stat?foo=3&window=24h&bar="me"'); expect(fetchStub.args[0][0]).to.equal('/api/tps-reports?foo=3&window=24h&bar="me"');
}); });
}); });
@ -285,19 +285,19 @@ describe('ApiHelpers', () => {
it('returns the correct rollup url for deployment overviews', () => { it('returns the correct rollup url for deployment overviews', () => {
api = ApiHelpers('/go/my/own/way'); api = ApiHelpers('/go/my/own/way');
let deploymentUrl = api.urlsForResource("deployment"); let deploymentUrl = api.urlsForResource("deployment");
expect(deploymentUrl).to.equal('/api/stat?resource_type=deployment'); expect(deploymentUrl).to.equal('/api/tps-reports?resource_type=deployment');
}); });
it('returns the correct rollup url for pod overviews', () => { it('returns the correct rollup url for pod overviews', () => {
api = ApiHelpers('/go/my/own/way'); api = ApiHelpers('/go/my/own/way');
let deploymentUrls = api.urlsForResource("pod"); let deploymentUrls = api.urlsForResource("pod");
expect(deploymentUrls).to.equal('/api/stat?resource_type=pod'); expect(deploymentUrls).to.equal('/api/tps-reports?resource_type=pod');
}); });
it('scopes the query to the provided namespace', () => { it('scopes the query to the provided namespace', () => {
api = ApiHelpers('/go/my/own/way'); api = ApiHelpers('/go/my/own/way');
let deploymentUrls = api.urlsForResource("pod", "my-ns"); let deploymentUrls = api.urlsForResource("pod", "my-ns");
expect(deploymentUrls).to.equal('/api/stat?resource_type=pod&namespace=my-ns'); expect(deploymentUrls).to.equal('/api/tps-reports?resource_type=pod&namespace=my-ns');
}); });
}); });
}); });

View File

@ -95,7 +95,7 @@ func NewServer(addr, templateDir, staticDir, uuid, controllerNamespace, webpackD
// webapp api routes // webapp api routes
server.router.GET("/api/version", handler.handleApiVersion) server.router.GET("/api/version", handler.handleApiVersion)
server.router.GET("/api/stat", handler.handleApiStat) server.router.GET("/api/tps-reports", handler.handleApiStat)
server.router.GET("/api/pods", handler.handleApiPods) server.router.GET("/api/pods", handler.handleApiPods)
return httpServer return httpServer