Remove .json suffix from web routes
For the existing simple cases, like builds, jobs and status, having the json suffix is a perfectly reasonable thing. However, in the next patch it starts to get weird. When we add support for specific changes or specific jobs, we we grow URLs like: /openstack/status.json /openstack/status/change/537010,2.json Those read weird, because change/537010,2 is much more like an argument or specialiation of status. The thing that reads weird is the status call having .json but the change-specific call just being status/, not the trailing .json on the change url. Removing the json suffix gets us: /openstack/status /openstack/status/change/537010,2 which feels better as the status portion of the url remains consistent. This is done first in the stack so that as we add tests for new endpoints we can get them right the first time rather than having a big rename patch at the end (which is what this started as) Change-Id: I4baf33fdacaf46943fbd192743551bb27bd618de
This commit is contained in:
parent
477cd21c97
commit
9010dc50f4
|
@ -49,7 +49,7 @@
|
|||
options = $.extend({
|
||||
'enabled': true,
|
||||
'graphite_url': '',
|
||||
'source': 'status.json',
|
||||
'source': 'status',
|
||||
'msg_id': '#zuul_msg',
|
||||
'pipelines_id': '#zuul_pipelines',
|
||||
'queue_events_num': '#zuul_queue_events_num',
|
||||
|
|
|
@ -55,7 +55,7 @@ function zuul_start($) {
|
|||
var demo = location.search.match(/[?&]demo=([^?&]*)/),
|
||||
source_url = location.search.match(/[?&]source_url=([^?&]*)/),
|
||||
source = demo ? './status-' + (demo[1] || 'basic') + '.json-sample' :
|
||||
'status.json';
|
||||
'status';
|
||||
source = source_url ? source_url[1] : source;
|
||||
|
||||
var zuul = $.zuul({
|
||||
|
|
|
@ -89,7 +89,7 @@ class TestWeb(ZuulTestCase):
|
|||
self.waitUntilSettled()
|
||||
|
||||
req = urllib.request.Request(
|
||||
"http://localhost:%s/tenant-one/status.json" % self.port)
|
||||
"http://localhost:%s/tenant-one/status" % self.port)
|
||||
f = urllib.request.urlopen(req)
|
||||
headers = f.info()
|
||||
self.assertIn('Content-Length', headers)
|
||||
|
@ -230,7 +230,7 @@ class TestWeb(ZuulTestCase):
|
|||
@skip("This returns a 500")
|
||||
def test_web_404_on_unknown_tenant(self):
|
||||
req = urllib.request.Request(
|
||||
"http://localhost:{}/non-tenant/status.json".format(self.port))
|
||||
"http://localhost:{}/non-tenant/status".format(self.port))
|
||||
e = self.assertRaises(
|
||||
urllib.error.HTTPError, urllib.request.urlopen, req)
|
||||
self.assertEqual(404, e.code)
|
||||
|
|
|
@ -24,7 +24,7 @@ parser.add_argument('tenant', help='The Zuul tenant')
|
|||
parser.add_argument('pipeline', help='The name of the Zuul pipeline')
|
||||
options = parser.parse_args()
|
||||
|
||||
data = urllib2.urlopen('%s/status.json' % options.url).read()
|
||||
data = urllib2.urlopen('%s/status' % options.url).read()
|
||||
data = json.loads(data)
|
||||
|
||||
for pipeline in data['pipelines']:
|
||||
|
|
|
@ -127,7 +127,7 @@ class SQLConnection(BaseConnection):
|
|||
|
||||
def getWebHandlers(self, zuul_web):
|
||||
return [
|
||||
SqlWebHandler(self, zuul_web, 'GET', '/{tenant}/builds.json'),
|
||||
SqlWebHandler(self, zuul_web, 'GET', '/{tenant}/builds'),
|
||||
StaticHandler(zuul_web, '/{tenant}/builds.html'),
|
||||
]
|
||||
|
||||
|
|
|
@ -256,9 +256,9 @@ class ZuulWeb(object):
|
|||
is run within a separate (non-main) thread.
|
||||
"""
|
||||
routes = [
|
||||
('GET', '/tenants.json', self._handleTenantsRequest),
|
||||
('GET', '/{tenant}/status.json', self._handleStatusRequest),
|
||||
('GET', '/{tenant}/jobs.json', self._handleJobsRequest),
|
||||
('GET', '/tenants', self._handleTenantsRequest),
|
||||
('GET', '/{tenant}/status', self._handleStatusRequest),
|
||||
('GET', '/{tenant}/jobs', self._handleJobsRequest),
|
||||
('GET', '/{tenant}/console-stream', self._handleWebsocket),
|
||||
('GET', '/{tenant}/{project:.*}.pub', self._handleKeyRequest),
|
||||
]
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
options = $.extend({
|
||||
'enabled': true,
|
||||
'graphite_url': '',
|
||||
'source': 'status.json',
|
||||
'source': 'status',
|
||||
'msg_id': '#zuul_msg',
|
||||
'pipelines_id': '#zuul_pipelines',
|
||||
'queue_events_num': '#zuul_queue_events_num',
|
||||
|
|
|
@ -23,7 +23,7 @@ angular.module('zuulTenants', []).controller(
|
|||
{
|
||||
$scope.tenants = undefined;
|
||||
$scope.tenants_fetch = function() {
|
||||
$http.get("tenants.json")
|
||||
$http.get("tenants")
|
||||
.then(function success(result) {
|
||||
$scope.tenants = result.data;
|
||||
});
|
||||
|
@ -36,7 +36,7 @@ angular.module('zuulJobs', []).controller(
|
|||
{
|
||||
$scope.jobs = undefined;
|
||||
$scope.jobs_fetch = function() {
|
||||
$http.get("jobs.json")
|
||||
$http.get("jobs")
|
||||
.then(function success(result) {
|
||||
$scope.jobs = result.data;
|
||||
});
|
||||
|
@ -78,7 +78,7 @@ angular.module('zuulBuilds', [], function($locationProvider) {
|
|||
if ($scope.job_name) {query_string += "&job_name="+$scope.job_name;}
|
||||
if ($scope.project) {query_string += "&project="+$scope.project;}
|
||||
if (query_string != "") {query_string = "?" + query_string.substr(1);}
|
||||
$http.get("builds.json" + query_string)
|
||||
$http.get("builds" + query_string)
|
||||
.then(function success(result) {
|
||||
for (build_pos = 0;
|
||||
build_pos < result.data.length;
|
||||
|
|
|
@ -55,7 +55,7 @@ function zuul_start($) {
|
|||
var demo = location.search.match(/[?&]demo=([^?&]*)/),
|
||||
source_url = location.search.match(/[?&]source_url=([^?&]*)/),
|
||||
source = demo ? './status-' + (demo[1] || 'basic') + '.json-sample' :
|
||||
'status.json';
|
||||
'status';
|
||||
source = source_url ? source_url[1] : source;
|
||||
|
||||
var zuul = $.zuul({
|
||||
|
|
Loading…
Reference in New Issue