mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-26 06:50:09 +03:00
Feature #507: Started the rest of plugins, actions and buttons defined.
This commit is contained in:
parent
b85273182e
commit
05cc231c11
@ -149,7 +149,7 @@ var dashboard_tab_content =
|
||||
</table>';
|
||||
|
||||
|
||||
Sunstone.addMainTab('Dashboard',dashboard_tab_content,null,'dashboard_tab');
|
||||
Sunstone.addMainTab('dashboard_tab','Dashboard',dashboard_tab_content,null);
|
||||
|
||||
$(document).ready(function(){
|
||||
//Dashboard link listener
|
||||
|
@ -119,13 +119,14 @@ var host_actions = {
|
||||
call: popUpCreateHostDialog
|
||||
},
|
||||
|
||||
"Host.list" : {
|
||||
type: "list",
|
||||
call: OpenNebula.Host.list,
|
||||
callback: updateHostsView,
|
||||
error: onError,
|
||||
notify:False
|
||||
},
|
||||
//Custom below
|
||||
//~ "Host.list" : {
|
||||
//~ type: "list",
|
||||
//~ call: OpenNebula.Host.list,
|
||||
//~ callback: updateHostsView,
|
||||
//~ error: onError,
|
||||
//~ notify:False
|
||||
//~ },
|
||||
|
||||
"Host.show" : {
|
||||
type: "single",
|
||||
@ -157,7 +158,9 @@ var host_actions = {
|
||||
"Host.enable" : {
|
||||
type: "multiple",
|
||||
call : OpenNebula.Host.enable,
|
||||
callback : host_update_callback,
|
||||
callback : function (req) {
|
||||
Sunstone.runAction("Host.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function() { return dataTable_hosts },
|
||||
error : onError,
|
||||
notify:True,
|
||||
@ -166,7 +169,9 @@ var host_actions = {
|
||||
"Host.disable" : {
|
||||
type: "multiple",
|
||||
call : OpenNebula.Host.disable,
|
||||
callback : host_update_callback,
|
||||
callback : function (req) {
|
||||
Sunstone.runAction("Host.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function() { return dataTable_hosts },
|
||||
error : onError,
|
||||
notify:True,
|
||||
@ -247,7 +252,6 @@ var host_actions = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var host_buttons = {
|
||||
"Host.refresh" : {
|
||||
type: "image",
|
||||
@ -257,7 +261,7 @@ var host_buttons = {
|
||||
},
|
||||
"Host.create_dialog" : {
|
||||
type: "create_dialog",
|
||||
text: "+ New host",
|
||||
text: "+ New",
|
||||
condition :True
|
||||
},
|
||||
"Host.enable" : {
|
||||
@ -266,9 +270,8 @@ var host_buttons = {
|
||||
condition : True
|
||||
},
|
||||
"Host.disable" : {
|
||||
type: "confirm",
|
||||
type: "action",
|
||||
text: "Disable",
|
||||
tip: "This will disable the selected hosts.",
|
||||
condition : True
|
||||
},
|
||||
"Cluster.create_dialog" : {
|
||||
@ -295,7 +298,6 @@ var host_buttons = {
|
||||
"Cluster.removehost" : {
|
||||
type: "action",
|
||||
text: "Remove host from cluster",
|
||||
value: "Cluster.removehost",
|
||||
condition: True
|
||||
}},
|
||||
condition : True
|
||||
@ -324,15 +326,10 @@ for (action in host_actions){
|
||||
}
|
||||
|
||||
// title, content, buttons, id
|
||||
Sunstone.addMainTab('Hosts',hosts_tab_content,host_buttons,'hosts_tab');
|
||||
Sunstone.addMainTab('hosts_tab','Hosts',hosts_tab_content,host_buttons);
|
||||
Sunstone.addInfoPanel("host_info_panel",host_info_panel);
|
||||
|
||||
|
||||
//Plugin functions
|
||||
function host_update_callback(req){
|
||||
OpenNebula.Host.show({data:{id:req.request.data[0]},success: updateHostElement,error: onError});
|
||||
}
|
||||
|
||||
function hostElementArray(host_json){
|
||||
host = host_json.HOST;
|
||||
acpu = parseInt(host.HOST_SHARE.MAX_CPU);
|
||||
@ -382,18 +379,6 @@ function hostElementArray(host_json){
|
||||
pb_mem,
|
||||
OpenNebula.Helper.resource_state("host",host.STATE) ];
|
||||
|
||||
|
||||
//~ return [ '<input type="checkbox" id="host_'+host.ID+'" name="selected_items" value="'+host.ID+'"/>',
|
||||
//~ host.ID,
|
||||
//~ host.NAME,
|
||||
//~ host.CLUSTER,
|
||||
//~ host.HOST_SHARE.RUNNING_VMS, //rvm
|
||||
//~ host.HOST_SHARE.MAX_CPU, //tcpu
|
||||
//~ parseInt(host.HOST_SHARE.MAX_CPU) - parseInt(host.HOST_SHARE.USED_CPU), //fcpu
|
||||
//~ acpu,
|
||||
//~ humanize_size(host.HOST_SHARE.MAX_MEM),
|
||||
//~ humanize_size(host.HOST_SHARE.FREE_MEM),
|
||||
//~ OpenNebula.Helper.resource_state("host",host.STATE) ];
|
||||
}
|
||||
|
||||
|
||||
@ -557,9 +542,9 @@ function updateHostInfo(request,host){
|
||||
'</table>'
|
||||
}
|
||||
|
||||
Sunstone.updateInfoTab("host_info_panel","info_host_tab",info_host_tab);
|
||||
Sunstone.updateInfoTab("host_info_panel","host_template_tab",host_template_tab);
|
||||
popDialog(Sunstone.getInfoPanelHTML("host_info_panel"));
|
||||
Sunstone.updateInfoPanelTab("host_info_panel","info_host_tab",info_host_tab);
|
||||
Sunstone.updateInfoPanelTab("host_info_panel","host_template_tab",host_template_tab);
|
||||
Sunstone.popUpInfoPanel("host_info_panel");
|
||||
|
||||
}
|
||||
|
||||
|
389
src/sunstone/public/js/plugins/images-tab.js
Normal file
389
src/sunstone/public/js/plugins/images-tab.js
Normal file
@ -0,0 +1,389 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
|
||||
/* */
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
|
||||
/* not use this file except in compliance with the License. You may obtain */
|
||||
/* a copy of the License at */
|
||||
/* */
|
||||
/* http://www.apache.org/licenses/LICENSE-2.0 */
|
||||
/* */
|
||||
/* Unless required by applicable law or agreed to in writing, software */
|
||||
/* distributed under the License is distributed on an "AS IS" BASIS, */
|
||||
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
||||
/* See the License for the specific language governing permissions and */
|
||||
/* limitations under the License. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/*Images tab plugin*/
|
||||
|
||||
var images_tab_content =
|
||||
'<form id="image_form" action="" action="javascript:alert(\'js error!\');">\
|
||||
<div class="action_blocks">\
|
||||
</div>\
|
||||
<table id="datatable_images" class="display">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
<th class="check"><input type="checkbox" class="check_all" value="">All</input></th>\
|
||||
<th>ID</th>\
|
||||
<th>User</th>\
|
||||
<th>Name</th>\
|
||||
<th>Type</th>\
|
||||
<th>Registration time</th>\
|
||||
<th>Public</th>\
|
||||
<th>Persistent</th>\
|
||||
<th>State</th>\
|
||||
<th>#VMS</th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody id="tbodyimages">\
|
||||
</tbody>\
|
||||
</table>\
|
||||
</form>';
|
||||
|
||||
var create_image_tmpl =
|
||||
'<div id="img_tabs">\
|
||||
<ul><li><a href="#img_easy">Wizard</a></li>\
|
||||
<li><a href="#img_manual">Advanced mode</a></li>\
|
||||
</ul>\
|
||||
<div id="img_easy">\
|
||||
<form id="create_image_form_easy" action="">\
|
||||
<p style="font-size:0.8em;text-align:right;"><i>Fields marked with <span style="display:inline-block;" class="ui-icon ui-icon-alert" /> are mandatory</i><br />\
|
||||
<fieldset>\
|
||||
<div class="img_param img_man">\
|
||||
<label for="img_name">Name:</label>\
|
||||
<input type="text" name="img_name" id="img_name" />\
|
||||
<div class="tip">Name that the Image will get. Every image must have a unique name.</div>\
|
||||
</div>\
|
||||
<div class="img_param">\
|
||||
<label for="img_desc">Description:</label>\
|
||||
<input type="text" name="img_desc" id="img_desc" />\
|
||||
<div class="tip">Human readable description of the image for other users.</div>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="img_param">\
|
||||
<label for="img_type">Type:</label>\
|
||||
<select name="img_type" id="img_type">\
|
||||
<option value="OS">OS</option>\
|
||||
<option value="CDROM">CD-ROM</option>\
|
||||
<option value="DATABLOCK">Datablock</option>\
|
||||
</select>\
|
||||
<div class="tip">Type of the image, explained in detail in the following section. If omitted, the default value is the one defined in oned.conf (install default is OS).</div>\
|
||||
</div>\
|
||||
<div class="img_param">\
|
||||
<label for="img_public">Public:</label>\
|
||||
<input type="checkbox" id="img_public" name="img_public" value="YES" />\
|
||||
<div class="tip">Public scope of the image</div>\
|
||||
</div>\
|
||||
<div class="img_param">\
|
||||
<label for="img_persistent">Persistent:</label>\
|
||||
<input type="checkbox" id="img_persistent" name="img_persistent" value="YES" />\
|
||||
<div class="tip">Persistence of the image</div>\
|
||||
</div>\
|
||||
<div class="img_param">\
|
||||
<label for="img_dev_prefix">Device prefix:</label>\
|
||||
<input type="text" name="img_dev_prefix" id="img_dev_prefix" />\
|
||||
<div class="tip">Prefix for the emulated device this image will be mounted at. For instance, “hd”, “sd”. If omitted, the default value is the one defined in oned.conf (installation default is “hd”).</div>\
|
||||
</div>\
|
||||
<div class="img_param">\
|
||||
<label for="img_bus">Bus:</label>\
|
||||
<select name="img_bus" id="img_bus">\
|
||||
<option value="IDE">IDE</option>\
|
||||
<option value="SCSI">SCSI</option>\
|
||||
<option value="virtio">Virtio (KVM)</option>\
|
||||
</select>\
|
||||
<div class="tip">Type of disk device to emulate.</div>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="" id="src_path_select">\
|
||||
<label style="height:3em;">Path vs. source:</label>\
|
||||
<input type="radio" name="src_path" id="path_img" value="path" />\
|
||||
<label style="float:none">Provide a path</label><br />\
|
||||
<input type="radio" name="src_path" id="source_img" value="source" />\
|
||||
<label style="float:none">Provide a source</label><br />\
|
||||
<input type="radio" name="src_path" id="datablock_img" value="datablock" />\
|
||||
<label style="float:none;vertical-align:top">Create an empty datablock</label>\
|
||||
<div class="tip">Please choose path if you have a file-based image. Choose source otherwise or create an empty datablock disk.</div><br />\
|
||||
</div>\
|
||||
<div class="img_param">\
|
||||
<label for="img_path">Path:</label>\
|
||||
<input type="text" name="img_path" id="img_path" />\
|
||||
<div class="tip">Path to the original file that will be copied to the image repository. If not specified for a DATABLOCK type image, an empty image will be created.</div>\
|
||||
</div>\
|
||||
<div class="img_param">\
|
||||
<label for="img_source">Source:</label>\
|
||||
<input type="text" name="img_source" id="img_source" />\
|
||||
<div class="tip">Source to be used in the DISK attribute. Useful for not file-based images.</div>\
|
||||
</div>\
|
||||
<div class="img_size">\
|
||||
<label for="img_size">Size:</label>\
|
||||
<input type="text" name="img_size" id="img_size" />\
|
||||
<div class="tip">Size of the datablock in MB.</div>\
|
||||
</div>\
|
||||
<div class="img_param">\
|
||||
<label for="img_fstype">FS type:</label>\
|
||||
<input type="text" name="img_fstype" id="img_fstype" />\
|
||||
<div class="tip">Type of file system to be built. This can be any value understood by mkfs unix command.</div>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="form_buttons">\
|
||||
<button class="button" id="create_image_submit" value="user/create">Create</button>\
|
||||
<button class="button" type="reset" value="reset">Reset</button>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</form>\
|
||||
</div>\
|
||||
<div id="img_manual">\
|
||||
<form id="create_image_form_manual" action="">\
|
||||
<fieldset style="border-top:none;">\
|
||||
<h3 style="margin-bottom:10px;">Write the image template here</h3>\
|
||||
<textarea id="template" rows="15" style="width:100%;">\
|
||||
</textarea>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="form_buttons">\
|
||||
<button class="button" id="create_vn_submit_manual" value="vn/create">\
|
||||
Create\
|
||||
</button>\
|
||||
<button class="button" type="reset" value="reset">Reset</button>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</form>\
|
||||
</div>\
|
||||
</div>';
|
||||
|
||||
var images_select = "";
|
||||
var image_list_json = {};
|
||||
var dataTable_images;
|
||||
|
||||
var image_actions = {
|
||||
|
||||
"Image.create" : {
|
||||
type: "create",
|
||||
call: OpenNebula.Image.create,
|
||||
callback: addImageElement,
|
||||
error: onError,
|
||||
notify: False,
|
||||
},
|
||||
|
||||
"Image.create_dialog" : {
|
||||
type: "custom",
|
||||
call: popUpCreateImageDialog
|
||||
},
|
||||
|
||||
"Image.list" : {
|
||||
type: "list",
|
||||
call: OpenNebula.Image.list,
|
||||
callback: updateImagesView,
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Image.show" : {
|
||||
type : "single",
|
||||
call: OpenNebula.Image.show,
|
||||
callback: updateImageElement,
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Image.showinfo" : {
|
||||
type: "single",
|
||||
call: OpenNebula.Image.show,
|
||||
callback: updateImageInfo,
|
||||
error: onError,
|
||||
notify : False
|
||||
},
|
||||
|
||||
"Image.refresh" : {
|
||||
type: "custom",
|
||||
call: function () {
|
||||
waitingNodes(dataTable_images);
|
||||
Sunstone.runAction("Image.list");
|
||||
},
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Image.addattr" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Image.addattr,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_images},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Image.addattr_dialog" : {
|
||||
type: "custom",
|
||||
call: popUpImageAddattrDialog
|
||||
},
|
||||
|
||||
"Image.rmattr" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Image.rmattr,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_images},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Image.rmattr_dialog" : {
|
||||
type: "custom"
|
||||
call: popUpImageRmattrDialog,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Image.enable" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Image.enable,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_images},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Image.disable" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Image.disable,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_images},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Image.persistent" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Image.persistent,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_images},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Image.nonpersistent" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Image.nonpersistent,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_images},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Image.publish" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Image.publish,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_images},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Image.unpublish" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Image.unpublish,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_images},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Image.delete" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Image.delete,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_images},
|
||||
error: onError,
|
||||
notify: False
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var image_buttons = {
|
||||
"Image.refresh" : {
|
||||
type: "image",
|
||||
text: "Refresh list",
|
||||
img: "/images/Refresh-icon.png",
|
||||
condition: True
|
||||
},
|
||||
"Image.create_dialog" : {
|
||||
type: "create_dialog",
|
||||
text: "+ New",
|
||||
condition: True
|
||||
},
|
||||
"Image.addattr_dialog" : {
|
||||
type: "action",
|
||||
text: "Add attribute",
|
||||
condition: True
|
||||
},
|
||||
"Image.addattr_dialog" : {
|
||||
type: "action",
|
||||
text: "Update attribute",
|
||||
condition: True
|
||||
},
|
||||
"Image.rmattr_dialog:" : {
|
||||
type: "action",
|
||||
text: "Remove attribute",
|
||||
condition: True
|
||||
},
|
||||
"action_list" : {
|
||||
type: "select",
|
||||
condition: True,
|
||||
actions: {
|
||||
"Image.enable" : {
|
||||
type: "action",
|
||||
text: "Enable",
|
||||
condition: True
|
||||
},
|
||||
"Image.disable" : {
|
||||
type: "action",
|
||||
text: "Disable",
|
||||
condition: True
|
||||
},
|
||||
"Image.publish" : {
|
||||
type: "action",
|
||||
text: "Publish",
|
||||
condition: True
|
||||
},
|
||||
"Image.unpublish" : {
|
||||
type: "action",
|
||||
text: "Unpublish",
|
||||
condition: True
|
||||
},
|
||||
"Image.persistent" : {
|
||||
type: "action",
|
||||
text: "Make persistent",
|
||||
condition: True
|
||||
},
|
||||
"Image.nonpersistent" : {
|
||||
type: "action",
|
||||
text: "Make non persistent",
|
||||
condition: True
|
||||
}
|
||||
}
|
||||
},
|
||||
"Image.delete" : {
|
||||
type: "action",
|
||||
text: "Delete",
|
||||
condition: True
|
||||
}
|
||||
}
|
114
src/sunstone/public/js/plugins/users-tab.js
Normal file
114
src/sunstone/public/js/plugins/users-tab.js
Normal file
@ -0,0 +1,114 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
|
||||
/* */
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
|
||||
/* not use this file except in compliance with the License. You may obtain */
|
||||
/* a copy of the License at */
|
||||
/* */
|
||||
/* http://www.apache.org/licenses/LICENSE-2.0 */
|
||||
/* */
|
||||
/* Unless required by applicable law or agreed to in writing, software */
|
||||
/* distributed under the License is distributed on an "AS IS" BASIS, */
|
||||
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
||||
/* See the License for the specific language governing permissions and */
|
||||
/* limitations under the License. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/*Users tab plugin*/
|
||||
|
||||
var users_tab_content =
|
||||
'<form id="user_form" action="" action="javascript:alert(\'js error!\');">\
|
||||
<div class="action_blocks">\
|
||||
</div>\
|
||||
<table id="datatable_users" class="display">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
<th class="check"><input type="checkbox" class="check_all" value="">All</input></th>\
|
||||
<th>ID</th>\
|
||||
<th>Name</th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody id="tbodyusers">\
|
||||
</tbody>\
|
||||
</table>\
|
||||
</form>';
|
||||
|
||||
var create_user_tmpl =
|
||||
'<form id="create_user_form" action="">\
|
||||
<fieldset>\
|
||||
<div>\
|
||||
<label for="username">Username:</label>\
|
||||
<input type="text" name="username" id="username" /><br />\
|
||||
<label for="pass">Password:</label>\
|
||||
<input type="password" name="pass" id="pass" />\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="form_buttons">\
|
||||
<button class="button" id="create_user_submit" value="user/create">Create</button>\
|
||||
<button class="button" type="reset" value="reset">Reset</button>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</form>';
|
||||
|
||||
var user_list_json = {};
|
||||
var dataTable_users;
|
||||
|
||||
var user_actions = {
|
||||
"User.create" : {
|
||||
type: "create",
|
||||
call: OpenNebula.User.create,
|
||||
callback: addUserElement,
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"User.create_dialog" : {
|
||||
type: "custom",
|
||||
call: popUpCreateUserDialog
|
||||
},
|
||||
|
||||
"User.list" : {
|
||||
type: "list",
|
||||
call: OpenNebula.User.list
|
||||
callback: updateUsersView,
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"User.refresh" : {
|
||||
type: "custom",
|
||||
call: function () {
|
||||
waitingNodes(dataTable_users);
|
||||
Sunstone.runAction("User.list");
|
||||
}
|
||||
},
|
||||
|
||||
"User.delete" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.User.delete,
|
||||
callback: deleteUserElement,
|
||||
dataTable: function(){return dataTable_users},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
}
|
||||
|
||||
var user_buttons = {
|
||||
"User.refresh" : {
|
||||
type: "image",
|
||||
text: "Refresh list",
|
||||
img: "/images/Refresh-icon.png",
|
||||
condition: True
|
||||
},
|
||||
"User.create_dialog" : {
|
||||
type: "create_dialog",
|
||||
text: "+ New",
|
||||
condition: True
|
||||
},
|
||||
"User.delete" : {
|
||||
type: "action",
|
||||
text: "Delete",
|
||||
condition: True
|
||||
}
|
||||
}
|
776
src/sunstone/public/js/plugins/vms-tab.js
Normal file
776
src/sunstone/public/js/plugins/vms-tab.js
Normal file
@ -0,0 +1,776 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
|
||||
/* */
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
|
||||
/* not use this file except in compliance with the License. You may obtain */
|
||||
/* a copy of the License at */
|
||||
/* */
|
||||
/* http://www.apache.org/licenses/LICENSE-2.0 */
|
||||
/* */
|
||||
/* Unless required by applicable law or agreed to in writing, software */
|
||||
/* distributed under the License is distributed on an "AS IS" BASIS, */
|
||||
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
||||
/* See the License for the specific language governing permissions and */
|
||||
/* limitations under the License. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/*Virtual Machines tab plugin*/
|
||||
|
||||
var vms_tab_content =
|
||||
'<form id="virtualMachine_list" action="javascript:alert(\'js error!\');">\
|
||||
<div class="action_blocks">\
|
||||
</div>\
|
||||
<table id="datatable_vmachines" class="display">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
<th class="check"><input type="checkbox" class="check_all" value="">All</input></th>\
|
||||
<th>ID</th>\
|
||||
<th>User</th>\
|
||||
<th>Name</th>\
|
||||
<th>Status</th>\
|
||||
<th>CPU</th>\
|
||||
<th>Memory</th>\
|
||||
<th>Hostname</th>\
|
||||
<th>Start Time</th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody id="tbodyvmachines">\
|
||||
</tbody>\
|
||||
</table>\
|
||||
</form>';
|
||||
|
||||
var create_vm_tmpl =
|
||||
'<div id="vm_create_tabs">\
|
||||
<ul>\
|
||||
<li><a href="#easy">Wizard KVM</a></li>\
|
||||
<li><a href="#easy">Wizard XEN</a></li>\
|
||||
<li><a href="#manual">VMWare</a></li>\
|
||||
<li><a href="#manual">Advanced mode</a></li>\
|
||||
</ul>\
|
||||
<div id="easy">\
|
||||
<form>\
|
||||
<div id="template_type" style="margin-bottom:1em;">\
|
||||
<!--\
|
||||
<div class="clear"></div>\
|
||||
<label for="template_type">Select VM type:</label>\
|
||||
<input type="radio" id="kvm" name="template_type" value="kvm">KVM</input>\
|
||||
<input type="radio" id="xen" name="template_type" value="xen">XEN</input>\
|
||||
<div class="clear"></div>\
|
||||
-->\
|
||||
<p style="font-size:0.8em;text-align:right;"><i>Fields marked with <span style="display:inline-block;" class="ui-icon ui-icon-alert" /> are mandatory</i><br />\
|
||||
<a href="#" id="fold_unfold_vm_params"><u>Fold / Unfold all sections</u></a></p>\
|
||||
</div>\
|
||||
\
|
||||
<!-- capacity section name, memory, cpu vcpu -->\
|
||||
<div class="vm_section" id="capacity">\
|
||||
<div class="show_hide" id="add_capacity_cb">\
|
||||
<h3>Capacity options</h3>\
|
||||
</div>\
|
||||
<fieldset><legend>Capacity</legend>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="NAME">Name:</label>\
|
||||
<input type="text" id="NAME" name="name"/>\
|
||||
<div class="tip"> Name that the VM will get for description purposes. If NAME is not supplied a name generated by one will be in the form of one-<VID>.</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="MEMORY">Memory:</label>\
|
||||
<input type="text" id="MEMORY" name="memory" size="4" />\
|
||||
<div class="tip">Amount of RAM required for the VM, in Megabytes.</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="CPU">CPU:</label>\
|
||||
<input type="text" id="CPU" name="cpu" size="2"/>\
|
||||
<div class="tip">Percentage of CPU divided by 100 required for the Virtual Machine. Half a processor is written 0.5.</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="VCPU">VCPU:</label>\
|
||||
<input type="text" id="VCPU" name="vcpu" size="3" />\
|
||||
<div class="tip">Number of virtual cpus. This value is optional, the default hypervisor behavior is used, usually one virtual CPU.</div>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</div>\
|
||||
<!-- OS and Boot options\
|
||||
arch, kernel, initrd, root, kernel_cmd, bootloader, boot\
|
||||
-->\
|
||||
<div class="vm_section" id="os_boot_opts">\
|
||||
<div class="show_hide" id="add_os_boot_opts_cb">\
|
||||
<h3>Boot/OS options <a id="add_os_boot_opts" class="icon_left" href="#"><span class="ui-icon ui-icon-plus" /></a></h3>\
|
||||
</div>\
|
||||
<fieldset><legend>OS and Boot options</legend>\
|
||||
<div class="vm_param kvm">\
|
||||
<label for="ARCH">Architecture:</label>\
|
||||
<select id="ARCH" name="arch">\
|
||||
<option value="i686">i686</option>\
|
||||
<option value="x86-64">x86-64</option>\
|
||||
</select>\
|
||||
<div class="tip">CPU architecture to virtualization</div>\
|
||||
</div>\
|
||||
<!--xen necesita kernel o bootloader.\
|
||||
Opciones de kernel son obligatorias si se activa kernel-->\
|
||||
<div class="" id="kernel_bootloader">\
|
||||
<label>Boot method:</label>\
|
||||
<select id="boot_method" name="boot_method">\
|
||||
<option id="no_boot" name="no_boot" value=""></option>\
|
||||
<option value="kernel">Kernel</option>\
|
||||
<option value="bootloader">Bootloader</option>\
|
||||
</select>\
|
||||
<div class="tip">Select boot method</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen kernel">\
|
||||
<label for="KERNEL">Kernel:</label>\
|
||||
<input type="text" id="KERNEL" name="kernel" />\
|
||||
<div class="tip">Path to the OS kernel to boot the image</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm xen kernel">\
|
||||
<label for="INITRD">Initrd:</label>\
|
||||
<input type="text" id="INITRD" name="initrd"/>\
|
||||
<div class="tip">Path to the initrd image</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm xen kernel">\
|
||||
<label for="ROOT">Root:</label>\
|
||||
<input type="text" id="ROOT" name="root"/>\
|
||||
<div class="tip">Device to be mounted as root</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm xen kernel">\
|
||||
<label for="KERNEL_CMD">Kernel commands:</label>\
|
||||
<input type="text" id="KERNEL_CMD" name="kernel_cmd" />\
|
||||
<div class="tip">Arguments for the booting kernel</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen bootloader">\
|
||||
<label for="BOOTLOADER">Bootloader:</label>\
|
||||
<input type="text" id="BOOTLOADER" name="bootloader" />\
|
||||
<div class="tip">Path to the bootloader executable</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm">\
|
||||
<label for="BOOT">Boot:</label>\
|
||||
<select id="BOOT" name="boot">\
|
||||
<option value="hd">hd</option>\
|
||||
<option value="hd">fd</option>\
|
||||
<option value="hd">cdrom</option>\
|
||||
<option value="hd">network</option>\
|
||||
</select>\
|
||||
<div class="tip">Boot device type</div>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</div>\
|
||||
\
|
||||
\
|
||||
<!--disks section using image or declaring\
|
||||
image, image ID, bus, target, driver\
|
||||
type, source, size, format, clone, save,\
|
||||
readonly SEVERAL DISKS-->\
|
||||
<div class="vm_section" id="disks">\
|
||||
<div class="show_hide" id="add_disks_cb">\
|
||||
<h3>Add disks/images <a id="add_disks" class="icon_left" href="#"><span class="ui-icon ui-icon-plus" /></a></h3>\
|
||||
</div>\
|
||||
<fieldset><legend>Disks</legend>\
|
||||
<div class="" id="image_vs_disk">\
|
||||
<label>Add disk/image</label>\
|
||||
<input type="radio" id="add_disk" name="image_vs_disk" value="disk">Disk</input>\
|
||||
<!--<label for="add_disk">Add a disk</label>-->\
|
||||
<input type="radio" id="add_image" name="image_vs_disk" value="image">Image</input>\
|
||||
<!--<label for="add_image">Add an image</label>-->\
|
||||
</div>\
|
||||
<div class="clear"></div>\
|
||||
<div class="vm_param kvm xen add_image">\
|
||||
<label for="IMAGE">Image:</label>\
|
||||
<select type="text" id="IMAGE" name="image">\
|
||||
</select>\
|
||||
<div class="tip">Name of the image to use</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="BUS">Bus:</label>\
|
||||
<select id="BUS" name="bus">\
|
||||
<option value="ide">IDE</option>\
|
||||
<option value="scsi">SCSI</option>\
|
||||
</select>\
|
||||
<div class="tip">Type of disk device to emulate: ide, scsi</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="TARGET">Target:</label>\
|
||||
<input type="text" id="TARGET" name="target" />\
|
||||
<div class="tip"> Device to map image disk. If set, it will overwrite the default device mapping</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="DRIVER">Driver:</label>\
|
||||
<input type="text" id="DRIVER" name="driver" />\
|
||||
<div class="tip">Specific image mapping driver. KVM: raw, qcow2. Xen:tap:aio:, file:. VMware unsupported</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt add_disk">\
|
||||
<label for="TYPE">Type:</label>\
|
||||
<select id="TYPE" name="type">\
|
||||
<option value="disk">Disk</option>\
|
||||
<option value="floppy">Floppy</option>\
|
||||
<option value="cdrom">CD-ROM</option>\
|
||||
<option value="swap">Swap</option>\
|
||||
<option value="fs">FS</option>\
|
||||
<option value="block">Block</option>\
|
||||
</select>\
|
||||
<div class="tip">Disk type</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm xen add_disk">\
|
||||
<label for="SOURCE">Source:</label>\
|
||||
<input type="text" id="SOURCE" name="source" />\
|
||||
<div class="tip">Disk file location path or URL</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt add_disk ">\
|
||||
<!--Mandatory for swap, fs and block images-->\
|
||||
<label for="SIZE">Size:</label>\
|
||||
<input type="text" id="SIZE" name="size" />\
|
||||
<div class="tip">Disk file location path or URL. Mandatory for swap, fs and block images</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt add_disk ">\
|
||||
<!--mandatory for fs images-->\
|
||||
<label for="FORMAT">Format:</label>\
|
||||
<input type="text" id="FORMAT" name="format" />\
|
||||
<div class="tip">Filesystem type for the fs images</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt add_disk">\
|
||||
<label for="CLONE">Clone:</label>\
|
||||
<select id="CLONE" name="clone">\
|
||||
<option value="yes">Yes</option>\
|
||||
<option value="no">No</option>\
|
||||
</select>\
|
||||
<div class="tip">Clone this image</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt add_disk">\
|
||||
<label for="SAVE">Save:</label>\
|
||||
<select id="SAVE" name="save">\
|
||||
<option value="no">No</option>\
|
||||
<option value="yes">Yes</option>\
|
||||
</select>\
|
||||
<div class="tip">Save this image after shutting down the VM</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt add_disk">\
|
||||
<label for="READONLY">Read only:</label>\
|
||||
<select id="READONLY" name="readonly">\
|
||||
<option value="no">No</option>\
|
||||
<option value="yes">Yes</option>\
|
||||
</select>\
|
||||
<div class="tip">Mount image as read-only</div>\
|
||||
</div>\
|
||||
<div class="">\
|
||||
<button class="add_remove_button add_button" id="add_disk_button" value="add_disk">Add</button>\
|
||||
<button class="add_remove_button" id="remove_disk_button" value="remove_disk">Remove selected</button>\
|
||||
<div class="clear"></div>\
|
||||
<label style="" for="disks_box">Current disks:</label>\
|
||||
<select id="disks_box" name="disks_box" style="width:150px;height:100px;" multiple>\
|
||||
</select>\
|
||||
<div class="clear"></div>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</div>\
|
||||
\
|
||||
<!-- network section network, network id,, ip, mac,\
|
||||
bridge, target, script, model -->\
|
||||
<div class="vm_section" id="networks">\
|
||||
<div class="show_hide" id="add_networks_cb">\
|
||||
<h3>Setup Networks <a id="add_networks" class="icon_left" href="#"><span class="ui-icon ui-icon-plus" /></a></h3>\
|
||||
</div>\
|
||||
<fieldset><legend>Network</legend>\
|
||||
<div class="" id="network_vs_niccfg">\
|
||||
<label>Add network</label>\
|
||||
<input type="radio" id="add_network" name="network_vs_niccfg" value="network">Predefined</input>\
|
||||
<!--<label style="width:200px;" for="add_network">Pre-defined network</label>-->\
|
||||
<input type="radio" id="add_niccfg" name="network_vs_niccfg" value="niccfg">Manual</input>\
|
||||
<!--<label for="add_niccfg">Manual network</label>-->\
|
||||
<!--<div class="tip"></div>-->\
|
||||
</div>\
|
||||
<div class="clear"></div>\
|
||||
<div class="vm_param kvm_opt xen_opt network">\
|
||||
<label for="NETWORK">Network:</label>\
|
||||
<select type="text" id="NETWORK" name="network">\
|
||||
</select>\
|
||||
<div class="tip">Name of the network to attach this device</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt niccfg">\
|
||||
<label for="IP">IP:</label>\
|
||||
<input type="text" id="IP" name="ip" />\
|
||||
<div class="tip">Request an specific IP from the Network</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt niccfg">\
|
||||
<label for="MAC">MAC:</label>\
|
||||
<input type="text" id="MAC" name="mac" />\
|
||||
<div class="tip">HW address associated with the network interface</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt niccfg">\
|
||||
<label for="BRIDGE">Bridge</label>\
|
||||
<input type="text" id="BRIDGE" name="bridge" />\
|
||||
<div class="tip"> Name of the bridge the network device is going to be attached to</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt niccfg">\
|
||||
<label for="TARGET">Target:</label>\
|
||||
<input type="text" id="TARGET" name="nic_target" />\
|
||||
<div class="tip">Name for the tun device created for the VM</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt niccfg">\
|
||||
<label for="SCRIPT">Script:</label>\
|
||||
<input type="text" id="SCRIPT" name="script" />\
|
||||
<div class="tip">Name of a shell script to be executed after creating the tun device for the VM</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt niccfg">\
|
||||
<label for="MODEL">Model:</label>\
|
||||
<input type="text" id="MODEL" name="model" />\
|
||||
<div class="tip">Hardware that will emulate this network interface. With Xen this is the type attribute of the vif.</div>\
|
||||
</div>\
|
||||
<div class="">\
|
||||
<button class="add_remove_button add_button" id="add_nic_button" value="add_nic">Add</button>\
|
||||
<button class="add_remove_button" id="remove_nic_button" value="remove_nic">Remove selected</button>\
|
||||
<div class="clear"></div>\
|
||||
<label for="nics_box">Current NICs:</label>\
|
||||
<select id="nics_box" name="nics_box" style="width:150px;height:100px;" multiple>\
|
||||
</select>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</div>\
|
||||
\
|
||||
\
|
||||
<!--Input several type, bus-->\
|
||||
<div class="vm_section" id="inputs">\
|
||||
<div class="show_hide" id="add_inputs_cb">\
|
||||
<h3>Add inputs <a id="add_inputs" class="icon_left" href="#"><span class="ui-icon ui-icon-plus" /></a></h3>\
|
||||
</div>\
|
||||
<fieldset><legend>Inputs</legend>\
|
||||
<div class="vm_param kvm_opt">\
|
||||
<label for="TYPE">Type:</label>\
|
||||
<select id="TYPE" name="input_type">\
|
||||
<option value="mouse">Mouse</option>\
|
||||
<option value="tablet">Tablet</option>\
|
||||
</select>\
|
||||
<div class="tip"></div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt">\
|
||||
<label for="BUS">Bus:</label>\
|
||||
<select id="BUS" name="input_bus">\
|
||||
<option value="usb">USB</option>\
|
||||
<option value="ps2">PS2</option>\
|
||||
<option value="xen">XEN</option>\
|
||||
</select>\
|
||||
<div class="tip"></div>\
|
||||
</div>\
|
||||
<div class="">\
|
||||
<button class="add_remove_button add_button" id="add_input_button" value="add_input" class="kvm_opt">Add</button>\
|
||||
<button class="add_remove_button" id="remove_input_button" value="remove_input" class="kvm_opt">Remove selected</button>\
|
||||
<div class="clear"></div>\
|
||||
<label for="inputs_box">Current inputs:</label>\
|
||||
<select id="inputs_box" name="inputs_box" style="width:150px;height:100px;" multiple>\
|
||||
</select>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</div>\
|
||||
\
|
||||
\
|
||||
<!--graphics type, listen, port, passwd, keymap -->\
|
||||
<div class="vm_section" id="graphics">\
|
||||
<div class="show_hide" id="add_graphics_cb">\
|
||||
<h3>Add Graphics <a id="add_graphics" class="icon_left" href="#"><span class="ui-icon ui-icon-plus" /></a></h3>\
|
||||
</div>\
|
||||
<fieldset><legend>Graphics</legend>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="TYPE">Graphics type:</label>\
|
||||
<select id="TYPE" name="">\
|
||||
<option value="">Please select</option>\
|
||||
<option id="vnc" value="vnc">VNC</option>\
|
||||
<option value="sdl">SDL</option>\
|
||||
</select>\
|
||||
<div class="tip"></div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="LISTEN">Listen IP:</label>\
|
||||
<input type="text" id="LISTEN" name="graphics_ip" />\
|
||||
<div class="tip">IP to listen on</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="PORT">Port:</label>\
|
||||
<input type="text" id="PORT" name="port" />\
|
||||
<div class="tip">Port for the VNC server</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="PASSWD">Password:</label>\
|
||||
<input type="text" id="PASSWD" name="graphics_pw" />\
|
||||
<div class="tip">Password for the VNC server</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="KEYMAP">Keymap</label>\
|
||||
<input type="text" id="KEYMAP" name="keymap" />\
|
||||
<div class="tip">Keyboard configuration locale to use in the VNC display</div>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</div>\
|
||||
\
|
||||
\
|
||||
<!--context textarea? -->\
|
||||
<div class="vm_section" id="context">\
|
||||
<div class="show_hide" id="add_context_cb">\
|
||||
<h3>Add context <a id="add_context" class="icon_left" href="#"><span class="ui-icon ui-icon-plus" /></a></h3>\
|
||||
</div>\
|
||||
<fieldset><legend>Context</legend>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="CONTEXT">Context:</label>\
|
||||
<input type="text" id="CONTEXT" name="context" />\
|
||||
<!--<textarea id="CONTEXT" style="width:320px;height:15em;"></textarea>-->\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</div>\
|
||||
\
|
||||
\
|
||||
<!--placement requirements rank -->\
|
||||
<div class="vm_section" id="placement">\
|
||||
<div class="show_hide" id="add_placement_cb">\
|
||||
<h3>Add placement options <a id="add_placement" class="icon_left" href="#"><span class="ui-icon ui-icon-plus" /></a></h3>\
|
||||
</div>\
|
||||
<fieldset><legend>Placement</legend>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="REQUIREMENTS">Requirements:</label>\
|
||||
<input type="text" id="REQUIREMENTS" name="requirements" />\
|
||||
<div class="tip">Boolean expression that rules out provisioning hosts from list of machines suitable to run this VM</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="RANK">Rank:</label>\
|
||||
<input type="text" id="RANK" name="rank" />\
|
||||
<div class="tip"> This field sets which attribute will be used to sort the suitable hosts for this VM. Basically, it defines which hosts are more suitable than others</div>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</div>\
|
||||
\
|
||||
\
|
||||
<!--raw type=> set to current, data -->\
|
||||
<div class="vm_section" id="raw">\
|
||||
<div class="show_hide" id="add_raw_cb">\
|
||||
<h3>Add Hypervisor raw options <a id="add_raw" class="icon_left" href="#"><span class="ui-icon ui-icon-plus" /></a></h3>\
|
||||
</div>\
|
||||
<fieldset><legend>Raw</legend>\
|
||||
<!--set TYPE to current xen/kvm -->\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<label for="DATA">Data:</label>\
|
||||
<input type="hidden" id="TYPE" name="type" />\
|
||||
<input type="text" id="DATA" name="data" />\
|
||||
<div class="tip"> Raw data to be passed directly to the hypervisor</div>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</div>\
|
||||
\
|
||||
\
|
||||
<!-- submit -->\
|
||||
<fieldset>\
|
||||
<div class="form_buttons">\
|
||||
<button class="button" id="create_vm_form_easy" value="OpenNebula.VM.create">\
|
||||
Create\
|
||||
</button>\
|
||||
<button class="button" id="reset" type="reset" value="reset">Reset</button>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</form>\
|
||||
</div><!--easy mode -->\
|
||||
<div id="manual">\
|
||||
<form>\
|
||||
<h3 style="margin-bottom:10px;">Write the Virtual Machine template here</h3>\
|
||||
<fieldset style="border-top:none;">\
|
||||
<textarea id="textarea_vm_template" style="width:100%; height:15em;"></textarea>\
|
||||
<div class="clear"></div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="form_buttons">\
|
||||
<button class="button" id="create_vm_form_manual" value="OpenNebula.VM.create">\
|
||||
Create\
|
||||
</button>\
|
||||
<button class="button" type="reset" value="reset">Reset</button>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</form>\
|
||||
</div>\
|
||||
</div>';
|
||||
|
||||
var vmachine_list_json = {};
|
||||
var dataTable_vMachines;
|
||||
|
||||
var vm_actions = {
|
||||
"VM.create" : {
|
||||
type: "create",
|
||||
call: OpenNebula.VM.create,
|
||||
callback: addVMachineElement,
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.create_dialog" : {
|
||||
type: "custom"
|
||||
call: popUpCreateVMDialog,
|
||||
},
|
||||
|
||||
"VM.list" : {
|
||||
type: "list"
|
||||
call: OpenNebula.VM.list,
|
||||
callback: updateVMachinesView,
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.show" : {
|
||||
type: "single",
|
||||
call: OpenNebula.VM.show,
|
||||
callback: updateVMachineElement,
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.showinfo" : {
|
||||
type: "single",
|
||||
call: OpenNebula.VM.show,
|
||||
callback: updateVMInfo,
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.refresh" : {
|
||||
type: "custom",
|
||||
call : function (){
|
||||
waitingNodes(dataTable_vMachines);
|
||||
Sunstone.runAction("VM.list");
|
||||
},
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.deploy" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.VM.deploy,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("VM.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_vMachines},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.migrate" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.VM.migrate,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("VM.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_vMachines},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.livemigrate" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.VM.livemigrate,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("VM.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_vMachines},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.hold" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.VM.hold,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("VM.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_vMachines},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.release" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.VM.release,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("VM.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_vMachines},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.suspend" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.VM.suspend,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("VM.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_vMachines},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.resume" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.VM.resume,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("VM.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_vMachines},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.stop" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.VM.stop,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("VM.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_vMachines},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.restart" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.VM.restart,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("VM.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_vMachines},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.shutdown" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.VM.shutdown,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("VM.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_vMachines},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.cancel" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.VM.cancel,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("VM.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function(){return dataTable_vMachines},
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"VM.delete" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.VM.delete,
|
||||
callback: deleteVMachineElement,
|
||||
dataTable: function(){return dataTable_vMachines},
|
||||
error: onError,
|
||||
notify: False
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var vm_buttons = {
|
||||
"VM.refresh" : {
|
||||
type: "image",
|
||||
text: "Refresh list",
|
||||
img: "/images/Refresh-icon.png",
|
||||
condition: True
|
||||
},
|
||||
|
||||
"VM.create_dialog" : {
|
||||
type: "create_dialog",
|
||||
text: "+ New",
|
||||
condition: True
|
||||
},
|
||||
|
||||
"VM.shutdown" : {
|
||||
type: "confirm",
|
||||
text: "Shutdown",
|
||||
tip: "This will initiate the shutdown process in the selected VMs",
|
||||
condition: True
|
||||
},
|
||||
|
||||
"action_list" : {
|
||||
type: "select",
|
||||
actions: {
|
||||
"VM.deploy" : {
|
||||
type: "confirm_with_select",
|
||||
text: "Deploy",
|
||||
tip: "This will deploy the selected VMs on the chosen host",
|
||||
select: function(){
|
||||
if (hosts_select){return hosts_select}
|
||||
else {return ""}
|
||||
},
|
||||
condition: True
|
||||
},
|
||||
"VM.migrate" : {
|
||||
type: "confirm_with_select",
|
||||
text: "Migrate",
|
||||
tip: "This will migrate the selected VMs to the chosen host",
|
||||
select: function(){
|
||||
if (hosts_select){return hosts_select}
|
||||
else {return ""}
|
||||
},
|
||||
condition: True
|
||||
|
||||
},
|
||||
"VM.livemigrate" : {
|
||||
type: "confirm_with_select",
|
||||
text: "Live migrate",
|
||||
tip: "This will live-migrate the selected VMs to the chosen host",
|
||||
select: function(){
|
||||
if (hosts_select){return hosts_select}
|
||||
else {return ""}
|
||||
},
|
||||
condition: True
|
||||
},
|
||||
"VM.hold" : {
|
||||
type: "confirm",
|
||||
text: "Hold",
|
||||
tip: "This will hold selected pending VMs from being deployed",
|
||||
condition: True
|
||||
},
|
||||
"VM.release" : {
|
||||
type: "confirm",
|
||||
text: "Release",
|
||||
tip: "This will release held machines",
|
||||
condition: True
|
||||
},
|
||||
"VM.suspend" : {
|
||||
type: "confirm",
|
||||
text: "Suspend",
|
||||
tip: "This will suspend selected machines",
|
||||
condition: True
|
||||
},
|
||||
"VM.resume" : {
|
||||
type: "confirm",
|
||||
text: "Resume",
|
||||
tip: "This will resume selected stopped or suspended VMs",
|
||||
condition: True
|
||||
},
|
||||
"VM.stop" : {
|
||||
type: "confirm",
|
||||
text: "Stop",
|
||||
tip: "This will stop selected VMs",
|
||||
condition: True
|
||||
},
|
||||
"VM.restart" : {
|
||||
type: "confirm",
|
||||
text: "Restart",
|
||||
tip: "This will redeploy selected VMs (in UNKNOWN or BOOT state)",
|
||||
condition: True
|
||||
},
|
||||
"VM.cancel" : {
|
||||
type: "confirm",
|
||||
text: "Cancel",
|
||||
tip: "This will cancel selected VMs",
|
||||
condition: True
|
||||
}
|
||||
},
|
||||
condition: True
|
||||
},
|
||||
|
||||
"VM.delete" : {
|
||||
type: "confirm",
|
||||
text: "Delete",
|
||||
tip: "This will delete the selected VMs from the database"
|
||||
condition: True
|
||||
}
|
||||
}
|
242
src/sunstone/public/js/plugins/vnets-tab.js
Normal file
242
src/sunstone/public/js/plugins/vnets-tab.js
Normal file
@ -0,0 +1,242 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
|
||||
/* */
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
|
||||
/* not use this file except in compliance with the License. You may obtain */
|
||||
/* a copy of the License at */
|
||||
/* */
|
||||
/* http://www.apache.org/licenses/LICENSE-2.0 */
|
||||
/* */
|
||||
/* Unless required by applicable law or agreed to in writing, software */
|
||||
/* distributed under the License is distributed on an "AS IS" BASIS, */
|
||||
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
||||
/* See the License for the specific language governing permissions and */
|
||||
/* limitations under the License. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/*Virtual networks tab plugin*/
|
||||
|
||||
var vnets_tab_content =
|
||||
'<form id="virtualNetworks_form" action="javascript:alert(\'js error!\');">\
|
||||
<div class="action_blocks">\
|
||||
</div>\
|
||||
<table id="datatable_vnetworks" class="display">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
<th class="check"><input type="checkbox" class="check_all" value="">All</input></th>\
|
||||
<th>ID</th>\
|
||||
<th>User</th>\
|
||||
<th>Name</th>\
|
||||
<th>Type</th>\
|
||||
<th>Bridge</th>\
|
||||
<th>Public?</th>\
|
||||
<th>Total Leases</th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody id="tbodyvnetworks">\
|
||||
</tbody>\
|
||||
</table>\
|
||||
</form>';
|
||||
|
||||
var create_vn_tmpl =
|
||||
'<div id="vn_tabs">\
|
||||
<ul>\
|
||||
<li><a href="#easy">Wizard</a></li>\
|
||||
<li><a href="#manual">Advanced mode</a></li>\
|
||||
</ul>\
|
||||
<div id="easy">\
|
||||
<form id="create_vn_form_easy" action="">\
|
||||
<fieldset>\
|
||||
<label for="name">Name:</label>\
|
||||
<input type="text" name="name" id="name" /><br />\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<label for="bridge">Bridge:</label>\
|
||||
<input type="text" name="bridge" id="bridge" /><br />\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<label style="height:2em;">Network type:</label>\
|
||||
<input type="radio" name="fixed_ranged" id="fixed_check" value="fixed" checked="checked">Fixed network</input><br />\
|
||||
<input type="radio" name="fixed_ranged" id="ranged_check" value="ranged">Ranged network</input><br />\
|
||||
</fieldset>\
|
||||
<div class="clear"></div>\
|
||||
<div id="easy_tabs">\
|
||||
<div id="fixed">\
|
||||
<fieldset>\
|
||||
<label for="leaseip">Lease IP:</label>\
|
||||
<input type="text" name="leaseip" id="leaseip" /><br />\
|
||||
<label for="leasemac">Lease MAC (opt):</label>\
|
||||
<input type="text" name="leasemac" id="leasemac" />\
|
||||
<div class="clear"></div>\
|
||||
<button class="add_remove_button add_button" id="add_lease" value="add/lease">\
|
||||
Add\
|
||||
</button>\
|
||||
<button class="add_remove_button" id="remove_lease" value="remove/lease">\
|
||||
Remove selected\
|
||||
</button>\
|
||||
<label for="leases">Current leases:</label>\
|
||||
<select id="leases" name="leases" size="10" style="width:150px" multiple>\
|
||||
<!-- insert leases -->\
|
||||
</select><br />\
|
||||
</fieldset>\
|
||||
</div>\
|
||||
<div id="ranged">\
|
||||
<fieldset>\
|
||||
<label for="net_address">Network Address:</label>\
|
||||
<input type="text" name="net_address" id="net_address" /><br />\
|
||||
<label for="net_size">Network size:</label>\
|
||||
<input type="text" name="net_size" id="net_size" />\
|
||||
</fieldset>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="clear"></div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="form_buttons">\
|
||||
<button class="button" id="create_vn_submit_easy" value="vn/create">\
|
||||
Create\
|
||||
</button>\
|
||||
<button class="button" type="reset" value="reset">Reset</button>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</form>\
|
||||
</div>\
|
||||
<div id="manual">\
|
||||
<form id="create_vn_form_manual" action="">\
|
||||
<h3 style="margin-bottom:10px;">Write the Virtual Network template here</h3>\
|
||||
<fieldset style="border-top:none;">\
|
||||
<textarea id="template" rows="15" style="width:100%;"></textarea>\
|
||||
<div class="clear"></div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="form_buttons">\
|
||||
<button class="button" id="create_vn_submit_manual" value="vn/create">\
|
||||
Create\
|
||||
</button>\
|
||||
<button class="button" type="reset" value="reset">Reset</button>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
</form>\
|
||||
</div>\
|
||||
</div>';
|
||||
|
||||
var vnetworks_select="";
|
||||
var network_list_json = {};
|
||||
var dataTable_vNetworks;
|
||||
|
||||
//Setup actions
|
||||
|
||||
var vnet_actions = {
|
||||
"Network.create" : {
|
||||
type: "create",
|
||||
call: OpenNebula.Network.create,
|
||||
callback: addVNetworkElement,
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Network.create_dialog" : {
|
||||
type: "custom",
|
||||
call: popUpCreateNetworkDialog
|
||||
},
|
||||
|
||||
"Network.list" : {
|
||||
type: "list",
|
||||
call: OpenNebula.Network.list,
|
||||
callback: updateVNetworksView,
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Network.show" : {
|
||||
type: "single",
|
||||
call: OpenNebula.Network.show,
|
||||
callback: updateVNetworkElement,
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Network.showinfo" : {
|
||||
type: "single",
|
||||
call: OpenNebula.Network.show,
|
||||
callback: updateVNetworkInfo,
|
||||
error: onError,
|
||||
notify: False
|
||||
}
|
||||
},
|
||||
|
||||
"Network.refresh" : {
|
||||
type: "custom",
|
||||
call: function(){
|
||||
waitingNodes(dataTable_vNetworks);
|
||||
Sunstone.runAction("Network.list");
|
||||
},
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Network.publish" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Network.publish,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("Network.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function() { return dataTable_vNetworks; },
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Network.unpublish" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Network.unpublish,
|
||||
callback: function (req) {
|
||||
Sunstone.runAction("Network.show",req.request.data[0]);
|
||||
},
|
||||
dataTable: function() { return dataTable_vNetworks; },
|
||||
error: onError,
|
||||
notify: False
|
||||
},
|
||||
|
||||
"Network.delete" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Network.delete,
|
||||
callback: deleteVNetworkElement,
|
||||
dataTable: function() { return dataTable_vNetworks; },
|
||||
error: onError,
|
||||
notify: False
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
var vnet_buttons = {
|
||||
"Network.refresh" : {
|
||||
type: "image",
|
||||
text: "Refresh list",
|
||||
img: "/images/Refresh-icon.png",
|
||||
condition: True
|
||||
},
|
||||
|
||||
"Network.create_dialog" : {
|
||||
type: "create_dialog",
|
||||
text: "+ New",
|
||||
condition: True
|
||||
},
|
||||
|
||||
"Network.publish" : {
|
||||
type: "action",
|
||||
text: "Publish",
|
||||
condition: True
|
||||
},
|
||||
|
||||
"Network.unpublish" : {
|
||||
type: "action",
|
||||
text: "Unpublish",
|
||||
condition: True
|
||||
},
|
||||
|
||||
"Network.delete" : {
|
||||
type: "action",
|
||||
text: "Delete",
|
||||
condition: True
|
||||
}
|
||||
}
|
@ -45,26 +45,43 @@ var Sunstone = {
|
||||
SunstoneCfg["actions"][name] = action_obj;
|
||||
},
|
||||
|
||||
"updateAction" : function(action,new_action) {
|
||||
|
||||
"updateAction" : function(name,action_obj) {
|
||||
SunstoneCfg["actions"][name] = action_obj;
|
||||
},
|
||||
|
||||
"removeAction" : function(action) {
|
||||
|
||||
SunstoneCfg["actions"][action] = null;
|
||||
},
|
||||
|
||||
"addMainTab" : function(title_arg,content_arg, buttons_arg,tab_id) {
|
||||
"addMainTab" : function(tab_id,title_arg,content_arg, buttons_arg,refresh) {
|
||||
SunstoneCfg["tabs"][tab_id] = {title: title_arg,
|
||||
content: content_arg,
|
||||
buttons: buttons_arg };
|
||||
if (refresh){
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
"updateMainTab" : function(tab_id,new_content){
|
||||
|
||||
"updateMainTabContent" : function(tab_id,content_arg,refresh){
|
||||
SunstoneCfg["tabs"][tab_id]["content"]=content_arg;
|
||||
if (refresh){
|
||||
$('div#'+tab).html(tab_info.content);
|
||||
}
|
||||
},
|
||||
|
||||
"removeMainTab" : function(tab_id) {
|
||||
|
||||
"updateMainTabButtons" : function(tab_id,buttons_arg,refresh){
|
||||
SunstoneCfg["tabs"][tab_id]["buttons"]=buttons_arg;
|
||||
if (refresh){
|
||||
$('div#'+tab_name+' .action_blocks').empty();
|
||||
insertButtonsInTab(tab_name);
|
||||
}
|
||||
},
|
||||
|
||||
"removeMainTab" : function(tab_id,refresh) {
|
||||
SunstoneCfg["tabs"][tab_id]=null;
|
||||
if (refresh) {
|
||||
$('div#'+tab_name).remove();
|
||||
}
|
||||
},
|
||||
|
||||
"getInfoPanelHTML" : function(name){
|
||||
@ -84,22 +101,23 @@ var Sunstone = {
|
||||
SunstoneCfg["info_panels"][name]=info_panel;
|
||||
},
|
||||
|
||||
"updateInfoPanel" : function(name, info_panel,refresh){
|
||||
"updateInfoPanel" : function(name, info_panel){
|
||||
SunstoneCfg["info_panels"][name]=info_panel;
|
||||
if (refresh){
|
||||
refreshInfoPanel(name);
|
||||
}
|
||||
},
|
||||
|
||||
"removeInfoPanel" : function(name){
|
||||
SunstoneCfg["info_panels"][name] = null;
|
||||
},
|
||||
|
||||
"addInfoTab" : function(info_panel, tab_name, tab){
|
||||
"popUpInfoPanel" : function(name){
|
||||
popDialog(Sunstone.getInfoPanelHTML(name));
|
||||
},
|
||||
|
||||
"addInfoPanelTab" : function(info_panel, tab_name, tab){
|
||||
SunstoneCfg["info_panels"][info_panel][tab_name] = tab;
|
||||
},
|
||||
|
||||
"updateInfoTab" : function(info_panel, tab_name, tab, refresh){
|
||||
"updateInfoPanelTab" : function(info_panel, tab_name, tab, refresh){
|
||||
SunstoneCfg["info_panels"][info_panel][tab_name] = tab;
|
||||
if (refresh){
|
||||
refreshInfoPanelTab(info_panel,tab_name);
|
||||
@ -107,7 +125,7 @@ var Sunstone = {
|
||||
},
|
||||
|
||||
|
||||
"removeInfoTab" : function(info_panel,tab_name){
|
||||
"removeInfoPanelTab" : function(info_panel,tab_name){
|
||||
SunstoneCfg["info_panels"][info_panel][tab_name] = null;
|
||||
},
|
||||
|
||||
@ -190,112 +208,12 @@ var Sunstone = {
|
||||
button = buttons["action_list"]["actions"][button_name];
|
||||
}
|
||||
return button;
|
||||
}//meter coma y seguir aquí
|
||||
} //end sunstone methods
|
||||
|
||||
};
|
||||
|
||||
|
||||
//~ "actions" : {
|
||||
//~
|
||||
//~ "VM.create" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "VM.deploy" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "VM.migrate" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "VM.livemigrate" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "VM.hold" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "VM.release" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "VM.suspend" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "VM.resume" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "VM.stop" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "VM.restart" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "VM.shutdown" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "VM.cancel" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "VM.delete" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "Network.publish" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "Network.unpublish" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "Network.delete" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "User.create" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "User.delete" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "Image.enable" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "Image.disable" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "Image.persistent" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "Image.nonpersistent" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "Image.publish" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "Image.unpublish" = {
|
||||
//~
|
||||
//~ },
|
||||
//~
|
||||
//~ "Image.delete" = {
|
||||
//~
|
||||
//~ }
|
||||
|
||||
|
||||
|
||||
|
||||
//plugins have done their jobs when we execute this
|
||||
@ -398,48 +316,48 @@ function insertTabs(){
|
||||
|
||||
|
||||
function insertButtons(){
|
||||
var buttons;
|
||||
var tab_id;
|
||||
var button_code;
|
||||
var button_obj;
|
||||
for (tab in SunstoneCfg["tabs"]){
|
||||
insertButtonsInTab(tab)
|
||||
}
|
||||
}
|
||||
|
||||
function insertButtonsInTab(tab_name){
|
||||
var buttons = SunstoneCfg["tabs"][tab_name]["buttons"];
|
||||
var button_code="";
|
||||
var sel_obj=null;
|
||||
|
||||
for (tab in SunstoneCfg["tabs"]){
|
||||
buttons = SunstoneCfg["tabs"][tab].buttons;
|
||||
content = SunstoneCfg["tabs"][tab].content;
|
||||
if ($('div#'+tab+' .action_blocks').length){
|
||||
for (button_name in buttons){
|
||||
button_code = "";
|
||||
button = buttons[button_name];
|
||||
if (button.condition()) {
|
||||
switch (button.type) {
|
||||
case "select":
|
||||
button_code = '<select class="multi_action_slct">';
|
||||
var sel_obj;
|
||||
for (sel_name in button.actions){
|
||||
sel_obj = button["actions"][sel_name];
|
||||
if (sel_obj.condition()){
|
||||
button_code += '<option class="'+sel_obj.type+'_button" value="'+sel_name+'">'+sel_obj.text+'</option>';
|
||||
};
|
||||
if ($('div#'+tab_name+' .action_blocks').length){
|
||||
for (button_name in buttons){
|
||||
button_code = "";
|
||||
button = buttons[button_name];
|
||||
if (button.condition()) {
|
||||
switch (button.type) {
|
||||
case "select":
|
||||
button_code = '<select class="multi_action_slct">';
|
||||
|
||||
for (sel_name in button.actions){
|
||||
sel_obj = button["actions"][sel_name];
|
||||
if (sel_obj.condition()){
|
||||
button_code += '<option class="'+sel_obj.type+'_button" value="'+sel_name+'">'+sel_obj.text+'</option>';
|
||||
};
|
||||
button_code += '</select>';
|
||||
break;
|
||||
case "image":
|
||||
button_code = '<img src="'+button.img+'" class="action_button" value="'+button_name+'" alt="'+button.text+'" />';
|
||||
break;
|
||||
case "create_dialog":
|
||||
button_code = '<button class="'+button.type+'_button action_button top_button" value="'+button_name+'">'+button.text+'</button>';
|
||||
break;
|
||||
default:
|
||||
button_code = '<button class="'+button.type+'_button top_button" value="'+button_name+'">'+button.text+'</button>';
|
||||
|
||||
}
|
||||
}
|
||||
$('div#'+tab+' .action_blocks').append(button_code);
|
||||
};
|
||||
button_code += '</select>';
|
||||
break;
|
||||
case "image":
|
||||
button_code = '<img src="'+button.img+'" class="action_button" value="'+button_name+'" alt="'+button.text+'" />';
|
||||
break;
|
||||
case "create_dialog":
|
||||
button_code = '<button class="'+button.type+'_button action_button top_button" value="'+button_name+'">'+button.text+'</button>';
|
||||
break;
|
||||
default:
|
||||
button_code = '<button class="'+button.type+'_button top_button" value="'+button_name+'">'+button.text+'</button>';
|
||||
|
||||
}//for each button in tab
|
||||
}//if tab exists
|
||||
}//for each tab
|
||||
|
||||
}
|
||||
}
|
||||
$('div#'+tab_name+' .action_blocks').append(button_code);
|
||||
|
||||
}//for each button in tab
|
||||
}//if tab exists
|
||||
}
|
||||
|
||||
// We do not insert info panels code, we generate it dinamicly when
|
||||
|
Loading…
x
Reference in New Issue
Block a user