mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-21 04:12:37 +09:00
appflow: Improve sunstone integration and remove old code
This commit is contained in:
1 parent
6218ee353a
commit
dbdaafc61e
2 files changed
+156
-744
No files matched your search
@@ -137,107 +137,8 @@ var service_tab_content = '\
|
||||
</div>\
|
||||
</form>';
|
||||
|
||||
/*+++++++++++++++++++++++++++++++
|
||||
var create_service_tmpl = '\
|
||||
<div class="create_form"><form id="create_service_form" action="">\
|
||||
<fieldset>\
|
||||
<legend style="display:none;">' + tr("Flowironment") + '</legend>\
|
||||
<div class="service_param">\
|
||||
<label for="name">' + tr("Name") + ':</label><input type="text" name="name" />\
|
||||
</div>\
|
||||
<div class="service_param">\
|
||||
<label for="description">' + tr("Description") + ':</label><input type="text" name="description" />\
|
||||
</div>\
|
||||
<div class="service_param">\
|
||||
<label for="templates">'+tr("Compatible templates")+':</label>\
|
||||
<select type="text" name="templates" multiple>\
|
||||
</select>\
|
||||
</div>\
|
||||
<div class="service_param">\
|
||||
<label for="cookbooks">' + tr("Cookbooks URL") + ':</label><input type="text" name="cookbooks" />\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
<!--\
|
||||
<fieldset>\
|
||||
<div class="service_param">\
|
||||
<label for="node">'+tr("Variables")+':</label>\
|
||||
<div class="clear"></div>\
|
||||
<label for="custom_var_service_name">'+tr("Name")+':</label>\
|
||||
<input type="text" id="custom_var_service_name" name="custom_var_service_name" /><br />\
|
||||
<label for="custom_var_service_value">'+tr("Value")+':</label>\
|
||||
<input type="text" id="custom_var_service_value" name="custom_var_service_value" /><br />\
|
||||
<button class="add_remove_button add_button" id="add_custom_var_service_button" value="add_custom_service_var">'+tr("Add")+'</button>\
|
||||
<button class="add_remove_button" id="remove_custom_var_service_button" value="remove_custom_service_var">'+tr("Remove selected")+'</button>\
|
||||
<div class="clear"></div>\
|
||||
<label for="custom_var_service_box">'+tr("Custom attributes")+':</label>\
|
||||
<select id="custom_var_service_box" name="custom_var_service_box" style="height:100px;" multiple>\
|
||||
</select>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
-->\
|
||||
<fieldset>\
|
||||
<div class="service_param">\
|
||||
<label for="node">'+tr("Node")+':</label>\
|
||||
<div class="clear"></div>\
|
||||
<textarea name="node" style="width:100%; height:14em;"></textarea>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="form_buttons">\
|
||||
<div><button class="button" type="submit" value="Service.create">' + tr("Create") + '</button>\
|
||||
<button class="button" type="reset" value="reset">' + tr("Reset") + '</button></div>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</form></div>';
|
||||
*/
|
||||
|
||||
|
||||
var update_service_tmpl =
|
||||
'<form action="javascript:alert(\'js error!\');">\
|
||||
<h3 style="margin-bottom:10px;">'+tr("Please, choose and modify the service")+':</h3>\
|
||||
<fieldset style="border-top:none;">\
|
||||
<label for="service_update_select">'+tr("Select a template")+':</label>\
|
||||
<select id="service_update_select" name="service_update_select"></select>\
|
||||
<div class="clear"></div>\
|
||||
<div>\
|
||||
<table class="permissions_table" style="padding:0 10px;">\
|
||||
<thead><tr>\
|
||||
<td style="width:130px">'+tr("Permissions")+':</td>\
|
||||
<td style="width:40px;text-align:center;">'+tr("Use")+'</td>\
|
||||
<td style="width:40px;text-align:center;">'+tr("Manage")+'</td>\
|
||||
<td style="width:40px;text-align:center;">'+tr("Admin")+'</td></tr></thead>\
|
||||
<tr>\
|
||||
<td>'+tr("Owner")+'</td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="serv_owner_u" class="owner_u" /></td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="serv_owner_m" class="owner_m" /></td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="serv_owner_a" class="owner_a" /></td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td>'+tr("Group")+'</td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="serv_group_u" class="group_u" /></td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="serv_group_m" class="group_m" /></td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="serv_group_a" class="group_a" /></td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td>'+tr("Other")+'</td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="serv_other_u" class="other_u" /></td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="serv_other_m" class="other_m" /></td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="serv_other_a" class="other_a" /></td>\
|
||||
</tr>\
|
||||
</table>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="form_buttons">\
|
||||
<button class="button" id="service_update_button" value="Service.update_template">\
|
||||
'+tr("Update")+'\
|
||||
</button>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</form>';
|
||||
|
||||
var dataTable_services;
|
||||
//var $create_service_dialog;
|
||||
|
||||
var service_actions = {
|
||||
"Service.list" : {
|
||||
@@ -314,17 +215,6 @@ var service_actions = {
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Service.fetch_permissions" : {
|
||||
type : "single",
|
||||
call : Service.show,
|
||||
callback : function(request, json){
|
||||
var dialog = $('#service_update_dialog form');
|
||||
var tmpl = json.DOCUMENT;
|
||||
setPermissionsTable(tmpl, dialog);
|
||||
},
|
||||
error: onError
|
||||
},
|
||||
|
||||
"Service.shutdown" : {
|
||||
type: "multiple",
|
||||
call: Service.shutdown,
|
||||
@@ -332,27 +222,6 @@ var service_actions = {
|
||||
error: onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
/*
|
||||
"Service.clone_dialog" : {
|
||||
type: "custom",
|
||||
call: popUpServiceCloneDialog
|
||||
},
|
||||
"Service.clone" : {
|
||||
type: "single",
|
||||
call: Service.clone,
|
||||
error: onError,
|
||||
notify: true
|
||||
},
|
||||
*/
|
||||
|
||||
"Service.help" : {
|
||||
type: "custom",
|
||||
call: function() {
|
||||
hideDialog();
|
||||
$('div#services_tab div.legend_div').slideToggle();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -379,12 +248,6 @@ var service_buttons = {
|
||||
layout: "user_select",
|
||||
condition: mustBeAdmin
|
||||
},
|
||||
/*
|
||||
"Service.clone_dialog" : {
|
||||
type: "action",
|
||||
text: tr("Clone")
|
||||
},
|
||||
*/
|
||||
"Service.shutdown" : {
|
||||
type: "action",
|
||||
layout: "main",
|
||||
@@ -425,10 +288,7 @@ function serviceElements() {
|
||||
// Returns an array containing the values of the service_json and ready
|
||||
// to be inserted in the dataTable
|
||||
function serviceElementArray(service_json){
|
||||
//Changing this? It may affect to the is_persistent() functions.
|
||||
var service = service_json.DOCUMENT;
|
||||
//var body = JSON.parse(service.TEMPLATE.BODY);
|
||||
//var description = body.description;
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="service_'+service.ID+'" name="selected_items" value="'+service.ID+'"/>',
|
||||
@@ -486,41 +346,46 @@ function updateServiceVMInfo(vmachine_list){
|
||||
function updateServiceInfo(request,elem){
|
||||
var elem_info = elem.DOCUMENT;
|
||||
|
||||
/*
|
||||
elem_info.TEMPLATE.BODY = JSON.parse(elem_info.TEMPLATE.BODY);
|
||||
|
||||
// Form trs for variables
|
||||
var vars = '';
|
||||
var defaults = elem_info.TEMPLATE.BODY.defaults;
|
||||
if (!$.isEmptyObject(defaults)){
|
||||
for (key in defaults){
|
||||
vars += '<tr>\
|
||||
<td class="key_td">'+ key +'</td>\
|
||||
<td class="value_td">\
|
||||
<input type="text" name="'+ key +'"value="'+ defaults[key] +'"></input>\
|
||||
</td></tr>';
|
||||
};
|
||||
}
|
||||
var roles_info = '<table id="service_template_roles_table" class="twelve datatable extended_table">\
|
||||
<thead>\
|
||||
<tr><th colspan="2">'+tr("Roles")+'</th></tr>\
|
||||
</thead>'
|
||||
|
||||
// Form options of compatible templates
|
||||
var compat_templates = '';
|
||||
var templates = elem_info.TEMPLATE.BODY.templates;
|
||||
if (templates)
|
||||
for (var i = 0; i < templates.length; i++)
|
||||
compat_templates += '<option value="'+ templates[i] +'">\
|
||||
'+ getTemplateName(templates[i]) +'\
|
||||
</option>';
|
||||
*/
|
||||
var roles = elem_info.TEMPLATE.BODY.roles
|
||||
if (roles && roles.length)
|
||||
for (var i = 0; i < roles.length; i++) {
|
||||
roles_info += '<tr><td colspan="2">'+roles[i].name+'</td></tr>\
|
||||
<tr>\
|
||||
<td> '+tr("State")+'</td>\
|
||||
<td class="value_td">'+Role.state(roles[i].state)+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td> '+tr("Cardinality")+'</td>\
|
||||
<td class="value_td">'+roles[i].cardinality+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td> '+tr("VM Template")+'</td>\
|
||||
<td class="value_td">'+roles[i].vm_template+'</td>\
|
||||
</tr>'
|
||||
|
||||
if (roles[i].parents)
|
||||
roles_info += '<tr>\
|
||||
<td > '+tr("Parents")+'</td>\
|
||||
<td class="value_td">'+roles[i].parents.join(', ')+'</td>\
|
||||
</tr>'
|
||||
}
|
||||
|
||||
roles_info += '</table>'
|
||||
|
||||
var info_tab = {
|
||||
title: tr("Information"),
|
||||
content:
|
||||
'<table id="info_template_table" class="info_table" style="width:80%">\
|
||||
'<div class="">\
|
||||
<div class="six columns">\
|
||||
<table id="info_template_table" class="twelve datatable extended_table">\
|
||||
<thead>\
|
||||
<tr><th colspan="2">'+tr("Service")+' \"'+elem_info.NAME+'\" '+
|
||||
tr("information")+'</th></tr>\
|
||||
<tr><th colspan="2">'+tr("Service Template")+' \"'+elem_info.NAME+'\"'+'</th></tr>\
|
||||
</thead>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("ID")+'</td>\
|
||||
@@ -530,111 +395,70 @@ function updateServiceInfo(request,elem){
|
||||
<td class="key_td">'+tr("Name")+'</td>\
|
||||
<td class="value_td">'+elem_info.NAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("State")+'</td>\
|
||||
<td class="value_td">'+ Service.state(elem_info.TEMPLATE.BODY.state) +'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Owner")+'</td>\
|
||||
<td class="value_td">'+elem_info.UNAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Group")+'</td>\
|
||||
<td class="value_td">'+elem_info.GNAME+'</td>\
|
||||
</tr>\
|
||||
<tr><td class="key_td">'+tr("Permissions")+'</td><td></td></tr>\
|
||||
<tr>\
|
||||
<td class="key_td"> '+tr("Owner")+'</td>\
|
||||
<td class="value_td" style="font-family:monospace;">'+ownerPermStr(elem_info)+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td"> '+tr("Group")+'</td>\
|
||||
<td class="value_td" style="font-family:monospace;">'+groupPermStr(elem_info)+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td"> '+tr("Other")+'</td>\
|
||||
<td class="value_td" style="font-family:monospace;">'+otherPermStr(elem_info)+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Strategy")+'</td>\
|
||||
<td class="value_td">'+elem_info.TEMPLATE.BODY.deployment+'</td>\
|
||||
</tr>\
|
||||
</table>'
|
||||
}
|
||||
|
||||
var roles_info = '<table id="service_template_roles_table" class="info_table" style="width:80%;">\
|
||||
<thead></thead>'
|
||||
|
||||
var roles = elem_info.TEMPLATE.BODY.roles
|
||||
if (roles && roles.length)
|
||||
for (var i = 0; i < roles.length; i++) {
|
||||
roles_info += '<tr><td class="key_td">'+tr("Role")+' '+roles[i].name+'</td><td></td></tr>\
|
||||
<tr>\
|
||||
<td> '+tr("State")+'</td>\
|
||||
<td class="value_td" style="font-family:monospace;">'+Role.state(roles[i].state)+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td> '+tr("Cardinality")+'</td>\
|
||||
<td class="value_td" style="font-family:monospace;">'+roles[i].cardinality+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td> '+tr("VM Template")+'</td>\
|
||||
<td class="value_td" style="font-family:monospace;">'+roles[i].vm_template+'</td>\
|
||||
</tr>'
|
||||
|
||||
if (roles[i].parents)
|
||||
roles_info += '<tr>\
|
||||
<td > '+tr("Parents")+'</td>\
|
||||
<td class="value_td" style="font-family:monospace;">'+roles[i].parents.join(', ')+'</td>\
|
||||
</tr>'
|
||||
}
|
||||
|
||||
roles_info += '</table>'
|
||||
|
||||
var roles_tab = {
|
||||
title: tr("Roles"),
|
||||
content: roles_info
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("State")+'</td>\
|
||||
<td class="value_td">'+ Service.state(elem_info.TEMPLATE.BODY.state) +'</td>\
|
||||
</tr>\
|
||||
</table>' +
|
||||
roles_info +
|
||||
'</div>\
|
||||
<div class="six columns">' + insert_permissions_table('apptools-appflow-services',
|
||||
"Service",
|
||||
elem_info.ID,
|
||||
elem_info.UNAME,
|
||||
elem_info.GNAME,
|
||||
elem_info.UID,
|
||||
elem_info.GID) +
|
||||
'</div>\
|
||||
</div>'
|
||||
}
|
||||
|
||||
var vms_tab = {
|
||||
title : "Virtual Machines",
|
||||
content : '\
|
||||
<div style="padding: 10px 10px;">\
|
||||
<table id="datatable_service_vms" class="display">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
<th>'+tr("Role")+'</th>\
|
||||
<th>'+tr("ID")+'</th>\
|
||||
<th>'+tr("Owner")+'</th>\
|
||||
<th>'+tr("Group")+'</th>\
|
||||
<th>'+tr("Name")+'</th>\
|
||||
<th>'+tr("Status")+'</th>\
|
||||
<th>'+tr("Used CPU")+'</th>\
|
||||
<th>'+tr("Used Memory")+'</th>\
|
||||
<th>'+tr("Host")+'</th>\
|
||||
<th>'+tr("IPs")+'</th>\
|
||||
<th>'+tr("Start Time")+'</th>\
|
||||
<th>'+tr("VNC Access")+'</th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody>\
|
||||
</tbody>\
|
||||
</table></div>'
|
||||
content : '<div class="columns twelve">\
|
||||
<div id="datatable_cluster_hosts_info_div">\
|
||||
<table id="datatable_service_vms" class="table twelve">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
<th>'+tr("Role")+'</th>\
|
||||
<th>'+tr("ID")+'</th>\
|
||||
<th>'+tr("Owner")+'</th>\
|
||||
<th>'+tr("Group")+'</th>\
|
||||
<th>'+tr("Name")+'</th>\
|
||||
<th>'+tr("Status")+'</th>\
|
||||
<th>'+tr("Used CPU")+'</th>\
|
||||
<th>'+tr("Used Memory")+'</th>\
|
||||
<th>'+tr("Host")+'</th>\
|
||||
<th>'+tr("IPs")+'</th>\
|
||||
<th>'+tr("Start Time")+'</th>\
|
||||
<th>'+tr("VNC")+'</th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody>\
|
||||
</tbody>\
|
||||
</table>\
|
||||
</div>'
|
||||
};
|
||||
|
||||
var logs = elem_info.TEMPLATE.BODY.log
|
||||
var log_info = ''
|
||||
if (logs) {
|
||||
log_info += '<table id="service_template_roles_table" class="info_table" style="width:80%;">\
|
||||
<thead></thead>'
|
||||
log_info += '<div class="twelve columns"><div class="log-tab">'
|
||||
|
||||
for (var i = 0; i < logs.length; i++) {
|
||||
log_info += '<tr>\
|
||||
<td>'+pretty_time(logs[i].timestamp)+' ['+logs[i].severity + '] ' + logs[i].message+ '</td>\
|
||||
</tr>'
|
||||
var line = pretty_time(logs[i].timestamp)+' ['+logs[i].severity + '] ' + logs[i].message+ '<br>';
|
||||
if (logs[i].severity == 'E'){
|
||||
line = '<span class="vm_log_error">'+line+'</span>';
|
||||
}
|
||||
|
||||
log_info += line;
|
||||
}
|
||||
|
||||
log_info += '</table>'
|
||||
log_info += '</div></div>'
|
||||
}
|
||||
|
||||
var logs_tab = {
|
||||
@@ -648,14 +472,10 @@ function updateServiceInfo(request,elem){
|
||||
Sunstone.updateInfoPanelTab("service_info_panel",
|
||||
"service_info_tab",info_tab);
|
||||
if (roles.length){
|
||||
Sunstone.addInfoPanelTab("service_info_panel",
|
||||
"service_role_tab",roles_tab);
|
||||
Sunstone.updateInfoPanelTab("service_info_panel",
|
||||
"service_vms_tab",vms_tab);
|
||||
}
|
||||
else {
|
||||
Sunstone.removeInfoPanelTab("service_info_panel",
|
||||
"service_role_tab");
|
||||
Sunstone.removeInfoPanelTab("service_info_panel",
|
||||
"service_vms_tab");
|
||||
};
|
||||
@@ -664,7 +484,13 @@ function updateServiceInfo(request,elem){
|
||||
"service_log_tab",logs_tab);
|
||||
|
||||
// Popup panel
|
||||
Sunstone.popUpInfoPanel("service_info_panel");
|
||||
Sunstone.popUpInfoPanel("service_info_panel", "apptools-appflow-services");
|
||||
setPermissionsTable(elem_info,'');
|
||||
|
||||
$("#service_info_panel_refresh", $("#service_info_panel")).click(function(){
|
||||
$(this).html(spinner);
|
||||
Sunstone.runAction('Service.showinfo', elem_info.ID);
|
||||
})
|
||||
|
||||
if (!roles.length) return;
|
||||
|
||||
@@ -683,11 +509,9 @@ function updateServiceInfo(request,elem){
|
||||
};
|
||||
|
||||
var servicevmsDataTable = $('#datatable_service_vms').dataTable({
|
||||
"bJQueryUI": true,
|
||||
"bSortClasses": false,
|
||||
"sPaginationType": "full_numbers",
|
||||
"bAutoWidth":false,
|
||||
"sDom" : '<"H"lfrC>t<"F"ip>',
|
||||
"sDom" : '<"H">t<"F"p>',
|
||||
"aoColumnDefs": [
|
||||
{ "sWidth": "60px", "aTargets": [6,7] },
|
||||
{ "sWidth": "35px", "aTargets": [1, 11] },
|
||||
@@ -700,206 +524,39 @@ function updateServiceInfo(request,elem){
|
||||
updateView(vms, servicevmsDataTable);
|
||||
|
||||
|
||||
$('tbody tr',servicevmsDataTable).click(function(e){
|
||||
var aData = servicevmsDataTable.fnGetData(this);
|
||||
var id = aData[1];
|
||||
if (!id) return true;
|
||||
if ($(e.target).is('img')) return true;
|
||||
//$('tbody tr',servicevmsDataTable).click(function(e){
|
||||
// var aData = servicevmsDataTable.fnGetData(this);
|
||||
// var id = aData[1];
|
||||
// if (!id) return true;
|
||||
// if ($(e.target).is('img')) return true;
|
||||
//
|
||||
// //open the Vresources submenu in case it was closed
|
||||
// var vres_menu = $('div#menu li#li_vres_tab')
|
||||
// $('li.vres_tab', vres_menu.parent()).fadeIn('fast');
|
||||
// $('span', vres_menu).removeClass('ui-icon-circle-plus');
|
||||
// $('span', vres_menu).addClass('ui-icon-circle-minus');
|
||||
//
|
||||
// showTab('vms_tab');
|
||||
//
|
||||
// popDialogLoading();
|
||||
// Sunstone.runAction("VM.showinfo", id)
|
||||
// return false;
|
||||
//});
|
||||
|
||||
//open the Vresources submenu in case it was closed
|
||||
var vres_menu = $('div#menu li#li_vres_tab')
|
||||
$('li.vres_tab', vres_menu.parent()).fadeIn('fast');
|
||||
$('span', vres_menu).removeClass('ui-icon-circle-plus');
|
||||
$('span', vres_menu).addClass('ui-icon-circle-minus');
|
||||
|
||||
showTab('vms_tab');
|
||||
|
||||
popDialogLoading();
|
||||
Sunstone.runAction("VM.showinfo", id)
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function setupServiceUpdateDialog(){
|
||||
//Append to DOM
|
||||
dialogs_context.append('<div id="service_update_dialog" title="'+tr("Update Service properties")+'"></div>');
|
||||
var dialog = $('#service_update_dialog', dialogs_context);
|
||||
|
||||
//Put HTML in place
|
||||
dialog.html(update_service_tmpl);
|
||||
|
||||
var height = Math.floor($(window).height()*0.8); //set height to a percentage of the window
|
||||
|
||||
//Convert into jQuery
|
||||
dialog.addClass("reveal-modal xlarge");
|
||||
|
||||
|
||||
$('#service_update_select',dialog).change(function(){
|
||||
var id = $(this).val();
|
||||
$('.permissions_table input', dialog).removeAttr('checked');
|
||||
$('.permissions_table', dialog).removeAttr('update');
|
||||
if (id && id.length){
|
||||
Sunstone.runAction("Service.fetch_permissions", id);
|
||||
};
|
||||
});
|
||||
|
||||
$('.permissions_table input',dialog).change(function(){
|
||||
$(this).parents('table').attr('update','update');
|
||||
});
|
||||
|
||||
$('form',dialog).submit(function(){
|
||||
var dialog = $(this);
|
||||
var id = $('#service_update_select',dialog).val();
|
||||
if (!id || !id.length) {
|
||||
$(this).parents('#service_update_dialog').trigger("reveal:close")
|
||||
return false;
|
||||
};
|
||||
|
||||
var permissions = $('.permissions_table',dialog);
|
||||
if (permissions.attr('update')){
|
||||
var perms = {
|
||||
octet : buildOctet(permissions)
|
||||
};
|
||||
Sunstone.runAction("Service.chmod", id, perms);
|
||||
};
|
||||
|
||||
$(this).parents('#service_update_dialog').trigger("reveal:close")
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function popUpServiceUpdateDialog(){
|
||||
var select = makeSelectOptions(dataTable_services,
|
||||
1,//id_col
|
||||
4,//name_col
|
||||
[],
|
||||
[]
|
||||
);
|
||||
var sel_elems = getSelectedNodes(dataTable_services);
|
||||
|
||||
|
||||
var dialog = $('#service_update_dialog');
|
||||
$('#service_update_select', dialog).html(select);
|
||||
// $('#service_update_textarea',dialog).val("");
|
||||
$('.permissions_table input', dialog).removeAttr('checked');
|
||||
$('.permissions_table', dialog).removeAttr('update');
|
||||
|
||||
if (sel_elems.length >= 1){ //several items in the list are selected
|
||||
//grep them
|
||||
var new_select= sel_elems.length > 1? '<option value="">Please select</option>' : "";
|
||||
$('option','<select>'+select+'</select>').each(function(){
|
||||
var val = $(this).val();
|
||||
if ($.inArray(val,sel_elems) >= 0){
|
||||
new_select+='<option value="'+val+'">'+$(this).text()+'</option>';
|
||||
};
|
||||
});
|
||||
$('#service_update_select', dialog).html(new_select);
|
||||
if (sel_elems.length == 1) {
|
||||
$('#service_update_select option',
|
||||
dialog).attr('selected','selected');
|
||||
$('#service_update_select', dialog).trigger("change");
|
||||
};
|
||||
};
|
||||
|
||||
dialog.reveal();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Set the autorefresh interval for the datatable
|
||||
function setServiceAutorefresh() {
|
||||
setInterval(function(){
|
||||
var checked = $('input.check_item:checked',dataTable_services);
|
||||
var filter = $("#datatable_services_filter input",
|
||||
dataTable_services.parents("#datatable_services_wrapper")).attr('value');
|
||||
if (!checked.length && !filter.length){
|
||||
var filter = $("#services_search").attr('value');
|
||||
if ((checked.length==0) && !filter){
|
||||
Sunstone.runAction("Service.autorefresh");
|
||||
}
|
||||
},INTERVAL+someTime());
|
||||
};
|
||||
|
||||
/*
|
||||
function setupServiceCloneDialog(){
|
||||
//Append to DOM
|
||||
dialogs_context.append('<div id="service_clone_dialog" title="'+tr("Clone an flowironment")+'"></div>');
|
||||
var dialog = $('#service_clone_dialog',dialogs_context);
|
||||
|
||||
//Put HTML in place
|
||||
|
||||
var html = '<form><fieldset>\
|
||||
<div class="clone_one">'+tr("Choose a new name for the flowironment")+':</div>\
|
||||
<div class="clone_several">'+tr("Several flowironments are selected, please choose prefix to name the new copies")+':</div>\
|
||||
<br />\
|
||||
<label class="clone_one">'+tr("Name")+':</label>\
|
||||
<label class="clone_several">'+tr("Prefix")+':</label>\
|
||||
<input type="text" name="name"></input>\
|
||||
<div class="form_buttons">\
|
||||
<button class="button" id="service_clone_button" value="Service.clone">\
|
||||
'+tr("Clone")+'\
|
||||
</button>\
|
||||
</div></fieldset></form>\
|
||||
';
|
||||
|
||||
dialog.html(html);
|
||||
|
||||
//Convert into jQuery
|
||||
dialog.dialog({
|
||||
autoOpen:false,
|
||||
width:375,
|
||||
modal:true,
|
||||
resizable:false
|
||||
});
|
||||
|
||||
$('button',dialog).button();
|
||||
|
||||
$('form',dialog).submit(function(){
|
||||
var name = $('input', this).val();
|
||||
var sel_elems = serviceElements();
|
||||
if (!name || !sel_elems.length)
|
||||
notifyError('A name or prefix is needed!');
|
||||
if (sel_elems.length > 1){
|
||||
for (var i=0; i< sel_elems.length; i++)
|
||||
//If we are cloning several items we
|
||||
//use the name as prefix
|
||||
Sunstone.runAction('Service.clone',
|
||||
sel_elems[i],
|
||||
name + getName(sel_elems[i],
|
||||
dataTable_services,
|
||||
4));
|
||||
} else {
|
||||
Sunstone.runAction('Service.clone',sel_elems[0],name)
|
||||
};
|
||||
dialog.dialog('close');
|
||||
setTimeout(function(){
|
||||
Sunstone.runAction('Service.refresh');
|
||||
}, 1500);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function popUpServiceCloneDialog(){
|
||||
var dialog = $('#service_clone_dialog');
|
||||
var sel_elems = serviceElements();
|
||||
//show different text depending on how many elements are selected
|
||||
if (sel_elems.length > 1){
|
||||
$('.clone_one',dialog).hide();
|
||||
$('.clone_several',dialog).show();
|
||||
$('input',dialog).val('Copy of ');
|
||||
}
|
||||
else {
|
||||
$('.clone_one',dialog).show();
|
||||
$('.clone_several',dialog).hide();
|
||||
$('input',dialog).val('Copy of '+getName(sel_elems[0],
|
||||
dataTable_services, 4));
|
||||
};
|
||||
|
||||
$(dialog).dialog('open');
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
//The DOM is ready at this point
|
||||
$(document).ready(function(){
|
||||
|
||||
@@ -923,14 +580,9 @@ $(document).ready(function(){
|
||||
|
||||
Sunstone.runAction("Service.list");
|
||||
|
||||
setupServiceUpdateDialog();
|
||||
|
||||
// setupImageCloneDialog();
|
||||
setServiceAutorefresh();
|
||||
|
||||
initCheckAllBoxes(dataTable_services);
|
||||
tableCheckboxesListener(dataTable_services);
|
||||
infoListener(dataTable_services,'Service.showinfo');
|
||||
|
||||
$('div#services_tab div.legend_div').hide();
|
||||
});
|
||||
@@ -225,50 +225,6 @@ var create_service_template_tmpl = '\
|
||||
</div>';
|
||||
|
||||
|
||||
var update_service_template_tmpl =
|
||||
'<form action="javascript:alert(\'js error!\');">\
|
||||
<h3 style="margin-bottom:10px;">'+tr("Please, choose and modify the service template")+':</h3>\
|
||||
<fieldset style="border-top:none;">\
|
||||
<label for="service_template_update_select">'+tr("Select a template")+':</label>\
|
||||
<select id="service_template_update_select" name="service_template_update_select"></select>\
|
||||
<div class="clear"></div>\
|
||||
<div>\
|
||||
<table class="permissions_table" style="padding:0 10px;">\
|
||||
<thead><tr>\
|
||||
<td style="width:130px">'+tr("Permissions")+':</td>\
|
||||
<td style="width:40px;text-align:center;">'+tr("Use")+'</td>\
|
||||
<td style="width:40px;text-align:center;">'+tr("Manage")+'</td>\
|
||||
<td style="width:40px;text-align:center;">'+tr("Admin")+'</td></tr></thead>\
|
||||
<tr>\
|
||||
<td>'+tr("Owner")+'</td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="st_owner_u" class="owner_u" /></td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="st_owner_m" class="owner_m" /></td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="st_owner_a" class="owner_a" /></td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td>'+tr("Group")+'</td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="st_group_u" class="group_u" /></td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="st_group_m" class="group_m" /></td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="st_group_a" class="group_a" /></td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td>'+tr("Other")+'</td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="st_other_u" class="other_u" /></td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="st_other_m" class="other_m" /></td>\
|
||||
<td style="text-align:center"><input type="checkbox" name="st_other_a" class="other_a" /></td>\
|
||||
</tr>\
|
||||
</table>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="form_buttons">\
|
||||
<button class="button" id="service_template_update_button" value="ServiceTemplate.update_template">\
|
||||
'+tr("Update")+'\
|
||||
</button>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</form>';
|
||||
|
||||
var dataTable_service_templates;
|
||||
var $create_service_template_dialog;
|
||||
|
||||
@@ -293,11 +249,6 @@ var service_template_actions = {
|
||||
call: popUpCreateServiceTemplateDialog
|
||||
},
|
||||
|
||||
"ServiceTemplate.update_dialog" : {
|
||||
type : "custom",
|
||||
call : popUpServiceTemplateUpdateDialog
|
||||
},
|
||||
|
||||
"ServiceTemplate.list" : {
|
||||
type: "list",
|
||||
call: ServiceTemplate.list,
|
||||
@@ -380,28 +331,6 @@ var service_template_actions = {
|
||||
notify: true
|
||||
},
|
||||
|
||||
"ServiceTemplate.fetch_permissions" : {
|
||||
type : "single",
|
||||
call : ServiceTemplate.show,
|
||||
callback : function(request, json){
|
||||
var dialog = $('#service_template_update_dialog form');
|
||||
var tmpl = json.DOCUMENT;
|
||||
setPermissionsTable(tmpl, dialog);
|
||||
},
|
||||
error: onError
|
||||
},
|
||||
/*
|
||||
"ServiceTemplate.clone_dialog" : {
|
||||
type: "custom",
|
||||
call: popUpServiceTemplateCloneDialog
|
||||
},
|
||||
"ServiceTemplate.clone" : {
|
||||
type: "single",
|
||||
call: ServiceTemplate.clone,
|
||||
error: onError,
|
||||
notify: true
|
||||
},
|
||||
*/
|
||||
"ServiceTemplate.help" : {
|
||||
type: "custom",
|
||||
call: function() {
|
||||
@@ -423,13 +352,6 @@ var service_template_buttons = {
|
||||
layout: "create"
|
||||
},
|
||||
|
||||
"ServiceTemplate.update_dialog" : {
|
||||
type: "action",
|
||||
text: tr("Update"),
|
||||
layout: "main",
|
||||
alwaysActive: true
|
||||
},
|
||||
|
||||
"ServiceTemplate.instantiate" : {
|
||||
type: "action",
|
||||
layout: "main",
|
||||
@@ -451,12 +373,7 @@ var service_template_buttons = {
|
||||
tip: tr("Select the new group")+":",
|
||||
condition: mustBeAdmin
|
||||
},
|
||||
/*
|
||||
"ServiceTemplate.clone_dialog" : {
|
||||
type: "action",
|
||||
text: tr("Clone")
|
||||
},
|
||||
*/
|
||||
|
||||
"ServiceTemplate.delete" : {
|
||||
type: "confirm",
|
||||
text: tr("Delete"),
|
||||
@@ -492,10 +409,7 @@ function serviceTemplateElements() {
|
||||
// Returns an array containing the values of the service_template_json and ready
|
||||
// to be inserted in the dataTable
|
||||
function serviceTemplateElementArray(service_template_json){
|
||||
//Changing this? It may affect to the is_persistent() functions.
|
||||
var service_template = service_template_json.DOCUMENT;
|
||||
//var body = JSON.parse(service_template.TEMPLATE.BODY);
|
||||
//var description = body.description;
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="service_template_'+service_template.ID+'" name="selected_items" value="'+service_template.ID+'"/>',
|
||||
@@ -503,7 +417,6 @@ function serviceTemplateElementArray(service_template_json){
|
||||
service_template.UNAME,
|
||||
service_template.GNAME,
|
||||
service_template.NAME
|
||||
// description ? description : tr("None")
|
||||
];
|
||||
}
|
||||
|
||||
@@ -541,39 +454,42 @@ function updateServiceTemplatesView(request, service_templates_list){
|
||||
// Callback to update the information panel tabs and pop it up
|
||||
function updateServiceTemplateInfo(request,elem){
|
||||
var elem_info = elem.DOCUMENT;
|
||||
/*
|
||||
// Form trs for variables
|
||||
var vars = '';
|
||||
var defaults = elem_info.TEMPLATE.BODY.defaults;
|
||||
if (!$.isEmptyObject(defaults)){
|
||||
for (key in defaults){
|
||||
vars += '<tr>\
|
||||
<td class="key_td">'+ key +'</td>\
|
||||
<td class="value_td">\
|
||||
<input type="text" name="'+ key +'"value="'+ defaults[key] +'"></input>\
|
||||
</td></tr>';
|
||||
};
|
||||
}
|
||||
|
||||
// Form options of compatible templates
|
||||
var compat_templates = '';
|
||||
var templates = elem_info.TEMPLATE.BODY.templates;
|
||||
if (templates)
|
||||
for (var i = 0; i < templates.length; i++)
|
||||
compat_templates += '<option value="'+ templates[i] +'">\
|
||||
'+ getTemplateName(templates[i]) +'\
|
||||
</option>';
|
||||
var roles_info = '<table id="service_template_roles_table" class="twelve datatable extended_table">\
|
||||
<thead>\
|
||||
<tr><th colspan="2">'+tr("Roles")+'</th></tr>\
|
||||
</thead>'
|
||||
|
||||
var roles = elem_info.TEMPLATE.BODY.roles
|
||||
if (roles && roles.length > 0)
|
||||
for (var i = 0; i < roles.length; i++) {
|
||||
roles_info += '<tr><td colspan="2">'+roles[i].name+'</td></tr>\
|
||||
<tr>\
|
||||
<td> '+tr("Cardinality")+'</td>\
|
||||
<td class="value_td">'+roles[i].cardinality+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td> '+tr("VM Template")+'</td>\
|
||||
<td class="value_td">'+roles[i].vm_template+'</td>\
|
||||
</tr>'
|
||||
|
||||
*/
|
||||
if (roles[i].parents)
|
||||
roles_info += '<tr>\
|
||||
<td > '+tr("Parents")+'</td>\
|
||||
<td class="value_td">'+roles[i].parents.join(', ')+'</td>\
|
||||
</tr>'
|
||||
}
|
||||
|
||||
roles_info += '</table>'
|
||||
|
||||
var info_tab = {
|
||||
title: tr("Information"),
|
||||
content:
|
||||
'<table id="info_template_table" class="info_table" style="width:80%">\
|
||||
'<div class="">\
|
||||
<div class="six columns">\
|
||||
<table id="info_template_table" class="twelve datatable extended_table">\
|
||||
<thead>\
|
||||
<tr><th colspan="2">'+tr("Service Template")+' \"'+elem_info.NAME+'\" '+
|
||||
tr("information")+'</th></tr>\
|
||||
<tr><th colspan="2">'+tr("Service Template")+' \"'+elem_info.NAME+'\"'+'</th></tr>\
|
||||
</thead>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("ID")+'</td>\
|
||||
@@ -583,81 +499,33 @@ function updateServiceTemplateInfo(request,elem){
|
||||
<td class="key_td">'+tr("Name")+'</td>\
|
||||
<td class="value_td">'+elem_info.NAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Owner")+'</td>\
|
||||
<td class="value_td">'+elem_info.UNAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Group")+'</td>\
|
||||
<td class="value_td">'+elem_info.GNAME+'</td>\
|
||||
</tr>\
|
||||
<tr><td class="key_td">'+tr("Permissions")+'</td><td></td></tr>\
|
||||
<tr>\
|
||||
<td class="key_td"> '+tr("Owner")+'</td>\
|
||||
<td class="value_td" style="font-family:monospace;">'+ownerPermStr(elem_info)+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td"> '+tr("Group")+'</td>\
|
||||
<td class="value_td" style="font-family:monospace;">'+groupPermStr(elem_info)+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td"> '+tr("Other")+'</td>\
|
||||
<td class="value_td" style="font-family:monospace;">'+otherPermStr(elem_info)+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Strategy")+'</td>\
|
||||
<td class="value_td">'+elem_info.TEMPLATE.BODY.deployment+'</td>\
|
||||
</tr>\
|
||||
</table>'
|
||||
</table>' +
|
||||
roles_info +
|
||||
'</div>\
|
||||
<div class="six columns">' + insert_permissions_table('apptools-appflow-templates',
|
||||
"ServiceTemplate",
|
||||
elem_info.ID,
|
||||
elem_info.UNAME,
|
||||
elem_info.GNAME,
|
||||
elem_info.UID,
|
||||
elem_info.GID) +
|
||||
'</div>\
|
||||
</div>'
|
||||
};
|
||||
|
||||
var roles_info = '<table id="service_template_roles_table" class="info_table" style="width:80%;">\
|
||||
<thead></thead>'
|
||||
|
||||
var roles = elem_info.TEMPLATE.BODY.roles
|
||||
if (roles && roles.length > 0)
|
||||
for (var i = 0; i < roles.length; i++) {
|
||||
roles_info += '<tr><td class="key_td">'+tr("Role")+' '+roles[i].name+'</td><td></td></tr>\
|
||||
<tr>\
|
||||
<td> '+tr("Cardinality")+'</td>\
|
||||
<td class="value_td" style="font-family:monospace;">'+roles[i].cardinality+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td> '+tr("VM Template")+'</td>\
|
||||
<td class="value_td" style="font-family:monospace;">'+roles[i].vm_template+'</td>\
|
||||
</tr>'
|
||||
|
||||
if (roles[i].parents)
|
||||
roles_info += '<tr>\
|
||||
<td > '+tr("Parents")+'</td>\
|
||||
<td class="value_td" style="font-family:monospace;">'+roles[i].parents.join(', ')+'</td>\
|
||||
</tr>'
|
||||
}
|
||||
|
||||
roles_info += '</table>'
|
||||
|
||||
var roles_tab = {
|
||||
title: tr("Roles"),
|
||||
content: roles_info
|
||||
}
|
||||
|
||||
/*
|
||||
var roles_tab = {
|
||||
title: tr("Roles"),
|
||||
content: '<table id="service_node_table" class="info_table" style="width:80%;">\
|
||||
<thead><tr><th colspan="2">'+tr("Node")+'</th></tr></thead>'+
|
||||
(elem_info.TEMPLATE.BODY ? prettyPrintJSON(elem_info.TEMPLATE.BODY) : "" )+
|
||||
'</table>'
|
||||
}
|
||||
*/
|
||||
Sunstone.updateInfoPanelTab("service_template_info_panel","service_template_info_tab",info_tab);
|
||||
if (roles && roles.length > 0)
|
||||
Sunstone.addInfoPanelTab("service_template_info_panel","service_template_roles_tab",roles_tab);
|
||||
else
|
||||
Sunstone.removeInfoPanelTab("service_template_info_panel","service_template_roles_tab");
|
||||
|
||||
Sunstone.popUpInfoPanel("service_template_info_panel", "apptools-appflow-templates");
|
||||
|
||||
setPermissionsTable(elem_info,'');
|
||||
|
||||
$("#service_template_info_panel_refresh", $("#service_template_info_panel")).click(function(){
|
||||
$(this).html(spinner);
|
||||
Sunstone.runAction('ServiceTemplate.showinfo', elem_info.ID);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -793,121 +661,17 @@ function popUpCreateServiceTemplateDialog(){
|
||||
var dialog = $create_service_template_dialog;
|
||||
var tpl_select = makeSelectOptions(dataTable_templates, 1, 4, [], [], true);
|
||||
$('select[name="vm_template"]', dialog).html(tpl_select);
|
||||
// $('select[name="templates"] option', dialog).each(function(){
|
||||
// $(this).text('☐ '+$(this).text());
|
||||
// });
|
||||
|
||||
// //Somehow this needs to go here. Live() doesn't respond in setup function
|
||||
// $('select[name="templates"] option', dialog).click(function(){
|
||||
// var clicked = $(this).attr('clicked');
|
||||
// if (clicked){//unbold, unmark
|
||||
// $(this).text($(this).text().replace(/☒/g,'☐'));
|
||||
// $(this).removeAttr('clicked');
|
||||
// }
|
||||
// else {//bold,mark
|
||||
// $(this).text($(this).text().replace(/☐/g,'☒'));
|
||||
// $(this).attr('clicked','clicked');
|
||||
// }
|
||||
// return false;
|
||||
// });
|
||||
|
||||
dialog.reveal();
|
||||
}
|
||||
|
||||
|
||||
function setupServiceTemplateUpdateDialog(){
|
||||
//Append to DOM
|
||||
dialogs_context.append('<div id="service_template_update_dialog" title="'+tr("Update Service template properties")+'"></div>');
|
||||
var dialog = $('#service_template_update_dialog',dialogs_context);
|
||||
|
||||
//Put HTML in place
|
||||
dialog.html(update_service_template_tmpl);
|
||||
|
||||
var height = Math.floor($(window).height()*0.8); //set height to a percentage of the window
|
||||
|
||||
//Convert into jQuery
|
||||
dialog.addClass("reveal-modal xlarge");
|
||||
|
||||
|
||||
$('#service_template_update_select',dialog).change(function(){
|
||||
var id = $(this).val();
|
||||
$('.permissions_table input', dialog).removeAttr('checked');
|
||||
$('.permissions_table', dialog).removeAttr('update');
|
||||
if (id && id.length){
|
||||
Sunstone.runAction("ServiceTemplate.fetch_permissions", id);
|
||||
};
|
||||
});
|
||||
|
||||
$('.permissions_table input',dialog).change(function(){
|
||||
$(this).parents('table').attr('update','update');
|
||||
});
|
||||
|
||||
$('form',dialog).submit(function(){
|
||||
var dialog = $(this);
|
||||
var id = $('#service_template_update_select',dialog).val();
|
||||
if (!id || !id.length) {
|
||||
$(this).parents('#service_template_update_dialog').trigger("reveal:close");
|
||||
return false;
|
||||
};
|
||||
|
||||
var permissions = $('.permissions_table',dialog);
|
||||
if (permissions.attr('update')){
|
||||
var perms = {
|
||||
octet : buildOctet(permissions)
|
||||
};
|
||||
Sunstone.runAction("ServiceTemplate.chmod", id, perms);
|
||||
};
|
||||
|
||||
$(this).parents('#service_template_update_dialog').trigger("reveal:close");
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function popUpServiceTemplateUpdateDialog(){
|
||||
var select = makeSelectOptions(dataTable_service_templates,
|
||||
1,//id_col
|
||||
4,//name_col
|
||||
[],
|
||||
[]
|
||||
);
|
||||
var sel_elems = getSelectedNodes(dataTable_service_templates);
|
||||
|
||||
|
||||
var dialog = $('#service_template_update_dialog');
|
||||
$('#service_template_update_select', dialog).html(select);
|
||||
// $('#service_template_update_textarea',dialog).val("");
|
||||
$('.permissions_table input', dialog).removeAttr('checked');
|
||||
$('.permissions_table', dialog).removeAttr('update');
|
||||
|
||||
if (sel_elems.length >= 1){ //several items in the list are selected
|
||||
//grep them
|
||||
var new_select= sel_elems.length > 1? '<option value="">Please select</option>' : "";
|
||||
$('option','<select>'+select+'</select>').each(function(){
|
||||
var val = $(this).val();
|
||||
if ($.inArray(val,sel_elems) >= 0){
|
||||
new_select+='<option value="'+val+'">'+$(this).text()+'</option>';
|
||||
};
|
||||
});
|
||||
$('#service_template_update_select', dialog).html(new_select);
|
||||
if (sel_elems.length == 1) {
|
||||
$('#service_template_update_select option',
|
||||
dialog).attr('selected','selected');
|
||||
$('#service_template_update_select', dialog).trigger("change");
|
||||
};
|
||||
};
|
||||
|
||||
dialog.reveal();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the autorefresh interval for the datatable
|
||||
function setServiceTemplateAutorefresh() {
|
||||
setInterval(function(){
|
||||
var checked = $('input.check_item:checked',dataTable_service_templates);
|
||||
var filter = $("#datatable_service_templates_filter input",
|
||||
dataTable_service_templates.parents("#datatable_service_templates_wrapper")).attr('value');
|
||||
if (!checked.length && !filter.length){
|
||||
var filter = $("#service_template_search").attr('value');
|
||||
if ((checked.length==0) && !filter){
|
||||
Sunstone.runAction("ServiceTemplate.autorefresh");
|
||||
}
|
||||
},INTERVAL+someTime());
|
||||
@@ -936,13 +700,9 @@ $(document).ready(function(){
|
||||
|
||||
Sunstone.runAction("ServiceTemplate.list");
|
||||
|
||||
|
||||
setupCreateServiceTemplateDialog();
|
||||
setupServiceTemplateUpdateDialog();
|
||||
setupTips($create_service_template_dialog);
|
||||
$('.st_man .man_icon',
|
||||
$create_service_template_dialog).css('display', 'inline-block');
|
||||
// setupImageCloneDialog();
|
||||
|
||||
setServiceTemplateAutorefresh();
|
||||
|
||||
initCheckAllBoxes(dataTable_service_templates);
|
||||
|
||||
Reference in new issue
Block a user