From 0cd8ad48cb184b8388950c8579986f0faf0460e5 Mon Sep 17 00:00:00 2001 From: gschwab Date: Thu, 27 Feb 2014 15:44:01 +0100 Subject: [PATCH] added some stuff --- .../js/templates/clusterDown.ejs | 11 +++ .../js/views/clusterDownView.js | 87 +++++++++++++++++++ .../clusterFrontend/js/views/planTestView.js | 2 + .../js/views/showClusterView.js | 2 +- 4 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 js/apps/system/aardvark/clusterFrontend/js/templates/clusterDown.ejs create mode 100644 js/apps/system/aardvark/clusterFrontend/js/views/clusterDownView.js diff --git a/js/apps/system/aardvark/clusterFrontend/js/templates/clusterDown.ejs b/js/apps/system/aardvark/clusterFrontend/js/templates/clusterDown.ejs new file mode 100644 index 0000000000..0228534544 --- /dev/null +++ b/js/apps/system/aardvark/clusterFrontend/js/templates/clusterDown.ejs @@ -0,0 +1,11 @@ + diff --git a/js/apps/system/aardvark/clusterFrontend/js/views/clusterDownView.js b/js/apps/system/aardvark/clusterFrontend/js/views/clusterDownView.js new file mode 100644 index 0000000000..a4648a178a --- /dev/null +++ b/js/apps/system/aardvark/clusterFrontend/js/views/clusterDownView.js @@ -0,0 +1,87 @@ +/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true, newcap: true */ +/*global window, $, Backbone, plannerTemplateEngine, alert */ + +(function() { + "use strict"; + + window.ClusterDownView = Backbone.View.extend({ + + el: "#content", + + template: templateEngine.createTemplate("clusterDown.ejs"), + + events: { + "click #relaunchCluster" : "relaunchCluster", + "click #editPlan" : "editPlan", + "click #deletePlan" : "deletePlan" + }, + + initialize : function() { + this.dbservers = new window.ClusterServers([], { + interval: this.interval + }); + this.dbservers.fetch({ + async: false + }); + this.dbservers.startUpdating(); + }, + + render: function() { + $(this.el).html(this.template.render({})); + }, + + relaunchCluster: function() { + console.log("relaunchCluster"); + var result = false; + $.ajax({ + cache: false, + type: "GET", + async: false, // sequential calls! + url: "/cluster/relaunch", + success: function(data) { + result = data; + }, + error: function(data) { + } + }); + + return result; + }, + + editPlan: function() { + console.log("editPlan"); + //welches Scenario und entsprechende View rendern + //siehe showClusterView.js + + + var byAddress = this.listByAddress(); + if (Object.keys(byAddress).length === 1) { + this.type = "testPlan"; + } else { + this.type = "other"; + } + + if (this.type === "testPlan") { + window.App.navigate("planTest", {trigger : true}); + } else { +// window.App.navigate("planSymmetrical", {trigger : true}); + window.App.navigate("planAsymmetrical", {trigger : true}); + } + }, + + deletePlan: function() { + console.log("deletePlan"); + //irgendwie löschen + //view planScenario + }, + + listByAddress: function() { + var byAddress = this.dbservers.byAddress(); + byAddress = this.coordinators.byAddress(byAddress); + return byAddress; + } + + + }); + +}()); diff --git a/js/apps/system/aardvark/clusterFrontend/js/views/planTestView.js b/js/apps/system/aardvark/clusterFrontend/js/views/planTestView.js index 1e92183db9..024808f839 100644 --- a/js/apps/system/aardvark/clusterFrontend/js/views/planTestView.js +++ b/js/apps/system/aardvark/clusterFrontend/js/views/planTestView.js @@ -50,6 +50,7 @@ }, render: function() { + // $(this.el).html(this.template.render({ config : this.model.get("config") })); diff --git a/js/apps/system/aardvark/clusterFrontend/js/views/showClusterView.js b/js/apps/system/aardvark/clusterFrontend/js/views/showClusterView.js index 7a7289a8f3..86c01dea0c 100644 --- a/js/apps/system/aardvark/clusterFrontend/js/views/showClusterView.js +++ b/js/apps/system/aardvark/clusterFrontend/js/views/showClusterView.js @@ -72,7 +72,7 @@ interval: this.interval }); this.cols = new window.ClusterCollections(); - this.shards = new window.ClusterShards() + this.shards = new window.ClusterShards(); this.startUpdating(); var typeModel = new window.ClusterType();