Browse Source

improve API paths

Diffido 6 years ago
parent
commit
8622c4eb89
3 changed files with 6 additions and 6 deletions
  1. 4 4
      diffido.py
  2. 1 1
      dist/diff.html
  3. 1 1
      dist/history.html

+ 4 - 4
diffido.py

@@ -709,19 +709,19 @@ def serve():
     _reset_schedules_path = r'schedules/reset'
     _schedule_run_path = r'schedules/(?P<id_>\d+)/run'
     _schedules_path = r'schedules/?(?P<id_>\d+)?'
-    _history_path = r'history/?(?P<id_>\d+)'
-    _diff_path = r'diff/(?P<id_>\d+)/(?P<commit_id>[0-9a-f]+)/?(?P<old_commit_id>[0-9a-f]+)?/?'
+    _history_path = r'schedules/?(?P<id_>\d+)/history'
+    _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([
             (r'/api/%s' % _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/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/v%s/%s' % (API_VERSION, _history_path), HistoryHandler, init_params),
             (r'/api/%s' % _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),
         ],
         static_path=os.path.join(os.path.dirname(__file__), 'dist/static'),

+ 1 - 1
dist/diff.html

@@ -60,7 +60,7 @@ var app = new Vue({
     methods: {
         getDiff: function() {
             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.difftext = response.data.diff;
                 var current_size = document.getElementById('diffpanel').offsetWidth;

+ 1 - 1
dist/history.html

@@ -63,7 +63,7 @@ var app = new Vue({
     methods: {
         getHistory: function() {
             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.updateFilter();
                 self.schedule = response.data.schedule;