'+
- '
'+
- '
'+
- '
'+
- '
'+
- ''+role.cardinality+' '+
- ' '+
- ''+role.name + ' ' + tr("VMs")+' '+
- '
'+
- '
'+
- '
'+
- '
'+
- ' '+
- ' '+
- ''+tr("The cardinality for this role cannot be changed")+' '+
- '
'+
- '
'+
- '
'+
- '
'+
- '
× '+
- '
');
-
-
- if (max_vms > min_vms) {
- $( ".cardinality_slider_div", context).show();
- $( ".cardinality_no_slider_div", context).hide();
-
- var provision_cardinality_slider = $( ".cardinality_slider", context).noUiSlider({
- handles: 1,
- connect: "lower",
- range: [min_vms, max_vms],
- step: 1,
- start: role.cardinality,
- value: role.cardinality,
- slide: function(type) {
- if ( type != "move"){
- if ($(this).val()) {
- $(".cardinality_value", context).html($(this).val());
- }
- }
- }
- });
-
- provision_cardinality_slider.val(role.cardinality)
-
- provision_cardinality_slider.addClass("noUiSlider");
- } else {
- $( ".cardinality_slider_div", context).hide();
- $( ".cardinality_no_slider_div", context).show();
- }
-
- return false;
- });
-
- context.on("click", ".provision_change_cardinality_button", function(){
- var flow_id = $(".provision_info_flow", context).attr("flow_id");
- var cardinality = $(".cardinality_slider", context).val()
-
- OpenNebula.Role.update({
- data : {
- id: flow_id + '/role/' + $(this).attr("role_id"),
- extra_param: {
- cardinality: cardinality
- }
- },
- success: function(request, response){
- OpenNebula.Helper.clear_cache("SERVICE");
- update_provision_flow_info(flow_id, context);
- },
- error: onError
- })
- });
-
- context.on("click", ".provision_delete_confirm_button", function(){
- $(".provision_confirm_action:first", context).html(
- '
'+
- '
'+
- '
'+
- ''+
- tr("Be careful, this action will inmediately destroy your Service")+
- ' '+
- tr("All the information will be lost!")+
- ' '+
- '
'+
- '
'+
- '
'+
- '
× '+
- '
');
- });
-
- context.on("click", ".provision_shutdown_confirm_button", function(){
- $(".provision_confirm_action:first", context).html(
- '
'+
- '
'+
- '
'+
- ''+
- tr("Be careful, this action will inmediately shutdown your Service")+
- ' '+
- tr("All the information will be lost!")+
- ' '+
- '
'+
- '
'+
- '
'+
- '
× '+
- '
');
- });
-
- context.on("click", ".provision_recover_button", function(){
- var flow_id = $(".provision_info_flow", context).attr("flow_id");
-
- OpenNebula.Service.recover({
- data : {
- id: flow_id
- },
- success: function(request, response){
- update_provision_flow_info(flow_id, context);
- },
- error: onError
- })
- });
-
- context.on("click", ".provision_shutdown_button", function(){
- var flow_id = $(".provision_info_flow", context).attr("flow_id");
-
- OpenNebula.Service.shutdown({
- data : {
- id: flow_id
- },
- success: function(request, response){
- update_provision_flow_info(flow_id, context);
- },
- error: onError
- })
- });
-
- context.on("click", ".provision_delete_button", function(){
- var button = $(this);
- button.attr("disabled", "disabled");
- var flow_id = $(".provision_info_flow", context).attr("flow_id");
-
- OpenNebula.Service.del({
- data : {
- id: flow_id
- },
- success: function(request, response){
- $(".provision_back", context).click();
- $(".provision_flows_list_refresh_button", context).click();
- button.removeAttr("disabled");
- },
- error: function(request, response){
- onError(request, response);
- button.removeAttr("disabled");
- }
- })
- });
-
- context.on("click", ".provision_refresh_info", function(){
- var flow_id = $(".provision_info_flow", context).attr("flow_id");
- update_provision_flow_info(flow_id, context);
- //$(".provision_flows_list_refresh_button", $(".provision_flows_list_section")).trigger("click");
- return false;
- });
-
- //
- // Info Flow
- //
-
- $(".provision_list_flows", context).on("click", ".provision_info_flow_button", function(){
- $("a.provision_show_flow_accordion", context).trigger("click");
-
- var flow_id = $(this).parents(".provision-pricing-table").attr("opennebula_id")
- update_provision_flow_info(flow_id, context);
- return false;
- })
-}
-
-function setup_provision_flows_list(context, opts){
- //
- // List Flows
- //
-
- provision_flows_datatable = $('.provision_flows_table', context).dataTable({
- "iDisplayLength": 6,
- "sDom" : '<"H">t<"F"lp>',
- "aLengthMenu": [[6, 12, 36, 72], [6, 12, 36, 72]],
- "aaSorting" : [[0, "desc"]],
- "aoColumnDefs": [
- { "bVisible": false, "aTargets": ["all"]}
- ],
- "aoColumns": [
- { "mDataProp": "DOCUMENT.ID" },
- { "mDataProp": "DOCUMENT.NAME" },
- { "mDataProp": "DOCUMENT.UID" }
- ],
- "fnPreDrawCallback": function (oSettings) {
- // create a thumbs container if it doesn't exist. put it in the dataTables_scrollbody div
- if (this.$('tr', {"filter": "applied"} ).length == 0) {
- this.html('
'+
- '
'+
- ' '+
- ' '+
- ' '+
- '
'+
- '
'+
- '
'+
- tr("Looks like you don't have any Service. Click the button below to get started")+
- ' '+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
');
- } else {
- $(".provision_flows_table", context).html('
');
- }
-
- return true;
- },
- "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
- var data = aData.DOCUMENT;
- var body = data.TEMPLATE.BODY;
- var state = get_provision_flow_state(body);
- var start_time = get_provision_flow_start_time(body);
-
- var roles_li = "";
- if (body.roles) {
- $.each(body.roles, function(index, role) {
- var role_state = get_provision_flow_state(role);
- var rvms = {
- str : (role.nodes ? role.nodes.length : 0) + " / " + role.cardinality ,
- percentage : Math.floor((role.nodes ? role.nodes.length : 0) / role.cardinality)*100
- }
-
- roles_li +=
- '
'+
- ' '+
- role.name+
- ' '+
- '
'+
- ''+
- ' '+
- '
'+
- ' '+
- '
'+
- //''+
- // state.str+
- //' '+
- ''+rvms.str+" VMs "+
- ' ';
- });
- }
-
- $(".provision_flows_ul", context).append('
'+
- ''+
- ''+
- ''+ data.NAME + ' '+
- ' '+
- ' '+
- ''+
- ''+
- ' '+
- state.str+
- ' '+
- ' '+
- roles_li +
- ''+
- ''+
- ' '+
- data.UNAME+
- ' '+
- ''+
- ' '+
- (start_time ? _format_date(start_time) : '-') +
- ' '+
- ' '+
- ' '+
- ' ');
-
- return nRow;
- }
- });
-
- $('.provision_list_flows_search', context).keyup(function(){
- provision_flows_datatable.fnFilter( $(this).val() );
- })
-
- $('.provision_list_flows_search', context).change(function(){
- provision_flows_datatable.fnFilter( $(this).val() );
- })
-
- context.on("click", ".provision_flows_list_refresh_button", function(){
- OpenNebula.Helper.clear_cache("SERVICE");
- update_provision_flows_datatable(provision_flows_datatable, 0);
- return false;
- });
-
- context.on("click", ".provision_flows_list_search_button", function(){
- $(".provision_list_flows_search", context).fadeIn();
- });
-
- $(".provision_list_flows_filter", context).on("change", ".resource_list_select", function(){
- var filter;
- if ($(this).val() == "-2"){
- filter = "";
- } else {
- filter = $(this).val();
- }
-
- provision_flows_datatable.fnFilter( filter, 2 );
- })
-
- insertSelectOptions(
- ".provision_list_flows_filter",
- context,
- "User",
- (opts.filter_expression ? opts.filter_expression : "-2"),
- false,
- '
'+tr("ALL")+' ',
- null,
- null,
- true,
- true);
-
- context.on("click", ".provision_flows_list_filter_button", function(){
- $(".provision_list_flows_filter", context).fadeIn();
- return false;
- });
-
- OpenNebula.Helper.clear_cache("SERVICE");
- update_provision_flows_datatable(provision_flows_datatable, 0);
-
- $(document).foundation();
-}
-
-function generate_provision_flows_list(context, opts) {
- context.off();
- context.html(provision_list_flows(opts));
- setup_provision_flows_list(context, opts);
- setup_info_flow(context);
-}
-
-function setup_provision_user_info(context) {
- function update_provision_vdc_user_info(user_id, context) {
- $(".provision_info_vdc_user_name", context).text("");
- $(".provision_vdc_info_container", context).html("");
- $(".provision_info_vdc_user", context).hide();
- $(".provision_info_vdc_user_loading", context).fadeIn();
-
- OpenNebula.User.show({
- data : {
- id: user_id
- },
- error: onError,
- success: function(request, response){
- var data = response.USER
-
- $(".provision_vdc_user_confirm_action",context).html("");
- $(".provision_info_vdc_user_acct",context).html("");
-
- $(".provision_info_vdc_user", context).attr("opennebula_id", data.ID);
- $(".provision_info_vdc_user", context).attr("uname", data.NAME);
- $(".provision_info_vdc_user", context).attr("quotas", JSON.stringify(data.VM_QUOTA));
- $(".provision_info_vdc_user_name", context).text(data.NAME);
-
- $(".provision-pricing-table_user_info", context).html("");
- if (!$.isEmptyObject(data.VM_QUOTA)){
- var default_user_quotas = Quotas.default_quotas(data.DEFAULT_USER_QUOTAS);
- quotas = quotaBarFloat(
- data.VM_QUOTA.VM.VMS_USED,
- data.VM_QUOTA.VM.VMS,
- default_user_quotas.VM_QUOTA.VM.VMS,
- true);
-
- $(".provision-pricing-table_user_info", context).append('
'+
- tr("Running VMs")+
- ''+quotas.str+" "+
- ' '+
- '
'+
- ''+
- ' '+
- '
'+
- ' ');
-
- quotas = quotaBarFloat(
- data.VM_QUOTA.VM.CPU_USED,
- data.VM_QUOTA.VM.CPU,
- default_user_quotas.VM_QUOTA.VM.CPU,
- true);
-
- $(".provision-pricing-table_user_info", context).append('
'+
- tr("CPU")+
- ''+quotas.str+" "+
- ' '+
- '
'+
- ''+
- ' '+
- '
'+
- ' ');
-
- quotas = quotaBarMB(
- data.VM_QUOTA.VM.MEMORY_USED,
- data.VM_QUOTA.VM.MEMORY,
- default_user_quotas.VM_QUOTA.VM.MEMORY,
- true);
-
- $(".provision-pricing-table_user_info", context).append('
'+
- tr("Memory")+
- ''+quotas.str+" "+
- ' '+
- '
'+
- ''+
- ' '+
- '
'+
- ' ');
- } else {
- quotas = quotaBarFloat(0, 0, null, true);
-
- $(".provision-pricing-table_user_info", context).append('
'+
- tr("Running VMs")+
- ''+quotas.str+" "+
- ' '+
- '
'+
- ''+
- ' '+
- '
'+
- ' ');
-
- quotas = quotaBarFloat(0, 0, null, true);
-
- $(".provision-pricing-table_user_info", context).append('
'+
- tr("CPU")+
- ''+quotas.str+" "+
- ' '+
- '
'+
- ''+
- ' '+
- '
'+
- ' ');
-
- quotas = quotaBarMB(0, 0, null, true);
-
- $(".provision-pricing-table_user_info", context).append('
'+
- tr("Memory")+
- ''+quotas.str+" "+
- ' '+
- '
'+
- ''+
- ' '+
- '
'+
- ' ');
- }
-
- $(".provision-pricing-table_user_info", context).append(
- '
'+
- ' '+
- ' '+
- '
'+
- ''+
- ' '+
- ' '+
- ''+
- ' '+
- ' '+
- ''+
- ' '+
- ' '+
- ''+
- ' '+
- ' '+
- ' '+
- '
'+
- ' ')
-
- var start_time = new Date().getTime() / 1000;
- // ms to s
-
- // 604800 = 7 days = 7*24*60*60
- start_time = start_time - 604800;
-
- // today
- var end_time = -1;
-
- var options = {
- "start_time": start_time,
- "end_time": end_time,
- "userfilter": user_id
- }
-
- var no_table = true;
-
- OpenNebula.VM.accounting({
- success: function(req, response){
- fillAccounting($(".dashboard_vm_accounting", context), req, response, no_table);
- },
- error: onError,
- data: options
- });
-
- $(".provision_info_vdc_user", context).show();
- $(".provision_info_vdc_user_loading", context).hide();
-
- $(document).foundation();
- //$("#provision_info_vdc_quotas").html(quotas_html);
- }
- })
- }
- //
- // Info User
- //
-
- $(".provision_list_users", context).on("click", ".provision_info_user_button", function(){
- $("a.provision_show_user_accordion", context).trigger("click");
- // TODO loading
-
- var user_id = $(this).parents(".provision-pricing-table").attr("opennebula_id")
- update_provision_vdc_user_info(user_id, context);
- })
-
- context.on("click", ".provision_vdc_user_info_show_vms", function(){
- $(".provision_vdc_info_container", context).html('
'+
- ''+
- ' '+
- ' '+
- ' '+
- ' '+
- ' '+
- ''+
- ' '+
- '
');
-
- generate_provision_vms_list(
- $(".provision_vdc_info_container", context),
- {
- title: $(".provision_info_vdc_user", context).attr("uname") + ' ' + tr("VMs"),
- active: true,
- refresh: true,
- create: false,
- filter: false,
- filter_expression: $(".provision_info_vdc_user", context).attr("opennebula_id")
- });
- })
-
- context.on("click", ".provision_vdc_user_info_show_templates", function(){
- $(".provision_vdc_info_container", context).html('
'+
- ''+
- ' '+
- ' '+
- ' '+
- ' '+
- ' '+
- ''+
- ' '+
- '
');
-
- generate_provision_templates_list(
- $(".provision_vdc_info_container", context),
- {
- title: $(".provision_info_vdc_user", context).attr("uname") + ' ' + tr("Templates"),
- active: true,
- refresh: true,
- create: false,
- filter: false,
- filter_expression: $(".provision_info_vdc_user", context).attr("opennebula_id")
- });
- })
-
- context.on("click", ".provision_vdc_user_info_show_flows", function(){
- $(".provision_vdc_info_container", context).html('
'+
- ''+
- ' '+
- ' '+
- ' '+
- ' '+
- ' '+
- ''+
- ' '+
- '
');
-
- generate_provision_flows_list(
- $(".provision_vdc_info_container", context),
- {
- title: $(".provision_info_vdc_user", context).attr("uname") + ' ' + tr("Services"),
- active: true,
- refresh: true,
- create: false,
- filter: false,
- filter_expression: $(".provision_info_vdc_user", context).attr("opennebula_id")
- });
- })
-
-
- context.on("click", ".provision_vdc_user_info_show_acct", function(){
- $(".provision_vdc_info_container", context).html("");
-
- accountingGraphs(
- $(".provision_vdc_info_container", context),
- { fixed_user: $(".provision_info_vdc_user", context).attr("opennebula_id"),
- init_group_by: "vm" });
-
- $(".provision_vdc_info_container", context).prepend(
- '')
- })
-
- context.on("click", ".provision_vdc_user_delete_confirm_button", function(){
- $(".provision_vdc_user_confirm_action", context).html(
- '
'+
- '
'+
- '
'+
- ''+
- tr("Be careful, this action will inmediately remove the User from OpenNebula")+
- ' '+
- '
'+
- '
'+
- '
'+
- '
'+
- '
× '+
- '
');
- });
-
- context.on("click", ".provision_vdc_user_password_confirm_button", function(){
- $(".provision_vdc_user_confirm_action", context).html(
- '
'+
- '
'+
- '
'+
- '
'+
- ' '+
- ' '+
- '
'+
- '
'+
- '
'+
- '
'+
- ''+tr("Update Password")+' '+
- '
'+
- '
'+
- '
× '+
- '
');
-
- context.on("click", "#provision_vdc_user_change_password_button", function(){
- var button = $(this);
- button.attr("disabled", "disabled");
- var user_id = $(".provision_info_vdc_user", context).attr("opennebula_id");
- var pw = $('.provision_vdc_user_new_password', context).val();
- var confirm_password = $('.provision_vdc_user_new_confirm_password', context).val();
-
- if (!pw.length){
- notifyError(tr("Fill in a new password"));
- return false;
- }
-
- if (pw !== confirm_password){
- notifyError(tr("Passwords do not match"));
- return false;
- }
-
- OpenNebula.User.passwd({
- data : {
- id: user_id,
- extra_param: pw
- },
- success: function(request, response){
- update_provision_vdc_user_info(user_id, context);
- button.removeAttr("disabled");
- },
- error: function(request, response){
- onError(request, response);
- button.removeAttr("disabled");
- }
- })
- return false;
- });
- });
-
-
-
- context.on("click", ".provision_vdc_user_quota_confirm_button", function(){
- $(".provision_vdc_user_confirm_action", context).html(
- '
'+
- '
'+
- '
'+
- ''+
- ' '+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- ' '+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- ''+
- ' '+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- ' '+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- ''+
- ' '+
- '
'+
- '
'+
- '
'+
- ' '+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- ' '+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
× '+
- '
');
-
- var provision_rvms_quota_vdc_info_input = $(".provision_rvms_quota_vdc_info_input", context);
- var provision_rvms_quota_vdc_info_slider = $( ".provision_rvms_quota_vdc_info_slider", context).noUiSlider({
- handles: 1,
- connect: "lower",
- range: [0,5000],
- step: 100,
- start: 500,
- value: 500,
- slide: function(type) {
- if ( type != "move"){
- provision_rvms_quota_vdc_info_input.val($(this).val()/100);
- }
- }
- });
-
- provision_rvms_quota_vdc_info_slider.addClass("noUiSlider");
-
- provision_rvms_quota_vdc_info_input.change(function() {
- provision_rvms_quota_vdc_info_slider.val(this.value * 100)
- });
-
- var provision_cpu_quota_vdc_info_input = $(".provision_cpu_quota_vdc_info_input", context);
- var provision_cpu_quota_vdc_info_slider = $(".provision_cpu_quota_vdc_info_slider", context).noUiSlider({
- handles: 1,
- connect: "lower",
- range: [0,5000],
- step: 100,
- start: 4000,
- value: 4000,
- slide: function(type) {
- if ( type != "move"){
- provision_cpu_quota_vdc_info_input.val($(this).val()/100);
- }
- }
- });
-
- provision_cpu_quota_vdc_info_slider.addClass("noUiSlider");
-
- provision_cpu_quota_vdc_info_input.change(function() {
- provision_cpu_quota_vdc_info_slider.val(this.value * 100)
- });
-
- var provision_memory_quota_vdc_info_input = $(".provision_memory_quota_vdc_info_input", context);
- var provision_memory_quota_vdc_info_tmp_input = $(".provision_memory_quota_vdc_info_tmp_input", context);
-
- var update_final_memory_input = function() {
- var value = provision_memory_quota_vdc_info_tmp_input.val();
- if (value > 0) {
- provision_memory_quota_vdc_info_input.val( Math.floor(value * 1024) );
- } else {
- provision_memory_quota_vdc_info_input.val(value);
- }
- }
-
- var provision_memory_quota_vdc_info_slider = $(".provision_memory_quota_vdc_info_slider", context).noUiSlider({
- handles: 1,
- connect: "lower",
- range: [0,6400],
- start: 1600,
- step: 50,
- value: 1600,
- slide: function(type) {
- if ( type != "move"){
- provision_memory_quota_vdc_info_tmp_input.val($(this).val()/100);
- provision_memory_quota_vdc_info_tmp_input.change();
- }
- }
- });
-
- provision_memory_quota_vdc_info_tmp_input.on("change", function() {
- update_final_memory_input();
- provision_memory_quota_vdc_info_slider.val(this.value * 100)
- });
-
- provision_memory_quota_vdc_info_slider.addClass("noUiSlider");
-
-
- var quotas_str = $(".provision_info_vdc_user", context).attr("quotas");
- if (quotas_str) {
- var quotas = JSON.parse(quotas_str);
- var rvms_quotas = (quotas.VM.VMS == QUOTA_LIMIT_UNLIMITED ? "" : quotas.VM.VMS)
- var cpu_quotas = (quotas.VM.CPU == QUOTA_LIMIT_UNLIMITED ? "" : quotas.VM.CPU)
- var memory_quotas = (quotas.VM.MEMORY == QUOTA_LIMIT_UNLIMITED ? "" : Math.floor(quotas.VM.MEMORY/1024))
-
- provision_rvms_quota_vdc_info_input.val(rvms_quotas).change();
- provision_cpu_quota_vdc_info_input.val(cpu_quotas).change();
- provision_memory_quota_vdc_info_tmp_input.val(memory_quotas).change();
- }
- });
-
- context.on("click", ".provision_delete_button", function(){
- var button = $(this);
- button.attr("disabled", "disabled");
- var user_id = $(".provision_info_vdc_user", context).attr("opennebula_id");
- OpenNebula.User.del({
- data : {
- id: user_id
- },
- success: function(request, response){
- $(".provision_back", context).click();
- $(".provision_users_list_refresh_button", context).click();
- button.removeAttr("disabled");
- },
- error: function(request, response){
- onError(request, response);
- button.removeAttr("disabled");
- }
- })
- });
-
- context.on("click", ".provision_update_quota_button", function(){
- var button = $(this);
- button.attr("disabled", "disabled");
- var user_id = $(".provision_info_vdc_user", context).attr("opennebula_id");
-
- OpenNebula.User.set_quota({
- data : {
- id: user_id,
- extra_param: {
- "VM" : {
- "VOLATILE_SIZE":"-1",
- "VMS": $(".provision_rvms_quota_vdc_info_input", context).val()||QUOTA_LIMIT_UNLIMITED,
- "MEMORY": $(".provision_memory_quota_vdc_info_input", context).val()||QUOTA_LIMIT_UNLIMITED,
- "CPU": $(".provision_cpu_quota_vdc_info_input", context).val()||QUOTA_LIMIT_UNLIMITED}
- }
- },
- success: function(request, response){
- update_provision_vdc_user_info(user_id, context);
- button.removeAttr("disabled");
- },
- error: function(request, response){
- onError(request, response);
- button.removeAttr("disabled");
- }
- })
- });
-
- context.on("click", ".provision_refresh_info", function(){
- var user_id = $(".provision_info_vdc_user", context).attr("opennebula_id");
- update_provision_vdc_user_info(user_id, context);
- return false;
- });
-}
-
-function setup_provision_users_list(context){
- var provision_users_datatable = $('.provision_users_table', context).dataTable({
- "iDisplayLength": 6,
- "sDom" : '<"H">t<"F"lp>',
- "aLengthMenu": [[6, 12, 36, 72], [6, 12, 36, 72]],
- "aaSorting" : [[0, "desc"]],
- "aoColumnDefs": [
- { "bVisible": false, "aTargets": ["all"]}
- ],
- "aoColumns": [
- { "mDataProp": "USER.ID" },
- { "mDataProp": "USER.NAME" }
- ],
- "fnPreDrawCallback": function (oSettings) {
- // create a thumbs container if it doesn't exist. put it in the dataTables_scrollbody div
- if (this.$('tr', {"filter": "applied"} ).length == 0) {
- this.html('
'+
- ''+
- ' '+
- ' '+
- ' '+
- ' '+
- ' '+
- ''+
- tr("The list of users is empty")+
- ' '+
- '
');
- } else {
- $(".provision_users_table", context).html('
');
- }
-
- return true;
- },
- "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
- var data = aData.USER;
- //var state = get_provision_vm_state(data);
- var vms = "";
- var memory = "";
- var cpu = "";
-
- // Inject the VM user quota. This info is returned separately in the
- // pool info call, but the userElementArray expects it inside the USER,
- // as it is returned by the individual info call
- var q = provision_quotas_list[data.ID];
-
- var quotas_html;
-
- if (q != undefined){
- var quota = q.QUOTAS;
-
- if (!$.isEmptyObject(quota.VM_QUOTA)){
- quotas = quotaBarFloat(
- quota.VM_QUOTA.VM.VMS_USED,
- quota.VM_QUOTA.VM.VMS,
- default_user_quotas.VM_QUOTA.VM.VMS,
- true);
-
- quotas_html = "";
- quotas_html += '
'+
- tr("Running VMs")+
- ''+quotas.str+" "+
- ' '+
- '
'+
- ''+
- ' '+
- '
'+
- ' ';
-
- quotas = quotaBarFloat(
- quota.VM_QUOTA.VM.CPU_USED,
- quota.VM_QUOTA.VM.CPU,
- default_user_quotas.VM_QUOTA.VM.CPU,
- true);
-
- quotas_html += '
'+
- tr("CPU")+
- ''+quotas.str+" "+
- ' '+
- '
'+
- ''+
- ' '+
- '
'+
- ' ';
-
- quotas = quotaBarMB(
- quota.VM_QUOTA.VM.MEMORY_USED,
- quota.VM_QUOTA.VM.MEMORY,
- default_user_quotas.VM_QUOTA.VM.MEMORY,
- true);
-
- quotas_html += '
'+
- tr("Memory")+
- ''+quotas.str+" "+
- ' '+
- '
'+
- ''+
- ' '+
- '
'+
- ' ';
- } else {
- quotas = quotaBarFloat(0, 0, null, true);
-
- quotas_html = "";
- quotas_html += '
'+
- tr("Running VMs")+
- ''+quotas.str+" "+
- ' '+
- '
'+
- ''+
- ' '+
- '
'+
- ' ';
-
- quotas = quotaBarFloat(0, 0, null, true);
-
- quotas_html += '
'+
- tr("CPU")+
- ''+quotas.str+" "+
- ' '+
- '
'+
- ''+
- ' '+
- '
'+
- ' ';
-
- quotas = quotaBarMB(0, 0, null, true);
-
- quotas_html += '
'+
- tr("Memory")+
- ''+quotas.str+" "+
- ' '+
- '
'+
- ''+
- ' '+
- '
'+
- ' ';
- }
- }
-
-
- $(".provision_users_ul", context).append('
'+
- ''+
- ' ');
-
- return nRow;
- }
- });
-
-
- $('.provision_list_users_search', context).keyup(function(){
- provision_users_datatable.fnFilter( $(this).val() );
- })
-
- $('.provision_list_users_search', context).change(function(){
- provision_users_datatable.fnFilter( $(this).val() );
- })
-
- context.on("click", ".provision_users_list_refresh_button", function(){
- OpenNebula.Helper.clear_cache("USER");
- update_provision_users_datatable(provision_users_datatable, 0);
- return false;
- });
-
- $(document).foundation();
-}
-
-function generate_provision_users_list(context, opts) {
- context.off();
- context.html(provision_list_users(opts));
- setup_provision_users_list(context);
- setup_provision_user_info(context);
-}
-
-$(document).ready(function(){
- var tab_name = 'provision-tab';
- var tab = $("#"+tab_name);
-
- if (Config.isTabEnabled(tab_name)) {
- $('body').prepend(
- '
'+
- '
'+
- '
'+
- provision_header+
- '
'+
- '
'+
- '
')
-
- $(".left-content").remove();
- $(".right-content").addClass("large-centered small-centered");
- $("#footer").removeClass("right");
- $("#footer").addClass("large-centered small-centered");
-
- $(".user-zone-info").remove();
-
- showTab('provision-tab');
-
- $("#provision_logout").click(function(){
- OpenNebula.Auth.logout({
- success: function(){
- window.location.href = "login";
- }
- });
-
- return false;
- });
-
- $(".provision_image_header").on("click", function(){
- show_provision_dashboard();
- })
-
- generate_provision_vms_list($(".provision_vms_list_section"), {active: true});
- generate_provision_templates_list($(".provision_templates_list_section"), {active: true});
- // TODO check if active
- generate_provision_flows_list($(".provision_flows_list_section"), {active: true});
- generate_provision_users_list($(".provision_users_list_section"), {active: true});
-
- //
- // Dashboard
- //
-
- show_provision_dashboard();
-
- $(document).on("click", ".provision_vms_list_button", function(){
- OpenNebula.Helper.clear_cache("VM");
- show_provision_vm_list(0);
- });
-
- $(document).on("click", ".provision_templates_list_button", function(){
- OpenNebula.Helper.clear_cache("VMTEMPLATE");
- show_provision_template_list(0);
- });
-
- $(document).on("click", ".provision_flows_list_button", function(){
- OpenNebula.Helper.clear_cache("SERVICE");
- show_provision_flow_list(0);
- });
-
- $(document).on("click", ".provision_users_list_button", function(){
- OpenNebula.Helper.clear_cache("USER");
- show_provision_user_list(0);
- });
-
- //
- // User Info
- //
-
- $("#provision_user_info_button").on("click", function(){
- show_provision_user_info();
- });
-
- $("#provision_user_info").on("click", "#provision_user_info_refresh_button", function(){
- show_provision_user_info();
- });
-
- $.each( config['available_views'], function(id, view) {
- $('select#provision_user_views_select').append('
'+view+' ')
- });
-
- $("#provision_change_password_form").submit(function(){
- var pw = $('#provision_new_password', this).val();
- var confirm_password = $('#provision_new_confirm_password', this).val();
-
- if (!pw.length){
- notifyError(tr("Fill in a new password"));
- return false;
- }
-
- if (pw !== confirm_password){
- notifyError(tr("Passwords do not match"));
- return false;
- }
-
- Sunstone.runAction("Provision.User.passwd", "-1", pw);
- return false;
- });
-
- $("#provision_add_ssh_key_form").submit(function(){
- var keypair = $('#provision_ssh_key', this).val();
-
- if (!keypair.length){
- notifyError(tr("You have to provide an SSH key"));
- return false;
- }
-
- OpenNebula.User.show({
- data : {
- id: "-1"
- },
- success: function(request,user_json){
- var template = user_json.USER.TEMPLATE;
-
- template["SSH_PUBLIC_KEY"] = keypair;
-
- template_str = "";
- $.each(template,function(key,value){
- template_str += (key + '=' + '"' + value + '"\n');
- });
-
- Sunstone.runAction("Provision.User.update_template", "-1", template_str);
- }
- })
- return false;
- });
-
- $("#provision_change_view_form").submit(function(){
- var view = $('#provision_user_views_select', this).val();
-
- OpenNebula.User.show({
- data : {
- id: "-1"
- },
- success: function(request,user_json){
- var template = user_json.USER.TEMPLATE;
-
- template["DEFAULT_VIEW"] = view;
-
- template_str = "";
- $.each(template,function(key,value){
- template_str += (key + '=' + '"' + value + '"\n');
- });
-
- var data = OpenNebula.Helper.action('update', {"template_raw" : template_str });
-
- $.ajax({
- url: 'config',
- type: "POST",
- dataType: "json",
- data: JSON.stringify(data),
- success: function(){
- window.location.href = ".";
- },
- error: function(response){
- }
- });
- }
- })
- return false;
- });
-
- $("#provision_change_language_form").submit(function(){
- var lang = $('#provision_new_language', this).val();
-
- OpenNebula.User.show({
- data : {
- id: "-1"
- },
- success: function(request,user_json){
- var template = user_json.USER.TEMPLATE;
-
- template["LANG"] = lang;
-
- template_str = "";
- $.each(template,function(key,value){
- template_str += (key + '=' + '"' + value + '"\n');
- });
-
- var data = OpenNebula.Helper.action('update', {"template_raw" : template_str });
-
- $.ajax({
- url: 'config',
- type: "POST",
- dataType: "json",
- data: JSON.stringify(data),
- success: function(){
- window.location.href = ".";
- },
- error: function(response){
- }
- });
- }
- })
- return false;
- });
-
- //
- // Create VM
- //
-
- provision_system_templates_datatable = $('#provision_system_templates_table').dataTable({
- "iDisplayLength": 6,
- "sDom" : '<"H">t<"F"lp>',
- "aLengthMenu": [[6, 12, 36, 72], [6, 12, 36, 72]],
- "aoColumnDefs": [
- { "bVisible": false, "aTargets": ["all"]}
- ],
- "aoColumns": [
- { "mDataProp": "VMTEMPLATE.ID" },
- { "mDataProp": "VMTEMPLATE.NAME" },
- { "mDataProp": "VMTEMPLATE.TEMPLATE.SAVED_TEMPLATE_ID", "sDefaultContent" : "-" }
- ],
- "fnPreDrawCallback": function (oSettings) {
- // create a thumbs container if it doesn't exist. put it in the dataTables_scrollbody div
- if (this.$('tr', {"filter": "applied"} ).length == 0) {
- this.html('
'+
- ''+
- ' '+
- ' '+
- ' '+
- ' '+
- ' '+
- ''+
- tr("There are no templates available")+
- ' '+
- '
');
- } else {
- $("#provision_system_templates_table").html('
');
- }
-
- return true;
- },
- "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
- var data = aData.VMTEMPLATE;
- var logo;
-
- if (data.TEMPLATE.LOGO) {
- logo = '
'+
- ' '+
- ' ';
- } else {
- logo = '
'+
- ' '+
- ' ';
- }
-
- var li = $('
'+
- ''+
- ''+
- data.NAME+
- ' '+
- ''+
- logo +
- ' '+
- ''+
- (data.TEMPLATE.DESCRIPTION || '...')+
- ' '+
- ' '+
- ' ').appendTo($("#provision_system_templates_ul"));
-
- $(".provision-pricing-table", li).data("opennebula", aData);
-
- return nRow;
- }
- });
-
-
- provision_vdc_templates_datatable = $('#provision_vdc_templates_table').dataTable({
- "iDisplayLength": 6,
- "sDom" : '<"H">t<"F"lp>',
- "aLengthMenu": [[6, 12, 36, 72], [6, 12, 36, 72]],
- "aoColumnDefs": [
- { "bVisible": false, "aTargets": ["all"]}
- ],
- "aoColumns": [
- { "mDataProp": "VMTEMPLATE.ID" },
- { "mDataProp": "VMTEMPLATE.NAME" },
- { "mDataProp": "VMTEMPLATE.TEMPLATE.SAVED_TEMPLATE_ID", "sDefaultContent" : "-" },
- { "mDataProp": "VMTEMPLATE.PERMISSIONS.GROUP_U" }
- ],
- "fnPreDrawCallback": function (oSettings) {
- // create a thumbs container if it doesn't exist. put it in the dataTables_scrollbody div
- if (this.$('tr', {"filter": "applied"} ).length == 0) {
- this.html('
'+
- ''+
- ' '+
- ' '+
- ' '+
- ' '+
- ' '+
- ''+
- tr("There are no templates available. Please contact your cloud administrator")+
- ' '+
- '
');
- } else {
- $("#provision_vdc_templates_table").html('
');
- }
-
- return true;
- },
- "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
- var data = aData.VMTEMPLATE;
- var logo;
-
- if (data.TEMPLATE.LOGO) {
- logo = '
'+
- ' '+
- ' ';
- } else {
- logo = '
'+
- ' '+
- ' ';
- }
-
- var li = ('
'+
- ''+
- ''+
- data.NAME+
- ' '+
- ''+
- logo +
- ' '+
- ''+
- (data.TEMPLATE.DESCRIPTION || '...')+
- ' '+
- ' '+
- ' ').appendTo($("#provision_vdc_templates_ul"));
-
- $(".provision-pricing-table", li).data("opennebula", aData);
-
- return nRow;
- }
- });
-
-
- provision_saved_templates_datatable = $('#provision_saved_templates_table').dataTable({
- "iDisplayLength": 6,
- "sDom" : '<"H">t<"F"lp>',
- "aLengthMenu": [[6, 12, 36, 72], [6, 12, 36, 72]],
- "aoColumnDefs": [
- { "bVisible": false, "aTargets": ["all"]}
- ],
- "aoColumns": [
- { "mDataProp": "VMTEMPLATE.ID" },
- { "mDataProp": "VMTEMPLATE.NAME" },
- { "mDataProp": "VMTEMPLATE.TEMPLATE.SAVED_TEMPLATE_ID", "sDefaultContent" : "-" },
- { "mDataProp": "VMTEMPLATE.PERMISSIONS.GROUP_U" }
- ],
- "fnPreDrawCallback": function (oSettings) {
- // create a thumbs container if it doesn't exist. put it in the dataTables_scrollbody div
- if (this.$('tr', {"filter": "applied"} ).length == 0) {
- this.html('
'+
- ''+
- ' '+
- ' '+
- ' '+
- ' '+
- ' '+
- ''+
- tr("There are no templates available. Please contact your cloud administrator")+
- ' '+
- '
');
- } else {
- $("#provision_saved_templates_table").html('
');
- }
-
- return true;
- },
- "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
- var data = aData.VMTEMPLATE;
-
- var logo;
-
- if (data.TEMPLATE.LOGO) {
- logo = '
'+
- ' '+
- ' ';
- } else {
- logo = '
'+
- ' '+
- ' ';
- }
-
- var li = $('
'+
- ''+
- ''+
- data.NAME+
- ' '+
- ''+
- logo +
- ' '+
- ''+
- (data.TEMPLATE.DESCRIPTION || '...')+
- ' '+
- ' '+
- ' ').appendTo($("#provision_saved_templates_ul"));
-
- $(".provision-pricing-table", li).data("opennebula", aData);
-
- return nRow;
- }
- });
-
-
- $('#provision_create_template_search').on('keyup',function(){
- provision_system_templates_datatable.fnFilter( $(this).val() );
- provision_saved_templates_datatable.fnFilter( $(this).val() );
- provision_vdc_templates_datatable.fnFilter( $(this).val() );
- })
-
- $('#provision_create_template_search').on('change',function(){
- provision_system_templates_datatable.fnFilter( $(this).val() );
- provision_saved_templates_datatable.fnFilter( $(this).val() );
- provision_vdc_templates_datatable.fnFilter( $(this).val() );
- })
-
- $("#provision_create_template_refresh_button").click(function(){
- OpenNebula.Helper.clear_cache("VMTEMPLATE");
- update_provision_templates_datatable(provision_system_templates_datatable);
- update_provision_templates_datatable(provision_saved_templates_datatable);
- update_provision_templates_datatable(provision_vdc_templates_datatable);
-
- });
-
- tab.on("click", "#provision_create_vm .provision_select_template .provision-pricing-table.only-one" , function(){
- var create_vm_context = $("#provision_create_vm");
-
- if ($(this).hasClass("selected")){
- $(".provision_network_selector", create_vm_context).html("");
- $(".provision_capacity_selector", create_vm_context).html("");
-
- $(".provision_accordion_template .selected_template").hide();
- $(".provision_accordion_template .select_template").show();
- } else {
- var template_id = $(this).attr("opennebula_id");
- var template_json = $(this).data("opennebula");
-
- var template_nic = template_json.VMTEMPLATE.TEMPLATE.NIC
- var nics = []
- if ($.isArray(template_nic))
- nics = template_nic
- else if (!$.isEmptyObject(template_nic))
- nics = [template_nic]
-
- $(".provision_accordion_template .selected_template").show();
- $(".provision_accordion_template .select_template").hide();
- $(".provision_accordion_template .selected_template_name").html(template_json.VMTEMPLATE.NAME)
- if (template_json.VMTEMPLATE.TEMPLATE.LOGO) {
- $(".provision_accordion_template .selected_template_logo").html('
');
- } else {
- $(".provision_accordion_template .selected_template_logo").html('
');
- }
-
- $(".provision_accordion_template a").first().trigger("click");
-
- generate_provision_instance_type_accordion(
- $(".provision_capacity_selector", create_vm_context),
- template_json.VMTEMPLATE.TEMPLATE);
-
- generate_provision_network_accordion(
- $(".provision_network_selector", create_vm_context));
-
- $.each(nics, function(index, nic){
- generate_provision_network_table(
- $(".provision_nic_accordion", create_vm_context),
- nic);
- })
-
- if (template_json.VMTEMPLATE.TEMPLATE.USER_INPUTS) {
- generate_custom_attrs(
- $(".provision_custom_attributes_selector", create_vm_context),
- template_json.VMTEMPLATE.TEMPLATE.USER_INPUTS);
- }
- }
- })
-
- tab.on("click", "#provision_create_vm .provision-pricing-table.only-one" , function(){
- if ($(this).hasClass("selected")){
- $(this).removeClass("selected");
- } else {
- $(".provision-pricing-table", $(this).parents(".large-block-grid-3,.large-block-grid-2")).removeClass("selected")
- $(this).addClass("selected");
- }
- })
-
- $("#provision_create_vm").submit(function(){
- var context = $(this);
-
- var vm_name = $("#vm_name", context).val();
- var template_id = $(".tabs-content .content.active .selected", context).attr("opennebula_id");
-
- var nics = [];
- $(".selected_network", context).each(function(){
- var nic;
- if ($(this).attr("template_nic")) {
- nic = JSON.parse($(this).attr("template_nic"))
- } else {
- nic = {
- 'network_id': $(this).attr("opennebula_id")
- }
- }
- nics.push(nic);
- });
-
- var instance_type = $(".provision_instance_types_ul .selected", context);
-
- if (!template_id) {
- $(".alert-box-error", context).fadeIn().html(tr("You must select at least a template configuration"));
- return false;
- }
-
- var extra_info = {
- 'vm_name' : vm_name,
- 'template': {
- }
- }
-
- if (nics.length > 0) {
- extra_info.template.nic = nics;
- }
-
- if (instance_type.length > 0) {
- var instance_typa_data = instance_type.data("opennebula");
- delete instance_typa_data.name;
-
- $.extend(extra_info.template, instance_typa_data)
- }
-
- var missing_attr = false;
- var user_inputs_values = {};
- if ($(".provision_custom_attributes", $(this))) {
- $(".provision_custom_attribute", $(".provision_custom_attributes", $(this))).each(function(){
- if (!$(this).val()) {
- $(this).parent("label").css("color", "red");
- missing_attr = true;
- } else {
- $(this).parent("label").css("color", "#777");
- user_inputs_values[$(this).attr("attr_name")] = $(this).val();
- }
- })
- }
-
- if (missing_attr) {
- $(".alert-box-error", $(this)).fadeIn().html(tr("You have not specified all the Custom Atrributes for this VM"));
- return false;
- }
-
- if (!$.isEmptyObject(user_inputs_values)) {
- $.extend(extra_info.template, user_inputs_values)
- }
-
- Sunstone.runAction("Provision.instantiate", template_id, extra_info);
- return false;
- })
-
- $(document).on("click", ".provision_create_vm_button", function(){
- show_provision_create_vm();
- });
-
-
- //
- // Create FLOW
- //
-
- provision_flow_templates_datatable = $('#provision_flow_templates_table').dataTable({
- "iDisplayLength": 6,
- "sDom" : '<"H">t<"F"lp>',
- "aLengthMenu": [[6, 12, 36, 72], [6, 12, 36, 72]],
- "aaSorting" : [[1, "asc"]],
- "aoColumnDefs": [
- { "bVisible": false, "aTargets": ["all"]}
- ],
- "aoColumns": [
- { "mDataProp": "DOCUMENT.ID" },
- { "mDataProp": "DOCUMENT.NAME" }
- ],
- "fnPreDrawCallback": function (oSettings) {
- // create a thumbs container if it doesn't exist. put it in the dataTables_scrollbody div
- if (this.$('tr', {"filter": "applied"} ).length == 0) {
- this.html('
'+
- ''+
- ' '+
- ' '+
- ' '+
- ' '+
- ' '+
- ''+
- tr("There are no templates available")+
- ' '+
- '
');
- } else {
- $("#provision_flow_templates_table").html('
');
- }
-
- return true;
- },
- "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
- var data = aData.DOCUMENT;
- var body = data.TEMPLATE.BODY;
- var logo;
-
- var roles_li = "";
- if (body.roles) {
- $.each(body.roles, function(index, role) {
- var role_state = get_provision_flow_state(role);
-
- roles_li +=
- '
'+
- ' '+
- role.name+
- ''+role.cardinality+" VMs "+
- ' ';
- });
- }
-
- if (body.LOGO) {
- logo = '
'+
- ' '+
- ' ';
- } else {
- logo = '
'+
- ' '+
- ' ';
- }
-
- var li = $('
'+
- ''+
- ''+
- data.NAME+
- ' '+
- ''+
- logo +
- ' '+
- roles_li +
- ''+
- (data.TEMPLATE.DESCRIPTION || '')+
- ' '+
- ' '+
- ' ').appendTo($("#provision_flow_templates_ul"));
-
- $(".provision-pricing-table", li).data("opennebula", aData);
-
- return nRow;
- }
- });
-
- $('#provision_create_flow_template_search').on('keyup',function(){
- provision_flow_templates_datatable.fnFilter( $(this).val() );
- })
-
- $('#provision_create_flow_template_search').on('change',function(){
- provision_flow_templates_datatable.fnFilter( $(this).val() );
- })
-
- $("#provision_create_flow_template_refresh_button").click(function(){
- OpenNebula.Helper.clear_cache("SERVICE_TEMPLATE");
- update_provision_flow_templates_datatable(provision_flow_templates_datatable);
-
- });
-
- tab.on("click", ".provision_select_flow_template .provision-pricing-table.only-one" , function(){
- var context = $("#provision_create_flow");
-
- if ($(this).hasClass("selected")){
- $("#provision_customize_flow_template").hide();
- $("#provision_customize_flow_template").html("");
- $(".provision_network_selector", context).html("")
- $(".provision_custom_attributes_selector", context).html("")
-
- $(".provision_accordion_flow_template .selected_template").hide();
- $(".provision_accordion_flow_template .select_template").show();
- } else {
- $("#provision_customize_flow_template").show();
- $("#provision_customize_flow_template").html("");
-
- var data = $(this).data("opennebula");
- var body = data.DOCUMENT.TEMPLATE.BODY;
-
- $(".provision_accordion_flow_template .selected_template").show();
- $(".provision_accordion_flow_template .select_template").hide();
- $(".provision_accordion_flow_template .selected_template_name").html(body.name)
- $(".provision_accordion_flow_template .selected_template_logo").html('
');
- $(".provision_accordion_flow_template a").first().trigger("click");
-
- var context = $("#provision_create_flow");
-
- if (body.custom_attrs) {
- var network_attrs = [];
- var text_attrs = [];
-
- $.each(body.custom_attrs, function(key, value){
- var parts = value.split("|");
- // 0 mandatory; 1 type; 2 desc;
- var attrs = {
- "name": key,
- "mandatory": parts[0],
- "type": parts[1],
- "description": parts[2],
- }
-
- switch (parts[1]) {
- case "vnet_id":
- network_attrs.push(attrs)
- break;
- case "text":
- text_attrs.push(attrs)
- break;
- case "password":
- text_attrs.push(attrs)
- break;
- }
- })
-
- if (network_attrs.length > 0) {
- generate_provision_network_accordion(
- $(".provision_network_selector", context));
-
- $.each(network_attrs, function(index, vnet_attr){
- generate_provision_network_table(
- $(".provision_nic_accordion", context),
- null,
- vnet_attr);
- });
- }
-
- //if (text_attrs.length > 0) {
- // generate_custom_attrs(
- // $(".provision_custom_attributes_selector", context),
- // text_attrs);
- //}
- } else {
- $(".provision_network_selector", context).html("")
- $(".provision_custom_attributes_selector", context).html("")
- }
-
- $.each(body.roles, function(index, role){
- var context = $('
'+
- '
'+
- '
'+
- ''+
- ' '+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
').appendTo($("#provision_customize_flow_template"))
-
- context.data("opennebula", role);
-
- var template_id = role.vm_template;
- var role_html_id = "#provision_create_flow_role_"+index;
-
- generate_cardinality_selector(
- $(".provision_cardinality_selector", context),
- role);
-
- OpenNebula.Template.show({
- data : {
- id: template_id
- },
- success: function(request,template_json){
- var role_context = $(role_html_id)
- //var template_nic = template_json.VMTEMPLATE.TEMPLATE.NIC
- //var nics = []
- //if ($.isArray(template_nic))
- // nics = template_nic
- //else if (!$.isEmptyObject(template_nic))
- // nics = [template_nic]
-//
- //generate_provision_instance_type_accordion(
- // $(".provision_capacity_selector", role_context),
- // template_json.VMTEMPLATE.TEMPLATE);
-
- if (template_json.VMTEMPLATE.TEMPLATE.USER_INPUTS) {
- generate_custom_attrs(
- $(".provision_custom_attributes_selector", role_context),
- template_json.VMTEMPLATE.TEMPLATE.USER_INPUTS);
- }
- }
- })
-
-
- })
-
- $(document).foundation();
- }
- })
-
- tab.on("click", "#provision_create_flow .provision-pricing-table.only-one" , function(){
- if ($(this).hasClass("selected")){
- $(this).removeClass("selected");
- } else {
- $(".provision-pricing-table", $(this).parents(".large-block-grid-3,.large-block-grid-2")).removeClass("selected")
- $(this).addClass("selected");
- }
- })
-
- $("#provision_create_flow").submit(function(){
- var context = $(this);
-
- var flow_name = $("#flow_name", context).val();
- var template_id = $(".provision_select_flow_template .selected", context).attr("opennebula_id");
-
- if (!template_id) {
- $(".alert-box-error", context).fadeIn().html(tr("You must select at least a template configuration"));
- return false;
- }
-
- var custom_attrs = {}
- var missing_network = false;
- if ($(".provision_nic_accordion", context)) {
- $(".selected_network", $(".provision_nic_accordion", context)).each(function(){
- if (!$(this).attr("opennebula_id")) {
- $(this).css("color", "red");
- missing_network = true;
- } else {
- $(this).css("color", "#777");
- custom_attrs[$(this).attr("attr_name")] = $(this).attr("opennebula_id");
- }
- })
- }
-
- if (missing_network) {
- $(".alert-box-error", context).fadeIn().html(tr("You have not specified all the Networks for this Service"));
- return false;
- }
-
- var roles = [];
- var missing_attr = false;
-
- $(".provision_create_flow_role", context).each(function(){
- var user_inputs_values = {};
- if ($(".provision_custom_attributes", $(this))) {
- $(".provision_custom_attribute", $(".provision_custom_attributes", $(this))).each(function(){
- if (!$(this).val()) {
- $(this).parent("label").css("color", "red");
- missing_attr = true;
- } else {
- $(this).parent("label").css("color", "#777");
- user_inputs_values[$(this).attr("attr_name")] = $(this).val();
- }
- })
- }
-
- var role_template = $(this).data("opennebula");
- roles.push($.extend(role_template, {
- "cardinality": $(".cardinality_value", $(this)).text(),
- "user_inputs_values": user_inputs_values
- }));
- })
-
- var extra_info = {
- 'merge_template': {
- "name" : flow_name,
- "roles" : roles,
- "custom_attrs_values": custom_attrs
- }
- }
-
- if (missing_attr) {
- $(".alert-box-error", $(this)).fadeIn().html(tr("You have not specified all the Custom Atrributes for this Service"));
- return false;
- }
-
- Sunstone.runAction("Provision.Flow.instantiate", template_id, extra_info);
- return false;
- })
-
- $(".provision_create_flow_button").on("click", function(){
- show_provision_create_flow();
- });
-
- //
- // VDC Info
- //
-
-
- $("#provision_vdc_info_button").on("click", function(){
- OpenNebula.Helper.clear_cache("GROUP");
- show_provision_vdc_info();
- });
-
- //
- // Create User
- //
-
- var provision_rvms_quota_input = $("#provision_rvms_quota_input");
- var provision_rvms_quota_slider = $( "#provision_rvms_quota_slider").noUiSlider({
- handles: 1,
- connect: "lower",
- range: [0,5000],
- step: 100,
- start: 500,
- value: 500,
- slide: function(type) {
- if ( type != "move"){
- provision_rvms_quota_input.val($(this).val()/100);
- }
- }
- });
-
- provision_rvms_quota_slider.addClass("noUiSlider");
-
- provision_rvms_quota_input.change(function() {
- provision_rvms_quota_slider.val(this.value * 100)
- });
-
- var provision_cpu_quota_input = $("#provision_cpu_quota_input");
- var provision_cpu_quota_slider = $( "#provision_cpu_quota_slider").noUiSlider({
- handles: 1,
- connect: "lower",
- range: [0,20000],
- step: 100,
- start: 4000,
- value: 4000,
- slide: function(type) {
- if ( type != "move"){
- provision_cpu_quota_input.val($(this).val()/100);
- }
- }
- });
-
- provision_cpu_quota_slider.addClass("noUiSlider");
-
- provision_cpu_quota_input.change(function() {
- provision_cpu_quota_slider.val(this.value * 100)
- });
-
- var provision_memory_quota_input = $("#provision_memory_quota_input");
- var provision_memory_quota_tmp_input = $("#provision_memory_quota_tmp_input");
-
- var update_final_memory_input = function() {
- var value = provision_memory_quota_tmp_input.val();
- if (value > 0) {
- provision_memory_quota_input.val( Math.floor(value * 1024) );
- } else {
- provision_memory_quota_input.val(value);
- }
- }
-
- var provision_memory_quota_slider = $( "#provision_memory_quota_slider").noUiSlider({
- handles: 1,
- connect: "lower",
- range: [0,6400],
- start: 1600,
- step: 50,
- value: 1600,
- slide: function(type) {
- if ( type != "move"){
- provision_memory_quota_tmp_input.val($(this).val()/100);
- provision_memory_quota_tmp_input.change();
- }
- }
- });
-
- provision_memory_quota_tmp_input.change(function() {
- provision_memory_quota_slider.val(this.value * 100)
- update_final_memory_input();
- });
-
- provision_memory_quota_slider.addClass("noUiSlider");
-
- $("#provision_create_user").submit(function(){
- var context = $(this);
-
- var username = $("#username", context).val();
- var password = $("#password", context).val();
- var repeat_password = $("#repeat_password", context).val();
-
- // TODO driver
- var driver = 'core';
-
- if (!username.length || !password.length){
- $(".alert-box-error", context).fadeOut();
- $(".alert-box-error", context).fadeIn().html(tr("You have to provide a username and password"));
- return false;
- }
-
- if (password !== repeat_password){
- $(".alert-box-error", context).fadeOut();
- $(".alert-box-error", context).fadeIn().html(tr("Passwords do not match"));
- return false;
- }
-
- var user_json = { "user" :
- { "name" : username,
- "password" : password,
- "auth_driver" : driver
- }
- };
-
- Sunstone.runAction("Provision.User.create",user_json);
- $(".alert-box-error", context).html('
'+
- ''+
- ' '+
- ' '+
- ' '+
- ' '+
- ' '+
- ''+
- ' '+
- '
');
-
- return false;
- });
-
- $(document).on("click", ".provision_create_user_button", function(){
- show_provision_create_user();
- });
- }
-});
diff --git a/eole-one-frontend.mk b/eole-one-frontend.mk
deleted file mode 100644
index 12f4bb6..0000000
--- a/eole-one-frontend.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-bugfix_DATA_DIR := $(eole_DIR)/hapy/bugfix
-