From 03247bb256cf18cd2506f556edd32d6a6f2e0624 Mon Sep 17 00:00:00 2001 From: Franklin Hu Date: Thu, 23 Aug 2012 13:51:26 -0700 Subject: [PATCH] Backbone (part 1) Initial changes to move the front end JS to Backbone - Span, Service Name models - Index page service name, span name populated through Backbone models/views - Some Finatra side changes to accommodate Backbone Author: @franklinhu Fixes #118 URL: https://github.com/twitter/zipkin/pull/118 --- .../resources/public/js/application-index.js | 334 ++++++++++-------- .../resources/public/js/application-models.js | 51 +++ .../resources/public/js/application-views.js | 74 ++++ .../resources/public/js/backbone-0.9.2.js | 38 ++ .../resources/public/js/underscore-1.3.3.js | 32 ++ .../main/resources/templates/index.mustache | 2 +- .../main/resources/templates/show.mustache | 2 +- .../main/resources/templates/static.mustache | 2 +- .../com/twitter/zipkin/config/JsConfig.scala | 5 + .../scala/com/twitter/zipkin/web/App.scala | 75 +++- .../com/twitter/zipkin/web/QueryRequest.scala | 64 ++-- .../twitter/zipkin/web/TracedService.scala | 19 + 12 files changed, 499 insertions(+), 199 deletions(-) create mode 100644 zipkin-finatra/src/main/resources/public/js/application-models.js create mode 100644 zipkin-finatra/src/main/resources/public/js/application-views.js create mode 100644 zipkin-finatra/src/main/resources/public/js/backbone-0.9.2.js create mode 100644 zipkin-finatra/src/main/resources/public/js/underscore-1.3.3.js create mode 100644 zipkin-finatra/src/main/scala/com/twitter/zipkin/web/TracedService.scala diff --git a/zipkin-finatra/src/main/resources/public/js/application-index.js b/zipkin-finatra/src/main/resources/public/js/application-index.js index eddf9d9182e..8fa05e3b893 100644 --- a/zipkin-finatra/src/main/resources/public/js/application-index.js +++ b/zipkin-finatra/src/main/resources/public/js/application-index.js @@ -38,141 +38,173 @@ Zipkin.Application.Index = (function() { var filter_submit; - /* Makes ajax call to get and populate the service names field */ - var fetchServiceNames = function() { - $.ajax({ - type: 'GET', - url: root_url + 'api/services', - success: function(data){ - var select = $("#service_name"); - - /* Use service name from cookie if exists */ - var lastServiceName = Zipkin.Base.getCookie("lastServiceName"); - - for (var i = 0; i < data.length; i++) { - var d = data[i]; - var option = $('