diff --git a/htrace-core/src/web/app/models/span.js b/htrace-core/src/web/app/models/span.js index 506c933..2283adb 100644 --- a/htrace-core/src/web/app/models/span.js +++ b/htrace-core/src/web/app/models/span.js @@ -51,5 +51,5 @@ App.Span = Backbone.Model.extend({ }); App.Spans = Backbone.Collection.extend({ - "model": App.Span + model: App.Span }); diff --git a/htrace-core/src/web/app/setup.js b/htrace-core/src/web/app/setup.js index f2eba7c..80c67d2 100644 --- a/htrace-core/src/web/app/setup.js +++ b/htrace-core/src/web/app/setup.js @@ -28,10 +28,22 @@ var Router = Backbone.Router.extend({ this.spansCollection = spans.clone(); this.spanViews = {}; - this.listSpansView = new App.ListSpansView({ - "collection": this.spansCollection, - "id": "span-list" + this.listSpansView = new Backgrid.Grid({ + columns: [{ + name: "spanId", + label: "ID", + cell: "string", + editable: false + }, { + name: "description", + label: "Description", + cell: "string", + editable: false + }], + collection: this.spansCollection }); + this.listSpansView.render(); + this.searchView = new App.SearchView({ "collection": this.spansCollection, "el": $("#list").find("[role='form']") diff --git a/htrace-core/src/web/app/views/span.js b/htrace-core/src/web/app/views/span.js index d976a71..4c6381c 100644 --- a/htrace-core/src/web/app/views/span.js +++ b/htrace-core/src/web/app/views/span.js @@ -16,43 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - -App.ListSpansView = Backbone.View.extend({ - "tagName": "ul", - "className": "spans", - "template": _.template($("#list-span-template").html()), - "events": { - "click li": "spanClicked" - }, - - initialize: function() { - _.bindAll(this, "render"); - this.collection.bind('change', this.render); - - this.rendered = false; - }, - - "render": function() { - if (this.rendered) { - $(this.el).empty(); - } - - $(this.el).append( - this.template({ - "spans": this.collection.toJSON() - })); - - this.rendered = true; - - return this; - }, - - "spanClicked": function(e) { - e.preventDefault(); - var spanId = $(e.currentTarget).data("id"); - window.urlconf.navigate("/spans/" + spanId, true); - } -}); App.SpanView = Backbone.View.extend({ "tagName": "div", diff --git a/htrace-core/src/web/css/main.css b/htrace-core/src/web/css/main.css new file mode 100644 index 0000000..d5fd84f --- /dev/null +++ b/htrace-core/src/web/css/main.css @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +ul.spans { + margin: 0px; + padding: 0px; +} + +li.span { + margin: 0px; + list-style: none; +} diff --git a/htrace-core/src/web/index.html b/htrace-core/src/web/index.html index 36854b5..28f8b59 100644 --- a/htrace-core/src/web/index.html +++ b/htrace-core/src/web/index.html @@ -25,10 +25,11 @@ + - +