improve API paths

This commit is contained in:
Diffido 2018-01-26 15:08:22 +01:00
parent e7001b2c3f
commit 8622c4eb89
3 changed files with 6 additions and 6 deletions

View file

@ -709,19 +709,19 @@ def serve():
_reset_schedules_path = r'schedules/reset' _reset_schedules_path = r'schedules/reset'
_schedule_run_path = r'schedules/(?P<id_>\d+)/run' _schedule_run_path = r'schedules/(?P<id_>\d+)/run'
_schedules_path = r'schedules/?(?P<id_>\d+)?' _schedules_path = r'schedules/?(?P<id_>\d+)?'
_history_path = r'history/?(?P<id_>\d+)' _history_path = r'schedules/?(?P<id_>\d+)/history'
_diff_path = r'diff/(?P<id_>\d+)/(?P<commit_id>[0-9a-f]+)/?(?P<old_commit_id>[0-9a-f]+)?/?' _diff_path = r'schedules/(?P<id_>\d+)/diff/(?P<commit_id>[0-9a-f]+)/?(?P<old_commit_id>[0-9a-f]+)?/?'
application = tornado.web.Application([ application = tornado.web.Application([
(r'/api/%s' % _reset_schedules_path, ResetSchedulesHandler, init_params), (r'/api/%s' % _reset_schedules_path, ResetSchedulesHandler, init_params),
(r'/api/v%s/%s' % (API_VERSION, _reset_schedules_path), ResetSchedulesHandler, init_params), (r'/api/v%s/%s' % (API_VERSION, _reset_schedules_path), ResetSchedulesHandler, init_params),
(r'/api/%s' % _schedule_run_path, RunScheduleHandler, init_params), (r'/api/%s' % _schedule_run_path, RunScheduleHandler, init_params),
(r'/api/v%s/%s' % (API_VERSION, _schedule_run_path), RunScheduleHandler, init_params), (r'/api/v%s/%s' % (API_VERSION, _schedule_run_path), RunScheduleHandler, init_params),
(r'/api/%s' % _schedules_path, SchedulesHandler, init_params),
(r'/api/v%s/%s' % (API_VERSION, _schedules_path), SchedulesHandler, init_params),
(r'/api/%s' % _history_path, HistoryHandler, init_params), (r'/api/%s' % _history_path, HistoryHandler, init_params),
(r'/api/v%s/%s' % (API_VERSION, _history_path), HistoryHandler, init_params), (r'/api/v%s/%s' % (API_VERSION, _history_path), HistoryHandler, init_params),
(r'/api/%s' % _diff_path, DiffHandler, init_params), (r'/api/%s' % _diff_path, DiffHandler, init_params),
(r'/api/v%s/%s' % (API_VERSION, _diff_path), DiffHandler, init_params), (r'/api/v%s/%s' % (API_VERSION, _diff_path), DiffHandler, init_params),
(r'/api/%s' % _schedules_path, SchedulesHandler, init_params),
(r'/api/v%s/%s' % (API_VERSION, _schedules_path), SchedulesHandler, init_params),
(r'/?(.*)', TemplateHandler, init_params), (r'/?(.*)', TemplateHandler, init_params),
], ],
static_path=os.path.join(os.path.dirname(__file__), 'dist/static'), static_path=os.path.join(os.path.dirname(__file__), 'dist/static'),

2
dist/diff.html vendored
View file

@ -60,7 +60,7 @@ var app = new Vue({
methods: { methods: {
getDiff: function() { getDiff: function() {
self = this; self = this;
var data = axios.get('/api/diff/' + this.id + '/' + this.diff + '/' + (this.oldid || '')).then(function(response) { var data = axios.get('/api/schedules/' + this.id + '/diff/' + this.diff + '/' + (this.oldid || '')).then(function(response) {
self.schedule = response.data.schedule; self.schedule = response.data.schedule;
self.difftext = response.data.diff; self.difftext = response.data.diff;
var current_size = document.getElementById('diffpanel').offsetWidth; var current_size = document.getElementById('diffpanel').offsetWidth;

2
dist/history.html vendored
View file

@ -63,7 +63,7 @@ var app = new Vue({
methods: { methods: {
getHistory: function() { getHistory: function() {
self = this; self = this;
var data = axios.get('/api/history/' + this.id).then(function(response) { var data = axios.get('/api/schedules/' + this.id + '/history').then(function(response) {
self.history = response.data.history; self.history = response.data.history;
self.updateFilter(); self.updateFilter();
self.schedule = response.data.schedule; self.schedule = response.data.schedule;