mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Bug #1306: Sunstone: Add template update possibility to Clusters.
(cherry picked from commit 43b8b659a03db56f5e004cc51a88c727765570c4)
This commit is contained in:
parent
31601aa41b
commit
38f6167f15
@ -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
|
||||
|
@ -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",
|
||||
|
@ -28,6 +28,9 @@ var clusters_tab_content = '\
|
||||
<th class="check"><input type="checkbox" class="check_all" value="">' + tr("All") + '</input></th>\
|
||||
<th>' + tr("ID") + '</th>\
|
||||
<th>' + tr("Name") + '</th>\
|
||||
<th>' + tr("Hosts") + '</th>\
|
||||
<th>' + tr("Virtual Networks") + '</th>\
|
||||
<th>' + tr("Datastores") + '</th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody id="tbodyclusters">\
|
||||
@ -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 [
|
||||
'<input class="check_item" type="checkbox" id="cluster_'+element.ID+'" name="selected_items" value="'+element.ID+'"/>',
|
||||
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();
|
||||
|
||||
|
@ -734,7 +734,7 @@ function setupTemplateUpdateDialog(){
|
||||
autoOpen:false,
|
||||
width:700,
|
||||
modal:true,
|
||||
height:410,
|
||||
height:430,
|
||||
resizable:false,
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user