\
+
\
+
\
+
? \
+
\
+'+tr("Size and registration time are hidden colums. Note that persistent files can only be used by 1 VM. To change file datastore, please re-register the file.")+'\
+
\
+
\
+';
+
+var create_file_tmpl =
+'
\
+
\
+
'+tr("Create File")+' \
+ \
+
\
+
\
+ \
+
\
+ '+tr("Create")+' \
+ '+tr("Reset")+' \
+ ' + tr("Close") + ' \
+
\
+
× \
+
';
+
+var dataTable_files;
+var $create_file_dialog;
+
+var file_actions = {
+
+ "File.create" : {
+ type: "create",
+ call: OpenNebula.Image.create,
+ callback: addFileElement,
+ error: onError,
+ notify:true
+ },
+
+ "File.create_dialog" : {
+ type: "custom",
+ call: popUpCreateFileDialog
+ },
+
+ "File.list" : {
+ type: "list",
+ call: OpenNebula.Image.list,
+ callback: updateFilesView,
+ error: onError
+ },
+
+ "File.show" : {
+ type : "single",
+ call: OpenNebula.Image.show,
+ callback: updateFileElement,
+ error: onError
+ },
+
+ "File.showinfo" : {
+ type: "single",
+ call: OpenNebula.Image.show,
+ callback: updateFileInfo,
+ error: onError
+ },
+
+ "File.refresh" : {
+ type: "custom",
+ call: function () {
+ waitingNodes(dataTable_files);
+ Sunstone.runAction("File.list");
+ }
+ },
+
+ "File.autorefresh" : {
+ type: "custom",
+ call: function() {
+ OpenNebula.Image.list({timeout: true, success: updateFilesView, error: onError});
+ }
+ },
+
+ "File.update_template" : {
+ type: "single",
+ call: OpenNebula.Image.update,
+ callback: function(request) {
+ notifyMessage("Template updated correctly");
+ Sunstone.runAction('Image.showinfo',request.request.data[0]);
+ },
+ error: onError
+ },
+
+ "File.enable" : {
+ type: "multiple",
+ call: OpenNebula.Image.enable,
+ callback: function (req) {
+ Sunstone.runAction("File.show",req.request.data[0]);
+ },
+ elements: fileElements,
+ error: onError,
+ notify: true
+ },
+
+ "File.disable" : {
+ type: "multiple",
+ call: OpenNebula.Image.disable,
+ callback: function (req) {
+ Sunstone.runAction("File.show",req.request.data[0]);
+ },
+ elements: fileElements,
+ error: onError,
+ notify: true
+ },
+
+ "File.delete" : {
+ type: "multiple",
+ call: OpenNebula.Image.del,
+ callback: deleteFileElement,
+ elements: fileElements,
+ error: onError,
+ notify: true
+ },
+
+ "File.chown" : {
+ type: "multiple",
+ call: OpenNebula.Image.chown,
+ callback: function (req) {
+ Sunstone.runAction("File.show",req.request.data[0][0]);
+ Sunstone.runAction('Image.showinfo',request.request.data[0]);
+ },
+ elements: fileElements,
+ error: onError,
+ notify: true
+ },
+
+ "File.chgrp" : {
+ type: "multiple",
+ call: OpenNebula.Image.chgrp,
+ callback: function (req) {
+ Sunstone.runAction("File.show",req.request.data[0][0]);
+ Sunstone.runAction('Image.showinfo',request.request.data[0]);
+ },
+ elements: fileElements,
+ error: onError,
+ notify: true
+ },
+
+ "File.chmod" : {
+ type: "single",
+ call: OpenNebula.Image.chmod,
+// callback
+ error: onError,
+ notify: true
+ },
+
+ "File.chtype" : {
+ type: "single",
+ call: OpenNebula.Image.chtype,
+ callback: function (req) {
+ Sunstone.runAction("File.show",req.request.data[0][0]);
+ Sunstone.runAction("File.list");
+ },
+ elements: fileElements,
+ error: onError,
+ notify: true
+ },
+ "File.clone_dialog" : {
+ type: "custom",
+ call: popUpFileCloneDialog
+ },
+ "File.clone" : {
+ type: "single",
+ call: OpenNebula.Image.clone,
+ error: onError,
+ notify: true
+ },
+ "File.help" : {
+ type: "custom",
+ call: function() {
+ hideDialog();
+ $('div#files_tab div.legend_div').slideToggle();
+ }
+ },
+ "File.rename" : {
+ type: "single",
+ call: OpenNebula.Image.rename,
+ callback: function(request) {
+ notifyMessage("File renamed correctly");
+ Sunstone.runAction('Image.showinfo',request.request.data[0]);
+ Sunstone.runAction('Image.list');
+ },
+ error: onError,
+ notify: true
+ },
+};
+
+
+var file_buttons = {
+ "File.refresh" : {
+ type: "action",
+ layout: "refresh",
+ alwaysActive: true
+ },
+ "File.create_dialog" : {
+ type: "create_dialog",
+ layout: "create"
+ },
+ "File.chown" : {
+ type: "confirm_with_select",
+ text: tr("Change owner"),
+ layout: "user_select",
+ select: users_sel,
+ tip: tr("Select the new owner")+":",
+ condition: mustBeAdmin
+ },
+ "File.chgrp" : {
+ type: "confirm_with_select",
+ text: tr("Change group"),
+ layout: "user_select",
+ select: groups_sel,
+ tip: tr("Select the new group")+":",
+ condition: mustBeAdmin
+ },
+ "File.enable" : {
+ type: "action",
+ layout: "more_select",
+ text: tr("Enable")
+ },
+ "File.disable" : {
+ type: "action",
+ layout: "more_select",
+ text: tr("Disable")
+ },
+ "File.clone_dialog" : {
+ type: "action",
+ layout: "main",
+ text: tr("Clone")
+ },
+ "File.delete" : {
+ type: "confirm",
+ layout: "del",
+ text: tr("Delete")
+ },
+ //"File.help" : {
+ // type: "action",
+ // text: '?',
+ // alwaysActive: true
+ //}
+}
+
+var file_info_panel = {
+ "file_info_tab" : {
+ title: tr("Information"),
+ content: ""
+ }
+}
+
+var files_tab = {
+ title: tr("Files & Kernels"),
+ content: files_tab_content,
+ buttons: file_buttons,
+ tabClass: 'subTab',
+ parentTab: 'vres_tab'
+}
+
+Sunstone.addActions(file_actions);
+Sunstone.addMainTab('files_tab',files_tab);
+Sunstone.addInfoPanel('file_info_panel',file_info_panel);
+
+
+function fileElements() {
+ return getSelectedNodes(dataTable_files);
+}
+
+// Returns an array containing the values of the file_json and ready
+// to be inserted in the dataTable
+function fileElementArray(file_json){
+ //Changing this? It may affect to the is_persistent() functions.
+ var file = file_json.IMAGE;
+
+ // OS || CDROM || DATABLOCK
+ if (file.TYPE == "0" || file.TYPE == "1" || file.TYPE == "2") {
+ return false;
+ }
+
+
+ size_files = size_files + parseInt(file.SIZE);
+
+ //add also persistent/non-persistent selects, type select.
+ return [
+ '
',
+ file.ID,
+ file.UNAME,
+ file.GNAME,
+ file.NAME,
+ file.DATASTORE,
+ file.SIZE,
+ OpenNebula.Helper.image_type(file.TYPE),
+ pretty_time(file.REGTIME),
+ parseInt(file.PERSISTENT) ? "yes" : "no",
+ OpenNebula.Helper.resource_state("image",file.STATE),
+ file.RUNNING_VMS,
+ file.TEMPLATE.TARGET ? file.TEMPLATE.TARGET : '--'
+ ];
+}
+
+// Callback to update an element in the dataTable
+function updateFileElement(request, file_json){
+ var id = file_json.IMAGE.ID;
+ var element = fileElementArray(file_json);
+ updateSingleElement(element,dataTable_files,'#file_'+id);
+}
+
+// Callback to remove an element from the dataTable
+function deleteFileElement(req){
+ deleteElement(dataTable_files,'#file_'+req.request.data);
+}
+
+// Callback to add an file element
+function addFileElement(request, file_json){
+ var element = fileElementArray(file_json);
+ addElement(element,dataTable_files);
+}
+
+// Callback to refresh the list of files
+function updateFilesView(request, files_list){
+ var file_list_array = [];
+
+ size_files = 0;
+
+ $.each(files_list,function(){
+ var file = fileElementArray(this);
+ if (file)
+ file_list_array.push(file);
+ });
+
+ updateView(file_list_array,dataTable_files);
+ updateVResDashboard("files",files_list);
+
+ var size = humanize_size_from_mb(size_files)
+
+ $("#total_files", $dashboard).text(files_list.length);
+ $("#size_files", $dashboard).text(size);
+
+ var form = $("#file_form");
+
+ $("#total_files", form).text(files_list.length);
+ $("#size_files", form).text(size);
+}
+
+// Callback to update the information panel tabs and pop it up
+function updateFileInfo(request,img){
+ var img_info = img.IMAGE;
+ var info_tab = {
+ title: tr("Information"),
+ content:
+ '
\
+
\
+
\
+ \
+ '+tr("File")+' - '+img_info.NAME+' \
+ \
+ \
+ '+tr("ID")+' \
+ '+img_info.ID+' \
+ \
+ \
+ \
+ '+tr("Name")+' \
+ '+img_info.NAME+' \
+ \
+ \
+ \
+ \
+ '+tr("Datastore")+' \
+ '+img_info.DATASTORE+' \
+ \
+ \
+ \
+ '+tr("Type")+' \
+ '+OpenNebula.Helper.image_type(img_info.TYPE)+' \
+ \
+ \
+ \
+ \
+ '+tr("Register time")+' \
+ '+pretty_time(img_info.REGTIME)+' \
+ \
+ \
+ \
+ '+tr("Persistent")+' \
+ '+(parseInt(img_info.PERSISTENT) ? tr("yes") : tr("no"))+' \
+ \
+ \
+ \
+ \
+ '+tr("Filesystem type")+' \
+ '+(typeof img_info.FSTYPE === "string" ? img_info.FSTYPE : "--")+' \
+ \
+ \
+ \
+ '+tr("Size (MB)")+' \
+ '+img_info.SIZE+' \
+ \
+ \
+ \
+ '+tr("State")+' \
+ '+OpenNebula.Helper.resource_state("file",img_info.STATE)+' \
+ \
+ \
+ \
+ '+tr("Running VMS")+' \
+ '+img_info.RUNNING_VMS+' \
+ \
+ \
+
\
+
\
+
'
+ + insert_permissions_table("File",
+ img_info.ID,
+ img_info.UNAME,
+ img_info.GNAME,
+ img_info.UID,
+ img_info.GID) +
+ insert_extended_template_table(img_info.TEMPLATE,
+ "File",
+ img_info.ID,
+ "Configuration & Tags") +
+ '
\
+
'
+ }
+
+ $("#div_edit_rename_link").die();
+ $(".input_edit_value_rename").die();
+ $("#div_edit_chg_type_link").die();
+ $("#chg_type_select").die();
+ $("#div_edit_persistency").die();
+ $("#persistency_select").die();
+
+
+ // Listener for edit link for rename
+ $("#div_edit_rename_link").live("click", function() {
+ var value_str = $(".value_td_rename").text();
+ $(".value_td_rename").html('
');
+ });
+
+ $(".input_edit_value_rename").live("change", function() {
+ var value_str = $(".input_edit_value_rename").val();
+ if(value_str!="")
+ {
+ // Let OpenNebula know
+ var name_template = {"name": value_str};
+ Sunstone.runAction("File.rename",img_info.ID,name_template);
+ }
+ });
+
+ // Listener for edit link for type change
+ $("#div_edit_chg_type_link").live("click", function() {
+ var value_str = $(".value_td_type").text();
+ $(".value_td_type").html(
+ '
\
+ '+tr("Kernel")+' \
+ '+tr("Ramdisk")+' \
+ '+tr("Context")+' \
+ ');
+ $('option[value="'+value_str+'"]').replaceWith('
'+tr(value_str)+' ');
+ });
+
+ $("#chg_type_select").live("change", function() {
+ var new_value=$("option:selected", this).text();
+ Sunstone.runAction("File.chtype", img_info.ID, new_value);
+ Sunstone.runAction("File.showinfo", img_info.ID);
+ });
+
+ // Listener for edit link for persistency change
+ $("#div_edit_persistency").live("click", function() {
+ var value_str = $(".value_td_persistency").text();
+ $(".value_td_persistency").html(
+ '
\
+ '+tr("yes")+' \
+ '+tr("no")+' \
+ ');
+ $('option[value="'+value_str+'"]').replaceWith('
'+tr(value_str)+' ');
+ });
+
+ $("#persistency_select").live("change", function() {
+ var new_value=$("option:selected", this).text();
+
+ if (new_value=="yes")
+ Sunstone.runAction("File.persistent",[img_info.ID]);
+ else
+ Sunstone.runAction("File.nonpersistent",[img_info.ID]);
+
+ });
+
+ Sunstone.updateInfoPanelTab("file_info_panel","file_info_tab",info_tab);
+ Sunstone.popUpInfoPanel("file_info_panel");
+
+ setPermissionsTable(img_info,'');
+
+}
+
+function enable_all_datastores()
+{
+
+ $('select#disk_type').children('option').each(function() {
+ $(this).removeAttr('disabled');
+ });
+}
+
+// Prepare the file creation dialog
+function setupCreateFileDialog(){
+ dialogs_context.append('
');
+ $create_file_dialog = $('#create_file_dialog',dialogs_context);
+
+ var dialog = $create_file_dialog;
+ dialog.html(create_file_tmpl);
+
+ var height = Math.floor($(window).height()*0.8); //set height to a percentage of the window
+
+ //Prepare jquery dialog
+ //dialog.dialog({
+ // autoOpen: false,
+ // modal:true,
+ // width: 520,
+ // height: height
+ //});
+ dialog.addClass("reveal-modal large");
+
+ $('.advanced',dialog).hide();
+
+ $('#advanced_file_create',dialog).click(function(){
+ $('.advanced',dialog).toggle();
+ return false;
+ });
+
+ //$('#img_tabs',dialog).tabs();
+ //$('button',dialog).button();
+ //$('#datablock_img',dialog).attr('disabled','disabled');
+
+
+ $('select#img_type',dialog).change(function(){
+ var value = $(this).val();
+ var context = $create_file_dialog;
+ switch (value){
+ case "DATABLOCK":
+ $('#datablock_img',context).removeAttr("disabled");
+ //$('#empty_datablock', context).show();
+ break;
+ default:
+ $('#datablock_img',context).attr('disabled','disabled');
+ //$('#empty_datablock', context).hide();
+ $('#path_img',context).click();
+
+ }
+ });
+
+
+ $('#img_path,#img_fstype,#img_size,#file-uploader',dialog).closest('.row').hide();
+
+ $("input[name='src_path']", dialog).change(function(){
+ var context = $create_file_dialog;
+ var value = $(this).val();
+ switch (value){
+ case "path":
+ $('#img_fstype,#img_size,#file-uploader',context).closest('.row').hide();
+ $('#img_path',context).closest('.row').show();
+ break;
+ case "datablock":
+ $('#img_path,#file-uploader',context).closest('.row').hide();
+ $('#img_fstype,#img_size',context).closest('.row').show();
+ break;
+ case "upload":
+ $('#img_path,#img_fstype,#img_size',context).closest('.row').hide();
+ $('#file-uploader',context).closest('.row').show();
+ break;
+ };
+ });
+
+
+ $('#path_img',dialog).click();
+
+
+ $('#add_custom_var_file_button', dialog).click(
+ function(){
+ var name = $('#custom_var_file_name',$create_file_dialog).val();
+ var value = $('#custom_var_file_value',$create_file_dialog).val();
+ if (!name.length || !value.length) {
+ notifyError(tr("Custom attribute name and value must be filled in"));
+ return false;
+ }
+ option= '
'+
+ name+'='+value+
+ ' ';
+ $('select#custom_var_file_box',$create_file_dialog).append(option);
+ return false;
+ }
+ );
+
+ $('#remove_custom_var_file_button', dialog).click(
+ function(){
+ $('select#custom_var_file_box :selected',$create_file_dialog).remove();
+ return false;
+ }
+ );
+
+ $('#upload-progress',dialog).css({
+ border: "1px solid #AAAAAA",
+ position: "relative",
+// bottom: "29px",
+ width: "258px",
+// left: "133px",
+ height: "15px",
+ display: "inline-block"
+ });
+ $('#upload-progress div',dialog).css("border","1px solid #AAAAAA");
+
+ var img_obj;
+
+ // Upload is handled by FileUploader vendor plugin
+ var uploader = new qq.FileUploaderBasic({
+ button: $('#file-uploader',$create_file_dialog)[0],
+ action: 'upload',
+ multiple: false,
+ params: {},
+ sizeLimit: 0,
+ showMessage: function(message){
+ //notifyMessage(message);
+ },
+ onSubmit: function(id, fileName){
+ //set url params
+ //since the body is the upload, we need the pass
+ //the file info here
+ uploader.setParams({
+ img : JSON.stringify(img_obj),
+ file: fileName
+ });
+ //we pop up an upload progress dialog
+ var pos_top = $(window).height() - 120;
+ var pos_left = 220;
+ //var pb_dialog = $('
').dialog({
+ // draggable:true,
+ // modal:false,
+ // resizable:false,
+ // buttons:{},
+ // width: 460,
+ // minHeight: 50,
+ // position: [pos_left, pos_top]
+ // });
+
+ var pb_dialog = $('
').addClass("reveal-modal");
+
+ //$('#upload-progress',pb_dialog).progressbar({value:0});
+ },
+ onProgress: function(id, fileName, loaded, total){
+ //update upload dialog with current progress
+ //$('div#pb_dialog #upload-progress').progressbar("option","value",Math.floor(loaded*100/total));
+ },
+ onComplete: function(id, fileName, responseJSON){
+ //Inform complete upload, destroy upload dialog, refresh img list
+ notifyMessage("File uploaded correctly");
+ //$('div#pb_dialog').dialog('destroy');
+ $('div#pb_dialog').trigger("reveal:close")
+ Sunstone.runAction("File.list");
+ return false;
+ },
+ onCancel: function(id, fileName){
+ }
+ });
+
+ var file_input = false;
+ uploader._button._options.onChange = function(input) {
+ file_input = input; return false;
+ };
+
+
+
+ $('#create_file_submit',dialog).click(function(){
+ var exit = false;
+ var upload = false;
+ $('.img_man',this).each(function(){
+ if (!$('input',this).val().length){
+ notifyError(tr("There are mandatory parameters missing"));
+ exit = true;
+ return false;
+ }
+ });
+ if (exit) { return false; }
+
+ var ds_id = $('#file_datastore',dialog).val();
+ if (!ds_id){
+ notifyError(tr("Please select a datastore for this file"));
+ return false;
+ };
+
+ var img_json = {};
+
+ var name = $('#img_name',dialog).val();
+ img_json["NAME"] = name;
+
+ var desc = $('#img_desc',dialog).val();
+ if (desc.length){
+ img_json["DESCRIPTION"] = desc;
+ }
+
+ var type = $('#img_type',dialog).val();
+ img_json["TYPE"]= type;
+
+
+ switch ($('#src_path_select input:checked',dialog).val()){
+ case "path":
+ path = $('#img_path',dialog).val();
+ if (path) img_json["PATH"] = path;
+ break;
+ case "upload":
+ upload=true;
+ break;
+ }
+
+ //Time to add custom attributes
+ $('#custom_var_file_box option',$create_file_dialog).each(function(){
+ var attr_name = $(this).attr('name');
+ var attr_value = $(this).val();
+ img_json[attr_name] = attr_value;
+ });
+
+ img_obj = { "image" : img_json,
+ "ds_id" : ds_id};
+
+
+ //we this is an file upload we trigger FileUploader
+ //to start the upload
+ if (upload){
+ uploader._onInputChange(file_input);
+ } else {
+ Sunstone.runAction("File.create", img_obj);
+ };
+
+ $create_file_dialog.trigger("reveal:close")
+ return false;
+ });
+
+}
+
+function popUpCreateFileDialog(){
+ $('#file-uploader input',$create_file_dialog).removeAttr("style");
+ $('#file-uploader input',$create_file_dialog).attr('style','margin:0;width:256px!important');
+
+ var datastores_str = datastores_sel();
+ // Get rid of default datastore (51 characters in string)
+ datastores_str = datastores_str.substring(51,datastores_str.length);
+
+ $('#file_datastore',$create_file_dialog).html(datastores_str);
+ $('#file_datastore_raw',$create_file_dialog).html(datastores_str);
+
+ $create_file_dialog.reveal();
+
+ $('select#file_datastore').children('option').each(function() {
+ if ($(this).val() != "2")
+ {
+ $(this).attr('disabled', 'disabled');
+ }
+ });
+}
+
+// Set the autorefresh interval for the datatable
+function setFileAutorefresh() {
+ setInterval(function(){
+ var checked = $('input.check_item:checked',dataTable_files);
+ var filter = $("#file_search").attr('value');
+ if (!checked.length && !filter.length){
+ Sunstone.runAction("File.autorefresh");
+ }
+ },INTERVAL+someTime());
+};
+
+function is_persistent_file(id){
+ var data = getElementData(id,"#file",dataTable_files)[8];
+ return $(data).is(':checked');
+};
+
+function setupFileCloneDialog(){
+ //Append to DOM
+ dialogs_context.append('
');
+ var dialog = $('#file_clone_dialog',dialogs_context);
+
+ //Put HTML in place
+
+ var html = '
\
+
\
+ \
+ \
+ \
+
\
+\
+
\
+
'+tr("Several file are selected, please choose prefix to name the new copies")+':
\
+
\
+
\
+\
+
\
+ '+tr("Name")+': \
+ '+tr("Prefix")+': \
+
\
+
\
+ \
+
\
+
\
+ \
+\
+ \
+'+tr("Clone")+'\
+ \
+ ' + tr("Close") + ' \
+
\
+× \
+ \
+';
+
+ dialog.html(html);
+
+ //Convert into jQuery
+ //dialog.dialog({
+ // autoOpen:false,
+ // width:375,
+ // modal:true,
+ // resizable:false
+ //});
+ dialog.addClass("reveal-modal");
+
+ //$('button',dialog).button();
+
+ $('form',dialog).submit(function(){
+ var name = $('input', this).val();
+ var sel_elems = fileElements();
+ 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 files we
+ //use the name as prefix
+ Sunstone.runAction('Image.clone',
+ sel_elems[i],
+ name+getFileName(sel_elems[i]));
+ } else {
+ Sunstone.runAction('Image.clone',sel_elems[0],name)
+ };
+ dialog.trigger("reveal:close")
+ setTimeout(function(){
+ Sunstone.runAction('Image.refresh');
+ }, 1500);
+ return false;
+ });
+}
+
+function popUpFileCloneDialog(){
+ var dialog = $('#file_clone_dialog');
+ var sel_elems = fileElements();
+ //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 '+getFileName(sel_elems[0]));
+ };
+
+ $(dialog).reveal();
+}
+
+//The DOM is ready at this point
+$(document).ready(function(){
+
+ dataTable_files = $("#datatable_files",main_tabs_context).dataTable({
+ "sDom" : "<'H'>t<'row'<'six columns'i><'six columns'p>>",
+ "oColVis": {
+ "aiExclude": [ 0 ]
+ },
+ "aoColumnDefs": [
+ { "bSortable": false, "aTargets": ["check"] },
+ { "sWidth": "60px", "aTargets": [0,2,3,9,10] },
+ { "sWidth": "35px", "aTargets": [1,6,11,12] },
+ { "sWidth": "100px", "aTargets": [5,7] },
+ { "sWidth": "150px", "aTargets": [8] },
+ { "bVisible": false, "aTargets": [6,8,9,11,12]}
+ ],
+ "oLanguage": (datatable_lang != "") ?
+ {
+ sUrl: "locale/"+lang+"/"+datatable_lang
+ } : ""
+ });
+
+ $('#file_search').keyup(function(){
+ dataTable_files.fnFilter( $(this).val() );
+ })
+
+ //addElement([
+ // spinner,
+ // '','','','','','','','','','','',''],dataTable_files);
+ Sunstone.runAction("File.list");
+
+ setupCreateFileDialog();
+ setupTips($create_file_dialog);
+ setupFileCloneDialog();
+ setFileAutorefresh();
+
+ initCheckAllBoxes(dataTable_files);
+ tableCheckboxesListener(dataTable_files);
+ infoListener(dataTable_files,'Image.showinfo');
+
+ $('div#files_tab div.legend_div').hide();
+});
diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js
index d0fde0a922..f368b52e17 100644
--- a/src/sunstone/public/js/plugins/images-tab.js
+++ b/src/sunstone/public/js/plugins/images-tab.js
@@ -579,6 +579,11 @@ function imageElementArray(image_json){
//Changing this? It may affect to the is_persistent() functions.
var image = image_json.IMAGE;
+ // KERNEL || RAMDISK || CONTEXT
+ if (image.TYPE == "3" || image.TYPE == "4" || image.TYPE == "5") {
+ return false;
+ }
+
size_images = size_images + parseInt(image.SIZE);
//add also persistent/non-persistent selects, type select.
@@ -624,7 +629,9 @@ function updateImagesView(request, images_list){
size_images = 0;
$.each(images_list,function(){
- image_list_array.push(imageElementArray(this));
+ var image = imageElementArray(this);
+ if (image)
+ image_list_array.push(image);
});
updateView(image_list_array,dataTable_images);
diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js
index a9e9836043..ad439921e6 100644
--- a/src/sunstone/public/js/plugins/templates-tab.js
+++ b/src/sunstone/public/js/plugins/templates-tab.js
@@ -1043,11 +1043,12 @@ function setup_disk_tab_content(disk_section, str_disk_tab_id, str_datatable_id)
var image_list_array = [];
$.each(images_list,function(){
- image_list_array.push(imageElementArray(this));
+ var image = imageElementArray(this);
+ if (image)
+ image_list_array.push(image);
});
updateView(image_list_array, dataTable_template_images);
- dataTable_template_images.fnFilter("OS|DATABLOCK|CDROM", 7, true)
},
error: onError
});
@@ -2029,7 +2030,9 @@ function setupCreateTemplateDialog(){
var image_list_array = [];
$.each(images_list,function(){
- image_list_array.push(imageElementArray(this));
+ var file = fileElementArray(this);
+ if (file)
+ image_list_array.push(file);
});
updateView(image_list_array, dataTable_template_kernel);
@@ -2097,7 +2100,9 @@ function setupCreateTemplateDialog(){
var image_list_array = [];
$.each(images_list,function(){
- image_list_array.push(imageElementArray(this));
+ var file = fileElementArray(this);
+ if (file)
+ image_list_array.push(file);
});
updateView(image_list_array, datTable_template_initrd);
@@ -2491,7 +2496,9 @@ function setupCreateTemplateDialog(){
success: function (request, images_list){
var image_list_array = [];
$.each(images_list,function(){
- image_list_array.push(imageElementArray(this));
+ var image = fileElementArray(this);
+ if (image)
+ image_list_array.push(image);
});
updateView(image_list_array, datTable_template_context);