diff --git a/src/oca/ruby/opennebula/virtual_machine_pool.rb b/src/oca/ruby/opennebula/virtual_machine_pool.rb index 74861aab9e..f1ca0dec63 100644 --- a/src/oca/ruby/opennebula/virtual_machine_pool.rb +++ b/src/oca/ruby/opennebula/virtual_machine_pool.rb @@ -312,11 +312,11 @@ module OpenNebula # part of the Pool. Possible values: INFO_ALL, INFO_GROUP, INFO_MINE # or user_id # @param [Hash] options - # @option params [Integer] :start_month First month (+year) to take + # @option params [Integer] :start_year First month (+year) to take # into account, if no start time is required use -1 # @option params [Integer] :start_month First year (+month) to take # into account, if no start time is required use -1 - # @option params [Integer] :end_month Last month (+year) to take + # @option params [Integer] :end_year Last month (+year) to take # into account, if no end time is required use -1 # @option params [Integer] :end_month Last year (+month) to take # into account, if no end time is required use -1 @@ -366,11 +366,11 @@ module OpenNebula # part of the Pool. Possible values: INFO_ALL, INFO_GROUP, INFO_MINE # or user_id # @param [Hash] options - # @option params [Integer] :start_month First month (+year) to take + # @option params [Integer] :start_year First month (+year) to take # into account, if no start time is required use -1 # @option params [Integer] :start_month First year (+month) to take # into account, if no start time is required use -1 - # @option params [Integer] :end_month Last month (+year) to take + # @option params [Integer] :end_year Last month (+year) to take # into account, if no end time is required use -1 # @option params [Integer] :end_month Last year (+month) to take # into account, if no end time is required use -1 diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index 3a7e1698aa..67295541d1 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -51,6 +51,8 @@ tabs: panel_tabs: user_info_tab: true user_quotas_tab: true + user_accounting_tab: true + user_showback_tab: true table_columns: - 0 # Checkbox - 1 # ID @@ -74,7 +76,11 @@ tabs: User.delete: true groups-tab: panel_tabs: + group_info_tab: true group_quotas_tab: true + group_providers_tab: true + group_accounting_tab: true + group_shoback_tab: true table_columns: - 0 # Checkbox - 1 # ID diff --git a/src/sunstone/etc/sunstone-views/user.yaml b/src/sunstone/etc/sunstone-views/user.yaml index e10cb96ea1..bd5e5edcdd 100644 --- a/src/sunstone/etc/sunstone-views/user.yaml +++ b/src/sunstone/etc/sunstone-views/user.yaml @@ -51,6 +51,8 @@ tabs: panel_tabs: user_info_tab: true user_quotas_tab: true + user_accounting_tab: true + user_showback_tab: true table_columns: - 0 # Checkbox - 1 # ID @@ -73,7 +75,11 @@ tabs: User.delete: true groups-tab: panel_tabs: + group_info_tab: true group_quotas_tab: true + group_providers_tab: true + group_accounting_tab: true + group_shoback_tab: true table_columns: - 0 # Checkbox - 1 # ID diff --git a/src/sunstone/etc/sunstone-views/vcenter.yaml b/src/sunstone/etc/sunstone-views/vcenter.yaml index 207bdb1ef6..87d8b2b560 100644 --- a/src/sunstone/etc/sunstone-views/vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/vcenter.yaml @@ -51,6 +51,8 @@ tabs: panel_tabs: user_info_tab: true user_quotas_tab: true + user_accounting_tab: true + user_showback_tab: true table_columns: - 0 # Checkbox - 1 # ID @@ -74,7 +76,11 @@ tabs: User.delete: true groups-tab: panel_tabs: + group_info_tab: true group_quotas_tab: true + group_providers_tab: true + group_accounting_tab: true + group_shoback_tab: true table_columns: - 0 # Checkbox - 1 # ID diff --git a/src/sunstone/models/SunstoneServer.rb b/src/sunstone/models/SunstoneServer.rb index 9cc1e705c7..19c1e1a9c8 100644 --- a/src/sunstone/models/SunstoneServer.rb +++ b/src/sunstone/models/SunstoneServer.rb @@ -395,12 +395,16 @@ class SunstoneServer < CloudServer pool = VirtualMachinePool.new(@client) filter_flag = options[:userfilter] ? options[:userfilter].to_i : VirtualMachinePool::INFO_ALL - start_time = options[:start_time] ? options[:start_time].to_i : -1 - end_time = options[:end_time] ? options[:end_time].to_i : -1 + start_month = options[:start_month] ? options[:start_month].to_i : -1 + start_year = options[:start_year] ? options[:start_year].to_i : -1 + end_month = options[:end_month] ? options[:end_month].to_i : -1 + end_year = options[:end_year] ? options[:end_year].to_i : -1 acct_options = { - :start_time => start_time, - :end_time => end_time, + :start_month => start_month, + :start_year => start_year, + :end_month => end_month, + :end_year => end_year, :group => options[:group] } diff --git a/src/sunstone/public/js/plugins/config-tab.js b/src/sunstone/public/js/plugins/config-tab.js index bb6e08ba9a..fed96b8b45 100644 --- a/src/sunstone/public/js/plugins/config-tab.js +++ b/src/sunstone/public/js/plugins/config-tab.js @@ -361,15 +361,6 @@ function setupConfigDialog() { }); } -function tr(str){ - var tmp = locale[str]; - if ( tmp == null || tmp == "" ) { - //console.debug("Missing translation: "+str); - tmp = str; - } - return tmp; -}; - function updateUserConfigInfo(request,user_json) { var info = user_json.USER; diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js index 5bcc2f1fc2..4712b05bd9 100644 --- a/src/sunstone/public/js/plugins/groups-tab.js +++ b/src/sunstone/public/js/plugins/groups-tab.js @@ -734,10 +734,17 @@ function updateGroupInfo(request,group){ content: '
' }; + var showback_tab = { + title: tr("Showback"), + icon: "fa-money", + content: '
' + }; + Sunstone.updateInfoPanelTab("group_info_panel","group_info_tab",info_tab); Sunstone.updateInfoPanelTab("group_info_panel","group_quotas_tab",quotas_tab); Sunstone.updateInfoPanelTab("group_info_panel","group_providers_tab",providers_tab); - Sunstone.updateInfoPanelTab("group_info_panel","group_accouning_tab",accounting_tab); + Sunstone.updateInfoPanelTab("group_info_panel","group_accounting_tab",accounting_tab); + Sunstone.updateInfoPanelTab("group_info_panel","group_showback_tab",showback_tab); Sunstone.popUpInfoPanel("group_info_panel", 'groups-tab'); $("#add_rp_button", $("#group_info_panel")).click(function(){ @@ -753,6 +760,10 @@ function updateGroupInfo(request,group){ { fixed_group: info.ID, init_group_by: "user" }); + showbackGraphs( + $("#group_showback","#group_info_panel"), + { fixed_group: info.ID }); + setupQuotasPanel(info, "#group_info_panel", Config.isTabActionEnabled("groups-tab", "Group.quotas_dialog"), diff --git a/src/sunstone/public/js/plugins/provision-tab.js b/src/sunstone/public/js/plugins/provision-tab.js index 45002107a9..6019023be3 100644 --- a/src/sunstone/public/js/plugins/provision-tab.js +++ b/src/sunstone/public/js/plugins/provision-tab.js @@ -1206,6 +1206,21 @@ var provision_manage_vdc = ''+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ '
'+ '
'+ '

'+ @@ -2007,18 +2022,23 @@ function generate_provision_instance_type_accordion(context, capacity) { '
'+ '
'+ '
'+ - '
'+ + '
'+ ''+capacity.CPU+''+ '
'+ ''+tr("CPU")+''+ '
'+ - '
'+ + '
'+ ''+memory_value+''+ ' '+ ''+memory_unit+''+ '
'+ ''+tr("MEMORY")+''+ '
'+ + ''+ '
'+ '
'+ '
'+ @@ -2061,6 +2081,25 @@ function generate_provision_instance_type_accordion(context, capacity) { '
'+ '
'); + var cost = 0; + if (capacity.CPU_COST || capacity.MEMORY_COST) { + $(".provision_create_template_cost_div").show(); + + if (capacity.CPU && capacity.CPU_COST) { + cost += capacity.CPU * capacity.CPU_COST + $(".cost_value").data("CPU_COST", capacity.CPU_COST); + } + + if (capacity.MEMORY && capacity.MEMORY_COST) { + cost += capacity.MEMORY * capacity.MEMORY_COST + $(".cost_value").data("MEMORY_COST", capacity.MEMORY_COST); + } + + $(".cost_value").html(cost); + } else { + $(".provision_create_template_cost_div").hide(); + } + provision_instance_type_accordion_id += 1; var provision_instance_types_datatable = $('.provision_instance_types_table', context).dataTable({ @@ -2153,6 +2192,18 @@ function generate_provision_instance_type_accordion(context, capacity) { $(".memory_value", context).html(memory_value); $(".memory_unit", context).html(memory_unit); + var cost = 0; + + if ($(".cost_value").data("CPU_COST")) { + cost += $(this).attr("cpu") * $(".cost_value").data("CPU_COST") + } + + if ($(".cost_value").data("MEMORY_COST")) { + cost += $(this).attr("memory") * $(".cost_value").data("MEMORY_COST") + } + + $(".cost_value").html(cost); + $('.accordion a', context).first().trigger("click"); }) @@ -2776,6 +2827,10 @@ function show_provision_group_info_callback(request, response) { { fixed_group: info.ID, init_group_by: "user" }); + showbackGraphs( + $("#provision_info_vdc_group_showback", context), + { fixed_group: info.ID }); + $("#acct_placeholder", context).hide(); } @@ -5081,6 +5136,9 @@ function setup_provision_user_info(context) { ''+ + ''+ ''+ '
  • '+ '
  • ') @@ -5217,6 +5275,19 @@ function setup_provision_user_info(context) { '

    ') }) + context.on("click", ".provision_vdc_user_info_show_showback", function(){ + $(".provision_vdc_info_container", context).html(""); + + showbackGraphs( + $(".provision_vdc_info_container", context), + { fixed_user: $(".provision_info_vdc_user", context).attr("opennebula_id")}); + + $(".provision_vdc_info_container", context).prepend( + '

    '+ + $(".provision_info_vdc_user", context).attr("uname") + ' ' + tr("Showback")+ + '

    ') + }) + context.on("click", ".provision_vdc_user_delete_confirm_button", function(){ $(".provision_vdc_user_confirm_action", context).html( '
    '+ diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index 7a210db724..cf82dc31b6 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -827,7 +827,6 @@ function generate_capacity_tab_content() { ''+ '
    '+ '
    '+ - '
    '+ generate_capacity_inputs(); return html; @@ -839,51 +838,69 @@ function generate_capacity_inputs() { ''+ '
    '+ '
    '+ - '
    '+ - '