diff --git a/UnitTests/HttpInterface/api-simple-hash-spec.rb b/UnitTests/HttpInterface/api-simple-hash-spec.rb new file mode 100644 index 0000000000..4880313475 --- /dev/null +++ b/UnitTests/HttpInterface/api-simple-hash-spec.rb @@ -0,0 +1,276 @@ +# coding: utf-8 + +require 'rspec' +require './arangodb.rb' + +describe ArangoDB do + api = "/_api/simple" + prefix = "api-simple" + + context "simple queries:" do + +################################################################################ +## range query +################################################################################ + + context "hash query:" do + before do + @cn = "UnitTestsCollectionHash" + ArangoDB.drop_collection(@cn) + @cid = ArangoDB.create_collection(@cn, false) + end + + after do + ArangoDB.drop_collection(@cn) + end + + it "finds the examples, wrong index specified" do + cmd = api + "/by-example-hash" + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"1\", \"example\" : { \"i\" : 12 } }" + doc = ArangoDB.log_put("#{prefix}-hash", cmd, :body => body) + + doc.code.should eq(404) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['code'].should eq(404) + doc.parsed_response['error'].should eq(true) + doc.parsed_response['errorNum'].should eq(1209) + end + + it "finds the examples, wrong attribute" do + # create index + cmd = "/_api/index?collection=#{@cn}" + body = "{ \"type\" : \"hash\", \"unique\" : true, \"fields\" : [ \"i\" ] }" + doc = ArangoDB.log_post("#{prefix}-hash-index", cmd, :body => body) + + doc.code.should eq(201) + iid = doc.parsed_response['id'] + + cmd = api + "/by-example-hash" + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"j\" : 12 } }" + doc = ArangoDB.log_put("#{prefix}-hash", cmd, :body => body) + + doc.code.should eq(404) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['code'].should eq(404) + doc.parsed_response['error'].should eq(true) + doc.parsed_response['errorNum'].should eq(1209) + end + + it "finds the examples, no index specified" do + cmd = api + "/by-example-hash" + body = "{ \"collection\" : \"#{@cn}\", \"example\" : { \"i\" : 12 } }" + doc = ArangoDB.log_put("#{prefix}-hash", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(0) + doc.parsed_response['count'].should eq(0) + end + + it "finds the examples, unique index" do + # create data + for i in [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] + body = "{ \"i\" : #{i} }" + doc = ArangoDB.post("/_api/document?collection=#{@cn}", :body => body) + doc.code.should eq(202) + end + + # create index + cmd = "/_api/index?collection=#{@cn}" + body = "{ \"type\" : \"hash\", \"unique\" : true, \"fields\" : [ \"i\" ] }" + doc = ArangoDB.log_post("#{prefix}-hash-index", cmd, :body => body) + + doc.code.should eq(201) + iid = doc.parsed_response['id'] + + # by-example-hash + cmd = api + "/by-example-hash" + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"i\" : 3 } }" + doc = ArangoDB.log_put("#{prefix}-hash", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(1) + doc.parsed_response['count'].should eq(1) + doc.parsed_response['result'].map{|i| i['i']}.should =~ [3] + + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"i\" : 12 } }" + doc = ArangoDB.log_put("#{prefix}-hash", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(0) + doc.parsed_response['count'].should eq(0) + end + + it "finds the examples, non-unique index" do + # create data + for i in [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] + body = "{ \"i\" : #{i}, \"j\" : 2 }" + doc = ArangoDB.post("/_api/document?collection=#{@cn}", :body => body) + doc.code.should eq(202) + end + + # create index + cmd = "/_api/index?collection=#{@cn}" + body = "{ \"type\" : \"hash\", \"unique\" : false, \"fields\" : [ \"j\", \"i\" ] }" + doc = ArangoDB.log_post("#{prefix}-hash-index", cmd, :body => body) + + doc.code.should eq(201) + iid = doc.parsed_response['id'] + + # by-example-hash + cmd = api + "/by-example-hash" + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"j\" : 2, \"i\" : 2 } }" + doc = ArangoDB.log_put("#{prefix}-hash", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(1) + doc.parsed_response['count'].should eq(1) + doc.parsed_response['result'].map{|i| i['i']}.should =~ [2] + doc.parsed_response['result'].map{|i| i['j']}.should =~ [2] + + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"i\" : 2, \"j\" : 2 } }" + doc = ArangoDB.log_put("#{prefix}-hash", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(1) + doc.parsed_response['count'].should eq(1) + doc.parsed_response['result'].map{|i| i['i']}.should =~ [2] + doc.parsed_response['result'].map{|i| i['j']}.should =~ [2] + + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"j\" : 3, \"i\" : 2 } }" + doc = ArangoDB.log_put("#{prefix}-hash", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(0) + doc.parsed_response['count'].should eq(0) + end + + it "finds the examples" do + # create data + + (0..10).each do |i| + (0..10).each do |j| + body = "{ \"i\" : #{i}, \"j\" : #{j} }" + doc = ArangoDB.post("/_api/document?collection=#{@cn}", :body => body) + doc.code.should eq(202) + end + end + + # create index + cmd = "/_api/index?collection=#{@cn}" + body = "{ \"type\" : \"hash\", \"unique\" : false, \"fields\" : [ \"i\", \"j\" ] }" + doc = ArangoDB.log_post("#{prefix}-hash-index", cmd, :body => body) + + doc.code.should eq(201) + iid = doc.parsed_response['id'] + + # by-example-hash + cmd = api + "/by-example-hash" + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"i\" : 1, \"j\" : 7 } }" + doc = ArangoDB.log_put("#{prefix}-hash", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(1) + doc.parsed_response['count'].should eq(1) + doc.parsed_response['result'].map{|i| i['i']}.should =~ [1] + doc.parsed_response['result'].map{|i| i['j']}.should =~ [7] + end + + it "finds the examples, multiple elements" do + # create data + + (0..9).each do |i| + (0..9).each do |j| + body = "{ \"i\" : #{i}, \"j\" : #{j} }" + doc = ArangoDB.post("/_api/document?collection=#{@cn}", :body => body) + doc.code.should eq(202) + end + end + + # create index + cmd = "/_api/index?collection=#{@cn}" + body = "{ \"type\" : \"hash\", \"unique\" : false, \"fields\" : [ \"i\" ] }" + doc = ArangoDB.log_post("#{prefix}-hash-index", cmd, :body => body) + + doc.code.should eq(201) + iid = doc.parsed_response['id'] + + # by-example-hash + cmd = api + "/by-example-hash" + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"i\" : 1 } }" + doc = ArangoDB.log_put("#{prefix}-hash", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(10) + doc.parsed_response['count'].should eq(10) + doc.parsed_response['result'].map{|i| i['i']}.should =~ [1,1,1,1,1,1,1,1,1,1] + end + + it "finds the examples, small batchsize" do + # create data + + (0..9).each do |i| + (0..9).each do |j| + body = "{ \"i\" : #{i}, \"j\" : #{j} }" + doc = ArangoDB.post("/_api/document?collection=#{@cn}", :body => body) + doc.code.should eq(202) + end + end + + # create index + cmd = "/_api/index?collection=#{@cn}" + body = "{ \"type\" : \"hash\", \"unique\" : false, \"fields\" : [ \"i\" ] }" + doc = ArangoDB.log_post("#{prefix}-hash-index", cmd, :body => body) + + doc.code.should eq(201) + iid = doc.parsed_response['id'] + + # by-example-hash + cmd = api + "/by-example-hash" + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"i\" : 0 }, \"batchSize\" : 2 }" + doc = ArangoDB.log_put("#{prefix}-hash", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(true) + doc.parsed_response['result'].length.should eq(2) + doc.parsed_response['count'].should eq(10) + doc.parsed_response['result'].map{|i| i['i']}.should =~ [0,0] + end + end + + end +end diff --git a/UnitTests/HttpInterface/api-simple-skiplist-spec.rb b/UnitTests/HttpInterface/api-simple-skiplist-spec.rb new file mode 100644 index 0000000000..05defef8a1 --- /dev/null +++ b/UnitTests/HttpInterface/api-simple-skiplist-spec.rb @@ -0,0 +1,276 @@ +# coding: utf-8 + +require 'rspec' +require './arangodb.rb' + +describe ArangoDB do + api = "/_api/simple" + prefix = "api-simple" + + context "simple queries:" do + +################################################################################ +## range query +################################################################################ + + context "skiplist query:" do + before do + @cn = "UnitTestsCollectionSkiplist" + ArangoDB.drop_collection(@cn) + @cid = ArangoDB.create_collection(@cn, false) + end + + after do + ArangoDB.drop_collection(@cn) + end + + it "finds the examples, wrong index specified" do + cmd = api + "/by-example-skiplist" + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"1\", \"example\" : { \"i\" : 12 } }" + doc = ArangoDB.log_put("#{prefix}-skiplist", cmd, :body => body) + + doc.code.should eq(404) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['code'].should eq(404) + doc.parsed_response['error'].should eq(true) + doc.parsed_response['errorNum'].should eq(1209) + end + + it "finds the examples, wrong attribute" do + # create index + cmd = "/_api/index?collection=#{@cn}" + body = "{ \"type\" : \"skiplist\", \"unique\" : true, \"fields\" : [ \"i\" ] }" + doc = ArangoDB.log_post("#{prefix}-skiplist-index", cmd, :body => body) + + doc.code.should eq(201) + iid = doc.parsed_response['id'] + + cmd = api + "/by-example-skiplist" + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"j\" : 12 } }" + doc = ArangoDB.log_put("#{prefix}-skiplist", cmd, :body => body) + + doc.code.should eq(404) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['code'].should eq(404) + doc.parsed_response['error'].should eq(true) + doc.parsed_response['errorNum'].should eq(1209) + end + + it "finds the examples, no index specified" do + cmd = api + "/by-example-skiplist" + body = "{ \"collection\" : \"#{@cn}\", \"example\" : { \"i\" : 12 } }" + doc = ArangoDB.log_put("#{prefix}-skiplist", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(0) + doc.parsed_response['count'].should eq(0) + end + + it "finds the examples, unique index" do + # create data + for i in [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] + body = "{ \"i\" : #{i} }" + doc = ArangoDB.post("/_api/document?collection=#{@cn}", :body => body) + doc.code.should eq(202) + end + + # create index + cmd = "/_api/index?collection=#{@cn}" + body = "{ \"type\" : \"skiplist\", \"unique\" : true, \"fields\" : [ \"i\" ] }" + doc = ArangoDB.log_post("#{prefix}-skiplist-index", cmd, :body => body) + + doc.code.should eq(201) + iid = doc.parsed_response['id'] + + # by-example-skiplist + cmd = api + "/by-example-skiplist" + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"i\" : 3 } }" + doc = ArangoDB.log_put("#{prefix}-skiplist", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(1) + doc.parsed_response['count'].should eq(1) + doc.parsed_response['result'].map{|i| i['i']}.should =~ [3] + + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"i\" : 12 } }" + doc = ArangoDB.log_put("#{prefix}-skiplist", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(0) + doc.parsed_response['count'].should eq(0) + end + + it "finds the examples, non-unique index" do + # create data + for i in [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] + body = "{ \"i\" : #{i}, \"j\" : 2 }" + doc = ArangoDB.post("/_api/document?collection=#{@cn}", :body => body) + doc.code.should eq(202) + end + + # create index + cmd = "/_api/index?collection=#{@cn}" + body = "{ \"type\" : \"skiplist\", \"unique\" : false, \"fields\" : [ \"j\", \"i\" ] }" + doc = ArangoDB.log_post("#{prefix}-skiplist-index", cmd, :body => body) + + doc.code.should eq(201) + iid = doc.parsed_response['id'] + + # by-example-skiplist + cmd = api + "/by-example-skiplist" + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"j\" : 2, \"i\" : 2 } }" + doc = ArangoDB.log_put("#{prefix}-skiplist", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(1) + doc.parsed_response['count'].should eq(1) + doc.parsed_response['result'].map{|i| i['i']}.should =~ [2] + doc.parsed_response['result'].map{|i| i['j']}.should =~ [2] + + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"i\" : 2, \"j\" : 2 } }" + doc = ArangoDB.log_put("#{prefix}-skiplist", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(1) + doc.parsed_response['count'].should eq(1) + doc.parsed_response['result'].map{|i| i['i']}.should =~ [2] + doc.parsed_response['result'].map{|i| i['j']}.should =~ [2] + + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"j\" : 3, \"i\" : 2 } }" + doc = ArangoDB.log_put("#{prefix}-skiplist", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(0) + doc.parsed_response['count'].should eq(0) + end + + it "finds the examples" do + # create data + + (0..10).each do |i| + (0..10).each do |j| + body = "{ \"i\" : #{i}, \"j\" : #{j} }" + doc = ArangoDB.post("/_api/document?collection=#{@cn}", :body => body) + doc.code.should eq(202) + end + end + + # create index + cmd = "/_api/index?collection=#{@cn}" + body = "{ \"type\" : \"skiplist\", \"unique\" : false, \"fields\" : [ \"i\", \"j\" ] }" + doc = ArangoDB.log_post("#{prefix}-skiplist-index", cmd, :body => body) + + doc.code.should eq(201) + iid = doc.parsed_response['id'] + + # by-example-skiplist + cmd = api + "/by-example-skiplist" + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"i\" : 1, \"j\" : 7 } }" + doc = ArangoDB.log_put("#{prefix}-skiplist", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(1) + doc.parsed_response['count'].should eq(1) + doc.parsed_response['result'].map{|i| i['i']}.should =~ [1] + doc.parsed_response['result'].map{|i| i['j']}.should =~ [7] + end + + it "finds the examples, multiple elements" do + # create data + + (0..9).each do |i| + (0..9).each do |j| + body = "{ \"i\" : #{i}, \"j\" : #{j} }" + doc = ArangoDB.post("/_api/document?collection=#{@cn}", :body => body) + doc.code.should eq(202) + end + end + + # create index + cmd = "/_api/index?collection=#{@cn}" + body = "{ \"type\" : \"skiplist\", \"unique\" : false, \"fields\" : [ \"i\" ] }" + doc = ArangoDB.log_post("#{prefix}-skiplist-index", cmd, :body => body) + + doc.code.should eq(201) + iid = doc.parsed_response['id'] + + # by-example-skiplist + cmd = api + "/by-example-skiplist" + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"i\" : 1 } }" + doc = ArangoDB.log_put("#{prefix}-skiplist", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(false) + doc.parsed_response['result'].length.should eq(10) + doc.parsed_response['count'].should eq(10) + doc.parsed_response['result'].map{|i| i['i']}.should =~ [1,1,1,1,1,1,1,1,1,1] + end + + it "finds the examples, small batchsize" do + # create data + + (0..9).each do |i| + (0..9).each do |j| + body = "{ \"i\" : #{i}, \"j\" : #{j} }" + doc = ArangoDB.post("/_api/document?collection=#{@cn}", :body => body) + doc.code.should eq(202) + end + end + + # create index + cmd = "/_api/index?collection=#{@cn}" + body = "{ \"type\" : \"skiplist\", \"unique\" : false, \"fields\" : [ \"i\" ] }" + doc = ArangoDB.log_post("#{prefix}-skiplist-index", cmd, :body => body) + + doc.code.should eq(201) + iid = doc.parsed_response['id'] + + # by-example-skiplist + cmd = api + "/by-example-skiplist" + body = "{ \"collection\" : \"#{@cn}\", \"index\" : \"#{iid}\", \"example\" : { \"i\" : 0 }, \"batchSize\" : 2 }" + doc = ArangoDB.log_put("#{prefix}-skiplist", cmd, :body => body) + + doc.code.should eq(201) + doc.headers['content-type'].should eq("application/json; charset=utf-8") + doc.parsed_response['error'].should eq(false) + doc.parsed_response['code'].should eq(201) + doc.parsed_response['hasMore'].should eq(true) + doc.parsed_response['result'].length.should eq(2) + doc.parsed_response['count'].should eq(10) + doc.parsed_response['result'].map{|i| i['i']}.should =~ [0,0] + end + end + + end +end diff --git a/UnitTests/HttpInterface/run-tests b/UnitTests/HttpInterface/run-tests index f92828071e..75f975f3a5 100755 --- a/UnitTests/HttpInterface/run-tests +++ b/UnitTests/HttpInterface/run-tests @@ -34,7 +34,9 @@ rspec --color --format d \ api-simple-example-spec.rb \ api-simple-fulltext-spec.rb \ api-simple-geo-spec.rb \ + api-simple-hash-spec.rb \ api-simple-range-spec.rb \ + api-simple-skiplist-spec.rb \ api-simple-spec.rb \ api-structures.rb \ api-transactions-spec.rb \ diff --git a/js/apps/system/aardvark/cluster.js b/js/apps/system/aardvark/cluster.js index d4e3ca5b9a..7539d61f93 100644 --- a/js/apps/system/aardvark/cluster.js +++ b/js/apps/system/aardvark/cluster.js @@ -159,7 +159,7 @@ _.each(list, function(url, k) { var v = {}; v.name = k; - v.url = url; + v.address = url; resList.push(v); if (_.contains(noBeat, k)) { v.status = "critical"; diff --git a/js/apps/system/aardvark/clusterFrontend/html/head.html.part b/js/apps/system/aardvark/clusterFrontend/html/head.html.part index 0938fbc27e..717962603e 100644 --- a/js/apps/system/aardvark/clusterFrontend/html/head.html.part +++ b/js/apps/system/aardvark/clusterFrontend/html/head.html.part @@ -4,6 +4,6 @@ - + diff --git a/js/apps/system/aardvark/clusterFrontend/html/scripts.html.part b/js/apps/system/aardvark/clusterFrontend/html/scripts.html.part index ed727ae40a..50dcd9d894 100644 --- a/js/apps/system/aardvark/clusterFrontend/html/scripts.html.part +++ b/js/apps/system/aardvark/clusterFrontend/html/scripts.html.part @@ -1,2 +1,4 @@ + + diff --git a/js/apps/system/aardvark/clusterFrontend/js/collections/arangoClusterStatisticsCollection.js b/js/apps/system/aardvark/clusterFrontend/js/collections/arangoClusterStatisticsCollection.js new file mode 100644 index 0000000000..eee90bc208 --- /dev/null +++ b/js/apps/system/aardvark/clusterFrontend/js/collections/arangoClusterStatisticsCollection.js @@ -0,0 +1,11 @@ +/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */ +/*global require, exports, Backbone, window */ +window.ClusterStatisticsCollection = Backbone.Collection.extend({ + model: window.Statistics, + url: "/_admin/statistics", + fetch: function() { + this.forEach(function (m) { + m.fetch({async: false}); + }) + } +}); diff --git a/js/apps/system/aardvark/clusterFrontend/js/collections/clusterCoordinators.js b/js/apps/system/aardvark/clusterFrontend/js/collections/clusterCoordinators.js index f9250fc7e5..8891b69bd7 100644 --- a/js/apps/system/aardvark/clusterFrontend/js/collections/clusterCoordinators.js +++ b/js/apps/system/aardvark/clusterFrontend/js/collections/clusterCoordinators.js @@ -13,6 +13,20 @@ this.interval = 1000; }, + byAddress: function (res) { + this.fetch({ + async: false + }); + res = res || {}; + this.forEach(function(m) { + var addr = m.get("address"); + addr = addr.substr(6); + addr = addr.split(":")[0]; + res[addr] = res[addr] || []; + res[addr].push(m); + }); + }, + getList: function() { this.fetch({ async: false diff --git a/js/apps/system/aardvark/clusterFrontend/js/collections/clusterServers.js b/js/apps/system/aardvark/clusterFrontend/js/collections/clusterServers.js index 5c5095c541..eeefbd48c2 100644 --- a/js/apps/system/aardvark/clusterFrontend/js/collections/clusterServers.js +++ b/js/apps/system/aardvark/clusterFrontend/js/collections/clusterServers.js @@ -16,6 +16,21 @@ this.interval = 1000; }, + byAddress: function (res) { + this.fetch({ + async: false + }); + res = res || {}; + this.forEach(function(m) { + var addr = m.get("address"); + addr = addr.substr(6); + addr = addr.split(":")[0]; + res[addr] = res[addr] || []; + res[addr].push(m); + }); + return res; + }, + getList: function() { this.fetch({ async: false diff --git a/js/apps/system/aardvark/clusterFrontend/js/templates/showCluster.ejs b/js/apps/system/aardvark/clusterFrontend/js/templates/showCluster.ejs index 7083cd03fc..4a1694a21b 100644 --- a/js/apps/system/aardvark/clusterFrontend/js/templates/showCluster.ejs +++ b/js/apps/system/aardvark/clusterFrontend/js/templates/showCluster.ejs @@ -6,5 +6,4 @@