diff --git a/src/sunstone/models/OpenNebulaJSON/ClusterJSON.rb b/src/sunstone/models/OpenNebulaJSON/ClusterJSON.rb
index b834218a38..a6cfe414e7 100644
--- a/src/sunstone/models/OpenNebulaJSON/ClusterJSON.rb
+++ b/src/sunstone/models/OpenNebulaJSON/ClusterJSON.rb
@@ -42,6 +42,7 @@ module OpenNebulaJSON
when "deldatastore" then self.deldatastore(action_hash['params'])
when "addvnet" then self.addvnet(action_hash['params'])
when "delvnet" then self.delvnet(action_hash['params'])
+ when "update" then self.update(action_hash['params'])
else
error_msg = "#{action_hash['perform']} action not " <<
@@ -73,5 +74,9 @@ module OpenNebulaJSON
def delvnet(params=Hash.new)
super(params['vnet_id'].to_i)
end
+
+ def update(params=Hash.new)
+ super(params['template_raw'])
+ end
end
end
diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js
index 999d3d1c06..4011e2e40a 100644
--- a/src/sunstone/public/js/opennebula.js
+++ b/src/sunstone/public/js/opennebula.js
@@ -944,6 +944,16 @@ var OpenNebula = {
OpenNebula.Action.simple_action(params,OpenNebula.Cluster.resource,
"delvnet",action_obj);
},
+ "fetch_template" : function(params){
+ OpenNebula.Action.show(params,OpenNebula.Cluster.resource,"template");
+ },
+ "update" : function(params){
+ var action_obj = {"template_raw" : params.data.extra_param };
+ OpenNebula.Action.simple_action(params,
+ OpenNebula.Cluster.resource,
+ "update",
+ action_obj);
+ }
},
"Datastore" : {
"resource" : "DATASTORE",
diff --git a/src/sunstone/public/js/plugins/clusters-tab.js b/src/sunstone/public/js/plugins/clusters-tab.js
index 3b365ea362..4806e58132 100644
--- a/src/sunstone/public/js/plugins/clusters-tab.js
+++ b/src/sunstone/public/js/plugins/clusters-tab.js
@@ -28,6 +28,9 @@ var clusters_tab_content = '\
' + tr("All") + ' | \
' + tr("ID") + ' | \
' + tr("Name") + ' | \
+ ' + tr("Hosts") + ' | \
+ ' + tr("Virtual Networks") + ' | \
+ ' + tr("Datastores") + ' | \
\
\
\
@@ -173,6 +176,37 @@ var cluster_actions = {
error : onError,
notify:true
},
+
+ "Cluster.update" : {
+ type: "single",
+ call: OpenNebula.Cluster.update,
+ callback: function(){
+ notifyMessage(tr("Template updated correctly"));
+ },
+ error: onError
+ },
+
+ "Cluster.fetch_template" : {
+ type: "single",
+ call: OpenNebula.Cluster.fetch_template,
+ callback: function(request,response){
+ $('#template_update_dialog #template_update_textarea').val(response.template);
+ },
+ error: onError
+ },
+
+ "Cluster.update_dialog" : {
+ type: "custom",
+ call: function() {
+ popUpTemplateUpdateDialog("Cluster",
+ makeSelectOptions(dataTable_clusters,
+ 1,//idcol
+ 2,//namecol
+ [],
+ []),
+ clusterElements());
+ },
+ },
};
var cluster_buttons = {
@@ -185,6 +219,11 @@ var cluster_buttons = {
type: "create_dialog",
text: tr("+ New")
},
+ "Cluster.update_dialog" : {
+ type : "action",
+ text : tr("Update properties"),
+ alwaysActive: true
+ },
"Cluster.delete" : {
type: "confirm",
text: tr("Delete")
@@ -343,10 +382,32 @@ function clusterElementArray(element_json){
var element = element_json.CLUSTER;
+ var hosts = 0;
+ if ($.isArray(element.HOSTS.ID))
+ hosts = element.HOSTS.ID.length;
+ else if (!$.isEmptyObject(element.HOSTS.ID))
+ hosts = 1;
+
+ var vnets = 0;
+ if ($.isArray(element.VNETS.ID))
+ vnets = element.VNETS.ID.length;
+ else if (!$.isEmptyObject(element.VNETS.ID))
+ vnets = 1;
+
+ var dss = 0;
+ if ($.isArray(element.DATASTORES.ID))
+ dss = element.DATASTORES.ID.length;
+ else if (!$.isEmptyObject(element.DATASTORES.ID))
+ dss = 1;
+
+
return [
'',
element.ID,
element.NAME,
+ hosts,
+ vnets,
+ dss
];
}
@@ -929,7 +990,7 @@ $(document).ready(function(){
"aoColumnDefs": [
{ "bSortable": false, "aTargets": ["check"] },
{ "sWidth": "60px", "aTargets": [0] },
- { "sWidth": "35px", "aTargets": [1] },
+ { "sWidth": "35px", "aTargets": [1,3,4,5] },
],
"oLanguage": (datatable_lang != "") ?
{
@@ -941,8 +1002,8 @@ $(document).ready(function(){
dataTable_clusters.fnClearTable();
addElement([
spinner,
- '','',''],dataTable_clusters);
-// Sunstone.runAction("Cluster.list");
+ '','','','',''],dataTable_clusters);
+ Sunstone.runAction("Cluster.list");
setupCreateClusterDialog();
diff --git a/src/sunstone/public/js/sunstone-util.js b/src/sunstone/public/js/sunstone-util.js
index e5970d40d4..a000052cf1 100644
--- a/src/sunstone/public/js/sunstone-util.js
+++ b/src/sunstone/public/js/sunstone-util.js
@@ -734,7 +734,7 @@ function setupTemplateUpdateDialog(){
autoOpen:false,
width:700,
modal:true,
- height:410,
+ height:430,
resizable:false,
});