mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Feature #4317: Remove all user and group features from provision-tab
This commit is contained in:
parent
f0c137f8f2
commit
f30c15ed6d
@ -18,7 +18,6 @@ tabs:
|
||||
vm_template_tab: false
|
||||
vm_log_tab: false
|
||||
provision_tabs:
|
||||
users: false
|
||||
flows: true
|
||||
templates: true
|
||||
actions: &provisionactions
|
||||
@ -51,7 +50,6 @@ tabs:
|
||||
vms: true
|
||||
vdcquotas: false
|
||||
vdcvms: false
|
||||
users: false
|
||||
create_vm:
|
||||
capacity_select: true
|
||||
network_select: true
|
||||
|
@ -18,7 +18,6 @@ tabs:
|
||||
vm_template_tab: false
|
||||
vm_log_tab: false
|
||||
provision_tabs:
|
||||
users: false
|
||||
flows: true
|
||||
templates: false
|
||||
actions: &provisionactions
|
||||
@ -51,7 +50,6 @@ tabs:
|
||||
vms: true
|
||||
vdcquotas: false
|
||||
vdcvms: false
|
||||
users: false
|
||||
create_vm:
|
||||
capacity_select: false
|
||||
network_select: true
|
||||
|
@ -1,97 +0,0 @@
|
||||
provision_logo: images/one_small_logo.png
|
||||
enabled_tabs:
|
||||
- provision-tab
|
||||
- users-tab
|
||||
- settings-tab
|
||||
features:
|
||||
showback: true
|
||||
tabs:
|
||||
provision-tab:
|
||||
panel_tabs:
|
||||
vm_info_tab: false
|
||||
vm_capacity_tab: false
|
||||
vm_hotplugging_tab: false
|
||||
vm_network_tab: false
|
||||
vm_snapshot_tab: false
|
||||
vm_placement_tab: false
|
||||
vm_actions_tab: false
|
||||
vm_template_tab: false
|
||||
vm_log_tab: false
|
||||
provision_tabs:
|
||||
users: true
|
||||
flows: true
|
||||
templates: true
|
||||
actions: &provisionactions
|
||||
Template.chmod: true
|
||||
Template.delete: true
|
||||
VM.rename: true
|
||||
VM.resume: true
|
||||
VM.reboot: true
|
||||
VM.reboot_hard: true
|
||||
VM.poweroff: true
|
||||
VM.poweroff_hard: true
|
||||
VM.undeploy: false
|
||||
VM.undeploy_hard: false
|
||||
VM.shutdown_hard: true
|
||||
VM.delete: true
|
||||
VM.resize: false
|
||||
VM.attachdisk: false
|
||||
VM.detachdisk: false
|
||||
VM.disk_saveas: false
|
||||
VM.attachnic: false
|
||||
VM.detachnic: false
|
||||
VM.snapshot_create: false
|
||||
VM.snapshot_revert: false
|
||||
VM.snapshot_delete: false
|
||||
VM.disk_snapshot_create: false
|
||||
VM.disk_snapshot_revert: false
|
||||
VM.disk_snapshot_delete: false
|
||||
dashboard:
|
||||
quotas: false
|
||||
vms: false
|
||||
vdcquotas: true
|
||||
vdcvms: true
|
||||
users: true
|
||||
create_vm:
|
||||
capacity_select: true
|
||||
network_select: true
|
||||
disk_resize: true
|
||||
settings-tab:
|
||||
panel_tabs:
|
||||
user_info_tab: false
|
||||
user_config_tab: true
|
||||
user_quotas_tab: true
|
||||
user_accounting_tab: true
|
||||
user_showback_tab: true
|
||||
actions:
|
||||
User.quotas_dialog: false
|
||||
vms-tab:
|
||||
actions: *provisionactions
|
||||
images-tab:
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
- 2 # Owner
|
||||
- 3 # Group
|
||||
- 4 # Name
|
||||
- 5 # Datastore
|
||||
#- 6 # Size
|
||||
- 7 # Type
|
||||
#- 8 # Registration time
|
||||
#- 9 # Persistent
|
||||
- 10 # Status
|
||||
- 11 # #VMs
|
||||
#- 12 # Target
|
||||
vnets-tab:
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
- 2 # Owner
|
||||
- 3 # Group
|
||||
- 4 # Name
|
||||
- 5 # Reservation
|
||||
- 6 # Cluster
|
||||
#- 7 # Bridge
|
||||
- 8 # Leases
|
||||
#- 9 # VLAN ID
|
||||
|
@ -1,96 +0,0 @@
|
||||
provision_logo: images/one_small_logo.png
|
||||
enabled_tabs:
|
||||
- provision-tab
|
||||
- users-tab
|
||||
- settings-tab
|
||||
features:
|
||||
showback: true
|
||||
tabs:
|
||||
provision-tab:
|
||||
panel_tabs:
|
||||
vm_info_tab: false
|
||||
vm_capacity_tab: false
|
||||
vm_hotplugging_tab: false
|
||||
vm_network_tab: false
|
||||
vm_snapshot_tab: false
|
||||
vm_placement_tab: false
|
||||
vm_actions_tab: false
|
||||
vm_template_tab: false
|
||||
vm_log_tab: false
|
||||
provision_tabs:
|
||||
users: true
|
||||
flows: true
|
||||
templates: false
|
||||
actions: &provisionactions
|
||||
Template.chmod: false
|
||||
Template.delete: true
|
||||
VM.rename: false
|
||||
VM.resume: true
|
||||
VM.reboot: true
|
||||
VM.reboot_hard: true
|
||||
VM.poweroff: true
|
||||
VM.poweroff_hard: true
|
||||
VM.undeploy: false
|
||||
VM.undeploy_hard: false
|
||||
VM.shutdown_hard: true
|
||||
VM.delete: true
|
||||
VM.resize: false
|
||||
VM.attachdisk: false
|
||||
VM.detachdisk: false
|
||||
VM.disk_saveas: false
|
||||
VM.attachnic: false
|
||||
VM.detachnic: false
|
||||
VM.snapshot_create: false
|
||||
VM.snapshot_revert: false
|
||||
VM.snapshot_delete: false
|
||||
VM.disk_snapshot_create: false
|
||||
VM.disk_snapshot_revert: false
|
||||
VM.disk_snapshot_delete: false
|
||||
dashboard:
|
||||
quotas: false
|
||||
vms: false
|
||||
vdcquotas: true
|
||||
vdcvms: true
|
||||
users: true
|
||||
create_vm:
|
||||
capacity_select: false
|
||||
network_select: true
|
||||
settings-tab:
|
||||
panel_tabs:
|
||||
user_info_tab: false
|
||||
user_config_tab: true
|
||||
user_quotas_tab: true
|
||||
user_accounting_tab: true
|
||||
user_showback_tab: true
|
||||
actions:
|
||||
User.quotas_dialog: false
|
||||
vms-tab:
|
||||
actions: *provisionactions
|
||||
images-tab:
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
- 2 # Owner
|
||||
- 3 # Group
|
||||
- 4 # Name
|
||||
- 5 # Datastore
|
||||
#- 6 # Size
|
||||
- 7 # Type
|
||||
#- 8 # Registration time
|
||||
#- 9 # Persistent
|
||||
- 10 # Status
|
||||
- 11 # #VMs
|
||||
#- 12 # Target
|
||||
vnets-tab:
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
- 2 # Owner
|
||||
- 3 # Group
|
||||
- 4 # Name
|
||||
- 5 # Reservation
|
||||
- 6 # Cluster
|
||||
#- 7 # Bridge
|
||||
- 8 # Leases
|
||||
#- 9 # VLAN ID
|
||||
|
@ -39,11 +39,8 @@ define(function(require) {
|
||||
var UserInputs = require('utils/user-inputs');
|
||||
var CapacityInputs = require('tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-inputs');
|
||||
|
||||
var ProvisionQuotaWidget = require('./provision-tab/users/quota-widget');
|
||||
|
||||
var ProvisionVmsList = require('./provision-tab/vms/list');
|
||||
var ProvisionTemplatesList = require('./provision-tab/templates/list');
|
||||
var ProvisionUsersList = require('./provision-tab/users/list');
|
||||
var ProvisionFlowsList = require('./provision-tab/flows/list');
|
||||
|
||||
// Templates
|
||||
@ -54,48 +51,11 @@ define(function(require) {
|
||||
var TemplateDashboardVdcQuotas = require('hbs!./provision-tab/dashboard/vdc-quotas');
|
||||
var TemplateDashboardVms = require('hbs!./provision-tab/dashboard/vms');
|
||||
var TemplateDashboardVdcVms = require('hbs!./provision-tab/dashboard/vdc-vms');
|
||||
var TemplateDashboardUsers = require('hbs!./provision-tab/dashboard/users');
|
||||
|
||||
var TemplateGroupInfo = require('hbs!./provision-tab/group/info');
|
||||
|
||||
var TAB_ID = require('./provision-tab/tabId');
|
||||
var TEMPLATE_LABELS_COLUMN = 4;
|
||||
|
||||
var povision_actions = {
|
||||
"Provision.User.create" : {
|
||||
type: "create",
|
||||
call: OpenNebula.User.create,
|
||||
callback: function(request, response) {
|
||||
if ( $("div#provision_create_user_manual_quota",
|
||||
$("#provision_create_user")).hasClass("active") ){
|
||||
|
||||
quota_json = ProvisionQuotaWidget.retrieve($("#provision_create_user"));
|
||||
|
||||
Sunstone.runAction("Provision.User.set_quota",
|
||||
[response.USER.ID], quota_json);
|
||||
} else {
|
||||
clear_provision_create_user();
|
||||
}
|
||||
},
|
||||
error: Notifier.onError
|
||||
},
|
||||
|
||||
"Provision.User.set_quota" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.User.set_quota,
|
||||
callback: function(request) {
|
||||
clear_provision_create_user();
|
||||
},
|
||||
error: Notifier.onError
|
||||
},
|
||||
|
||||
"Provision.Group.show" : {
|
||||
type: "single",
|
||||
call: OpenNebula.Group.show,
|
||||
callback: show_provision_group_info_callback,
|
||||
error: Notifier.onError
|
||||
},
|
||||
|
||||
"Provision.Flow.instantiate" : {
|
||||
type: "single",
|
||||
call: OpenNebula.ServiceTemplate.instantiate,
|
||||
@ -546,46 +506,6 @@ define(function(require) {
|
||||
});
|
||||
}
|
||||
|
||||
if (Config.provision.dashboard.isEnabled("users")) {
|
||||
$("#provision_dashboard").append(TemplateDashboardUsers());
|
||||
|
||||
var start_time = Math.floor(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,
|
||||
"group": config["user_gid"]
|
||||
}
|
||||
|
||||
var no_table = true;
|
||||
|
||||
OpenNebula.VM.accounting({
|
||||
success: function(req, response){
|
||||
Accounting.fillAccounting($("#dashboard_vdc_user_accounting"), req, response, no_table);
|
||||
},
|
||||
error: Notifier.onError,
|
||||
data: options
|
||||
});
|
||||
|
||||
OpenNebula.User.list({
|
||||
timeout: true,
|
||||
success: function (request, item_list){
|
||||
var total = item_list.length || 0;
|
||||
|
||||
var context = $("#provision_users_dashboard");
|
||||
$("#provision_dashboard_users_total", context).html(total);
|
||||
},
|
||||
error: Notifier.onError
|
||||
});
|
||||
}
|
||||
|
||||
if (Config.provision.dashboard.isEnabled("quotas")) {
|
||||
$("#provision_dashboard").append(TemplateDashboardQuotas());
|
||||
|
||||
@ -687,49 +607,6 @@ define(function(require) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function show_provision_user_info() {
|
||||
Sunstone.runAction("Provision.User.show", "-1");
|
||||
$(".section_content").hide();
|
||||
$("#provision_user_info").fadeIn();
|
||||
$("dd.active a", $("#provision_user_info")).trigger("click");
|
||||
}
|
||||
|
||||
|
||||
|
||||
function show_provision_group_info_callback(request, response) {
|
||||
var info = response.GROUP;
|
||||
|
||||
var context = $("#provision_manage_vdc");
|
||||
|
||||
var default_group_quotas = QuotaDefaults.default_quotas(info.DEFAULT_GROUP_QUOTAS);
|
||||
|
||||
var quotas_tab_html = QuotaWidgets.initQuotasPanel(info, default_group_quotas,
|
||||
"#provision_vdc_quotas_div", false);
|
||||
|
||||
$("#provision_vdc_quotas_div").html(quotas_tab_html);
|
||||
|
||||
QuotaWidgets.setupQuotasPanel(info,
|
||||
"#provision_vdc_quotas_div",
|
||||
false,
|
||||
"Group");
|
||||
|
||||
$("#provision_info_vdc_group_acct", context).html(Accounting.html());
|
||||
Accounting.setup(
|
||||
$("#provision_info_vdc_group_acct", context),
|
||||
{ fixed_group: info.ID,
|
||||
init_group_by: "user" });
|
||||
|
||||
if (Config.isFeatureEnabled("showback")) {
|
||||
$("#provision_info_vdc_group_showback", context).html(Showback.html());
|
||||
Showback.setup(
|
||||
$("#provision_info_vdc_group_showback", context),
|
||||
{ fixed_user: "", fixed_group: info.ID });
|
||||
}
|
||||
|
||||
$("#acct_placeholder", context).hide();
|
||||
}
|
||||
|
||||
function show_provision_create_vm() {
|
||||
OpenNebula.Action.clear_cache("VMTEMPLATE");
|
||||
|
||||
@ -773,19 +650,6 @@ define(function(require) {
|
||||
$("#provision_create_flow").fadeIn();
|
||||
}
|
||||
|
||||
function show_provision_create_user() {
|
||||
$(".section_content").hide();
|
||||
$("#provision_create_user").fadeIn();
|
||||
$(document).foundation();
|
||||
}
|
||||
|
||||
function show_provision_vdc_info() {
|
||||
$(".section_content").hide();
|
||||
$("#provision_manage_vdc").fadeIn();
|
||||
|
||||
Sunstone.runAction('Provision.Group.show', "-1");
|
||||
}
|
||||
|
||||
function update_provision_flow_templates_datatable(datatable, timeout) {
|
||||
datatable.html('<div class="text-center">'+
|
||||
'<span class="fa-stack fa-5x" style="color: #dfdfdf">'+
|
||||
@ -824,22 +688,6 @@ define(function(require) {
|
||||
}, timeout);
|
||||
}
|
||||
|
||||
// Closes and resets the create user wizard
|
||||
function clear_provision_create_user(){
|
||||
OpenNebula.Action.clear_cache("USER");
|
||||
ProvisionUsersList.show(0);
|
||||
|
||||
var context = $("#provision_create_user");
|
||||
$("#username", context).val('');
|
||||
$("#password", context).val('');
|
||||
$("#repeat_password", context).val('');
|
||||
|
||||
ProvisionQuotaWidget.reset(context);
|
||||
|
||||
$(".alert-box-error", context).hide();
|
||||
$(".alert-box-error", context).html("");
|
||||
}
|
||||
|
||||
var _panels = [
|
||||
require('./vms-tab/panels/info'),
|
||||
require('./vms-tab/panels/capacity'),
|
||||
@ -901,7 +749,6 @@ define(function(require) {
|
||||
|
||||
// TODO check if active
|
||||
ProvisionFlowsList.generate($(".provision_flows_list_section"), {active: true});
|
||||
ProvisionUsersList.generate($(".provision_users_list_section"), {active: true});
|
||||
|
||||
//
|
||||
// Dashboard
|
||||
@ -940,11 +787,6 @@ define(function(require) {
|
||||
ProvisionFlowsList.show(0);
|
||||
});
|
||||
|
||||
$(document).on("click", ".provision_users_list_button", function(){
|
||||
OpenNebula.Action.clear_cache("USER");
|
||||
ProvisionUsersList.show(0);
|
||||
});
|
||||
|
||||
//
|
||||
// Create VM
|
||||
//
|
||||
@ -1504,95 +1346,6 @@ define(function(require) {
|
||||
$(".provision_create_flow_button").on("click", function(){
|
||||
show_provision_create_flow();
|
||||
});
|
||||
|
||||
//
|
||||
// Group Info
|
||||
//
|
||||
|
||||
|
||||
$("#provision_vdc_info_button").on("click", function(){
|
||||
OpenNebula.Action.clear_cache("GROUP");
|
||||
show_provision_vdc_info();
|
||||
});
|
||||
|
||||
//
|
||||
// Create User
|
||||
//
|
||||
|
||||
var context = $("#provision_create_user");
|
||||
|
||||
ProvisionQuotaWidget.setup(context);
|
||||
|
||||
// Workaround to fix sliders. Apparently the setup fails while they are hidden
|
||||
context.on('click', 'a[href="#provision_create_user_manual_quota"]', function(){
|
||||
$(".provision_rvms_quota_input", context).change();
|
||||
$(".provision_memory_quota_input", context).change();
|
||||
$(".provision_memory_quota_tmp_input", context).change();
|
||||
$(".provision_cpu_quota_input", context).change();
|
||||
|
||||
// Workaround until hidden Foundation.slider can be initialized
|
||||
var intervalCounter = 0;
|
||||
var intervalId = setInterval(function() {
|
||||
|
||||
if ($("#provision_create_user_manual_quota", context).is(":visible") ||
|
||||
intervalCounter > 5){
|
||||
|
||||
context.foundation('slider', 'reflow');
|
||||
clearInterval(intervalId);
|
||||
}
|
||||
|
||||
intervalCounter += 1;
|
||||
}, 500);
|
||||
|
||||
});
|
||||
|
||||
$("#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(Locale.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(Locale.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('<div class="text-center">'+
|
||||
'<span class="fa-stack fa-5x" style="color: #dfdfdf">'+
|
||||
'<i class="fa fa-cloud fa-stack-2x"></i>'+
|
||||
'<i class="fa fa-spinner fa-spin fa-stack-1x fa-inverse"></i>'+
|
||||
'</span>'+
|
||||
'<br>'+
|
||||
'<br>'+
|
||||
'<span style="font-size: 18px; color: #999">'+
|
||||
'</span>'+
|
||||
'</div>');
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on("click", ".provision_create_user_button", function(){
|
||||
show_provision_create_user();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -24,12 +24,6 @@
|
||||
<div class="provision_templates_list_section hidden section_content"></div>
|
||||
{{/isProvisionTabEnabled}}
|
||||
|
||||
{{#isProvisionTabEnabled "provision-tab" "users"}}
|
||||
{{> tabs/provision-tab/group/info}}
|
||||
{{> tabs/provision-tab/users/create}}
|
||||
<div class="provision_users_list_section hidden section_content"></div>
|
||||
{{/isProvisionTabEnabled}}
|
||||
|
||||
{{#isProvisionTabEnabled "provision-tab" "flows"}}
|
||||
{{> tabs/provision-tab/flows/create}}
|
||||
<div class="provision_flows_list_section hidden section_content"></div>
|
||||
|
@ -1,90 +0,0 @@
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
{{! Copyright 2002-2015, OpenNebula Project, OpenNebula Systems }}
|
||||
{{! }}
|
||||
{{! 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. }}
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
<div class="row">
|
||||
<div class="large-11 large-centered columns">
|
||||
<h3 class="subheader">
|
||||
{{tr "Users"}}
|
||||
</h3>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="provision_users_dashboard">
|
||||
<div class="large-12 large-centered columns">
|
||||
<div class="row">
|
||||
<div class="large-4 columns text-center">
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<span id="provision_dashboard_users_total" style="font-size:80px">
|
||||
<i class="fa fa-spinner fa-spin"></i>
|
||||
</span>
|
||||
<br>
|
||||
<span style="color: #999;">{{tr "TOTAL"}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<a href"#" class="medium button large success radius provision_create_user_button" style="margin-left: 5px; margin-right: 5px"><i class="fa fa-lg fa-plus-square"/></a>
|
||||
<a href"#" class="medium button large radius provision_users_list_button" style="margin-left: 5px; margin-right: 5px"><i class="fa fa-lg fa-users"/></a>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="large-8 columns" id="dashboard_vdc_user_accounting">
|
||||
<input style="display:none;" value="user" id="acct_group_by"/>
|
||||
<div class="row">
|
||||
<div class="large-12 columns graph_legend">
|
||||
<h3 class="subheader"><small>{{tr "CPU hours"}}</small></h3>
|
||||
</div>
|
||||
<div class="large-12 columns">
|
||||
<div class="large-12 columns centered graph text-center" id="acct_cpu_graph" style="height: 100px;">
|
||||
{{> ./empty-graphs}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="large-12 columns graph_legend">
|
||||
<h3 class="subheader"><small>{{tr "Memory GB hours"}}</small></h3>
|
||||
</div>
|
||||
<div class="large-12 columns">
|
||||
<div class="large-12 columns centered graph text-center" id="acct_mem_graph" style="height: 100px;">
|
||||
{{> ./empty-graphs}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="large-12 columns graph_legend">
|
||||
<h3 class="subheader"><small>{{tr "Disk MB hours"}}</small></h3>
|
||||
</div>
|
||||
<div class="large-12 columns">
|
||||
<div class="large-12 columns centered graph text-center" id="acct_disk_graph" style="height: 100px;">
|
||||
{{> ./empty-graphs}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
@ -1,55 +0,0 @@
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
{{! Copyright 2002-2015, OpenNebula Project, OpenNebula Systems }}
|
||||
{{! }}
|
||||
{{! 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. }}
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
<div id="provision_manage_vdc" class="hidden section_content">
|
||||
<div class="row">
|
||||
<div class="large-11 large-centered columns">
|
||||
<h3 class="subheader text-right">
|
||||
<span class="left">{{tr "Group Accounting"}}</span>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div id="provision_info_vdc_group_acct" class="large-10 large-centered columns"></div>
|
||||
</div>
|
||||
<br>
|
||||
{{#isFeatureEnabled "showback"}}
|
||||
<div class="row">
|
||||
<div class="large-11 large-centered columns">
|
||||
<h3 class="subheader text-right">
|
||||
<span class="left">{{tr "Group Showback"}}</span>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div id="provision_info_vdc_group_showback" class="large-10 large-centered columns"></div>
|
||||
</div>
|
||||
<br>
|
||||
{{/isFeatureEnabled}}
|
||||
<div class="row">
|
||||
<div class="large-11 large-centered columns">
|
||||
<h3 class="subheader text-right">
|
||||
<span class="left">{{tr "Group Quotas"}}</span>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="large-11 columns large-centered quotas" id="provision_vdc_quotas_div"></div>
|
||||
</div>
|
||||
</div>
|
@ -18,20 +18,6 @@
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<ul class="inline-list provision-header text-center">
|
||||
{{#isProvisionTabEnabled "provision-tab" "users"}}
|
||||
<li>
|
||||
<a href"#" class="medium off-color" id="provision_vdc_info_button">
|
||||
<i class="fa fa-fw fa-lg fa-bar-chart-o"/>
|
||||
{{tr "Group Info"}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href"#" class="medium off-color provision_users_list_button" id="">
|
||||
<i class="fa fa-fw fa-lg fa-users"/>
|
||||
{{tr "Users"}}
|
||||
</a>
|
||||
</li>
|
||||
{{/isProvisionTabEnabled}}
|
||||
<li>
|
||||
<a href"#" class="medium off-color provision_vms_list_button" id="">
|
||||
<i class="fa fa-fw fa-lg fa-th"/>
|
||||
|
@ -1,83 +0,0 @@
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
{{! Copyright 2002-2015, OpenNebula Project, OpenNebula Systems }}
|
||||
{{! }}
|
||||
{{! 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. }}
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
<form id="provision_create_user" class="hidden section_content">
|
||||
<div class="row">
|
||||
<div class="large-10 large-centered columns">
|
||||
<h2 class="subheader">{{tr "Create User"}}</h2>
|
||||
<br></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="large-8 large-centered columns">
|
||||
<input type="text" id="username" class="provision-input" placeholder="{{tr "Username"}}" style="height: 40px !important; font-size: 16px; padding: 0.5rem !important;"/>
|
||||
<br></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="large-8 large-centered columns">
|
||||
<input type="password" id="password" class="provision-input" placeholder="{{tr "Password"}}" style="height: 40px !important; font-size: 16px; padding: 0.5rem !important;"/>
|
||||
<br></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="large-8 large-centered columns">
|
||||
<input type="password" id="repeat_password" class="provision-input" placeholder="{{tr "Repeat Password"}}" style="height: 40px !important; font-size: 16px; padding: 0.5rem !important;"/>
|
||||
<br></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="large-10 large-centered columns">
|
||||
<h3 class="subheader text-right">
|
||||
<span class="left">{{tr "Define Quotas"}}</span>
|
||||
</h3>
|
||||
<br></div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="large-8 large-centered columns">
|
||||
<dl class="tabs text-center" data-tab style="width: 100%">
|
||||
<dd class="active" style="width: 50%;">
|
||||
<a href="#provision_create_user_default_quota">{{tr "Default"}}</a>
|
||||
</dd>
|
||||
<dd style="width: 50%;">
|
||||
<a href="#provision_create_user_manual_quota">{{tr "Manual"}}</a>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="tabs-content">
|
||||
<div class="content active" id="provision_create_user_default_quota">
|
||||
<div class="row">
|
||||
<div class="large-12 large-centered columns">
|
||||
<span style="font-size: 18px; color: #999">
|
||||
{{tr "Use the default system quotas set by the cloud adminstrator"}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content" id="provision_create_user_manual_quota">{{> tabs/provision-tab/users/quota-widget/html}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="large-5 large-centered columns">
|
||||
<hr>
|
||||
<br></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="large-7 columns large-centered">
|
||||
<div data-alert class="alert-box alert-box-error radius text-center hidden"></div>
|
||||
<button href="#" class="button large radius large-12 small-12" type="submit">{{tr "Add User"}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<br></form>
|
@ -1,20 +0,0 @@
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
{{! Copyright 2002-2015, OpenNebula Project, OpenNebula Systems }}
|
||||
{{! }}
|
||||
{{! 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. }}
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
<span class="fa-stack fa-2x" style="color: #dfdfdf"> <i class="fa fa-cloud fa-stack-2x"></i>
|
||||
</span>
|
||||
<br>
|
||||
<span style="color: #cfcfcf">{{tr "There is no information available"}}</span>
|
@ -1,102 +0,0 @@
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
{{! Copyright 2002-2015, OpenNebula Project, OpenNebula Systems }}
|
||||
{{! }}
|
||||
{{! 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. }}
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
<div class="text-center provision_info_vdc_user_loading">
|
||||
<span class="fa-stack fa-5x" style="color: #dfdfdf"> <i class="fa fa-cloud fa-stack-2x"></i> <i class="fa fa-spinner fa-spin fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
<br>
|
||||
<br>
|
||||
<span style="font-size: 18px; color: #999"></span>
|
||||
</div>
|
||||
<div class="provision_info_vdc_user">
|
||||
<div class="row">
|
||||
<div class="large-12 large-centered columns">
|
||||
<ul class="inline-list provision_action_icons">
|
||||
<li class="">
|
||||
<a href"#" title="{{tr "Update the User Quotas"}}" class="left button small secondary radius provision_vdc_user_quota_confirm_button tip-top">
|
||||
<i class="fa fa-fw fa-lg fa-align-left"/></a>
|
||||
<a href"#" title="{{tr "Change the password of the User"}}" class="left button small secondary radius provision_vdc_user_password_confirm_button tip-top">
|
||||
<i class="fa fa-fw fa-lg fa-lock"/></a>
|
||||
</li>
|
||||
<li class="right">
|
||||
<a href"#" title="{{tr "Delete the User"}}" class="right button small radius alert provision_vdc_user_delete_confirm_button tip-top">
|
||||
<i class="fa fa-fw fa-lg fa-trash-o"/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="provision_vdc_user_confirm_action large-12 columns"></div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<ul class="provision-pricing-table_user_info provision-pricing-table" style="border: 0px !important; background: #fff;"></ul>
|
||||
</div>
|
||||
<div class="large-12 columns">
|
||||
<div class="row dashboard_vm_accounting">
|
||||
<div id="acct_content">
|
||||
<div class="large-4 columns">
|
||||
<div class="row">
|
||||
<div class="large-12 columns graph_legend text-center">
|
||||
<span style="color: #777; font-size: 14px">{{tr "Disk MB hours"}}</span>
|
||||
</div>
|
||||
<div class="large-12 columns">
|
||||
<div class="large-12 columns centered graph" id="acct_disk_graph" style="height: 100px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="large-4 columns">
|
||||
<input style="display:none;" value="vm" id="acct_group_by"/>
|
||||
<div class="row">
|
||||
<div class="large-12 columns graph_legend text-center">
|
||||
<span style="color: #777; font-size: 14px">{{tr "CPU hours"}}</span>
|
||||
</div>
|
||||
<br>
|
||||
<div class="large-12 columns">
|
||||
<div class="large-12 columns centered graph" id="acct_cpu_graph" style="height: 100px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="large-4 columns">
|
||||
<div class="row">
|
||||
<div class="large-12 columns graph_legend text-center">
|
||||
<span style="color: #777; font-size: 14px">{{tr "Memory GB hours"}}</span>
|
||||
</div>
|
||||
<div class="large-12 columns">
|
||||
<div class="large-12 columns centered graph" id="acct_mem_graph" style="height: 100px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="acct_no_data">
|
||||
<div class="row">
|
||||
<div class="large-12 columns text-center">{{> ./empty-graphs}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="provision-user-resource-header large-12 columns text-center"></div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="provision_vdc_info_container large-12 columns"></div>
|
||||
</div>
|
||||
<br></div>
|
@ -1,56 +0,0 @@
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
{{! Copyright 2002-2015, OpenNebula Project, OpenNebula Systems }}
|
||||
{{! }}
|
||||
{{! 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. }}
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
<dl class="accordion accordion_list provision_list_users" data-accordion>
|
||||
<dd class="active accordion-navigation">
|
||||
<a href="#provision_list_user_accordion{{accordionId}}" class="provision_back right only-not-active">
|
||||
<span class="button small radius"> <i class="fa fa-fw fa-lg fa-th"/><i class="fa fa-fw fa-lg fa-chevron-left"/>
|
||||
</span>
|
||||
</a>
|
||||
<h3 class="subheader">
|
||||
{{!tr "Users"}}
|
||||
<span class="provision_info_vdc_user_name only-not-active"></span>
|
||||
<span href"#" class="right only-active provision_users_list_refresh_button button small radius secondary" title="{{tr "Refresh"}}">
|
||||
<i class="fa fa-fw fa-lg fa-refresh"/></span>
|
||||
<span href"#" class="right only-not-active provision_refresh_info button small radius secondary" title="{{tr "Refresh"}}">
|
||||
<i class="fa fa-fw fa-lg fa-refresh"/>
|
||||
</span>
|
||||
<input type="search" class="provision_list_users_search provision-search-input only-active" placeholder="Search Users"/>
|
||||
<span href"#" class="right only-active provision_create_user_button button small radius success">
|
||||
<i class="fa fa-fw fa-lg fa-plus-square"/>
|
||||
</span>
|
||||
</h3>
|
||||
<div id="provision_list_user_accordion{{accordionId}}" class="content active">
|
||||
<div class="row">
|
||||
<div class="large-12 large-centered columns">
|
||||
<table class="provision_users_table">
|
||||
<thead class="hidden">
|
||||
<tr>
|
||||
<th>{{tr "ID"}}</th>
|
||||
<th>{{tr "Name"}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="hidden"></tbody>
|
||||
</table>
|
||||
<br></div>
|
||||
</div>
|
||||
</div>
|
||||
</dd>
|
||||
<dd class="accordion-navigation">
|
||||
<a class="provision_show_user_accordion" href="#provision_show_user_accordion{{accordionId}}"></a>
|
||||
<div id="provision_show_user_accordion{{accordionId}}" class="content">{{> tabs/provision-tab/users/info}}</div>
|
||||
</dd>
|
||||
</dl>
|
@ -1,713 +0,0 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2015, OpenNebula Project, OpenNebula Systems */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
define(function(require) {
|
||||
require('foundation.alert');
|
||||
var OpenNebula = require('opennebula');
|
||||
var Locale = require('utils/locale');
|
||||
var Config = require('sunstone-config');
|
||||
var Notifier = require('utils/notifier');
|
||||
var QuotaWidgets = require('utils/quotas/quota-widgets');
|
||||
var QuotaLimits = require('utils/quotas/quota-limits');
|
||||
var QuotaDefaults = require('utils/quotas/quota-defaults');
|
||||
var Accounting = require('utils/accounting');
|
||||
var Showback = require('utils/showback');
|
||||
|
||||
var ProvisionQuotaWidget = require('./quota-widget');
|
||||
var ProvisionVmsList = require('tabs/provision-tab/vms/list');
|
||||
var ProvisionTemplatesList = require('tabs/provision-tab/templates/list');
|
||||
var ProvisionFlowsList = require('tabs/provision-tab/flows/list');
|
||||
|
||||
var TemplateProvisionQuotaWidget = require('hbs!./quota-widget/html');
|
||||
var TemplateUsersList = require('hbs!./list');
|
||||
|
||||
var _accordionId = 0;
|
||||
|
||||
return {
|
||||
'generate': generate_provision_users_list,
|
||||
'show': show_provision_user_list
|
||||
};
|
||||
|
||||
function show_provision_user_list(timeout) {
|
||||
$(".section_content").hide();
|
||||
$(".provision_users_list_section").fadeIn();
|
||||
|
||||
$("dd:not(.active) .provision_back", $(".provision_users_list_section")).trigger("click");
|
||||
$(".provision_users_list_refresh_button", $(".provision_users_list_section")).trigger("click");
|
||||
}
|
||||
|
||||
function generate_provision_users_list(context, opts) {
|
||||
context.off();
|
||||
context.html(html(opts));
|
||||
setup_provision_users_list(context);
|
||||
setup_provision_user_info(context);
|
||||
}
|
||||
|
||||
function html(opts_arg) {
|
||||
_accordionId += 1;
|
||||
return TemplateUsersList({'accordionId': _accordionId});
|
||||
}
|
||||
|
||||
function update_provision_users_datatable(datatable, timeout) {
|
||||
datatable.html('<div class="text-center">' +
|
||||
'<span class="fa-stack fa-5x" style="color: #dfdfdf">' +
|
||||
'<i class="fa fa-cloud fa-stack-2x"></i>' +
|
||||
'<i class="fa fa-spinner fa-spin fa-stack-1x fa-inverse"></i>' +
|
||||
'</span>' +
|
||||
'<br>' +
|
||||
'<br>' +
|
||||
'<span style="font-size: 18px; color: #999">' +
|
||||
'</span>' +
|
||||
'</div>');
|
||||
|
||||
setTimeout(function() {
|
||||
OpenNebula.User.list({
|
||||
timeout: true,
|
||||
success: function (request, item_list, quotas_list) {
|
||||
datatable.fnClearTable(true);
|
||||
if (item_list.length == 0) {
|
||||
datatable.html('<div class="text-center">' +
|
||||
'<span class="fa-stack fa-5x" style="color: #dfdfdf">' +
|
||||
'<i class="fa fa-cloud fa-stack-2x"></i>' +
|
||||
'<i class="fa fa-info-circle fa-stack-1x fa-inverse"></i>' +
|
||||
'</span>' +
|
||||
'<br>' +
|
||||
'<br>' +
|
||||
'<span style="font-size: 18px; color: #999">' +
|
||||
Locale.tr("The list of users is empty") +
|
||||
'</span>' +
|
||||
'</div>');
|
||||
} else {
|
||||
provision_quotas_list = quotas_list;
|
||||
datatable.fnAddData(item_list);
|
||||
}
|
||||
},
|
||||
error: Notifier.onError
|
||||
})
|
||||
}, timeout);
|
||||
}
|
||||
|
||||
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('<div class="text-center">' +
|
||||
'<span class="fa-stack fa-5x" style="color: #dfdfdf">' +
|
||||
'<i class="fa fa-cloud fa-stack-2x"></i>' +
|
||||
'<i class="fa fa-info-circle fa-stack-1x fa-inverse"></i>' +
|
||||
'</span>' +
|
||||
'<br>' +
|
||||
'<br>' +
|
||||
'<span style="font-size: 18px; color: #999">' +
|
||||
Locale.tr("The list of users is empty") +
|
||||
'</span>' +
|
||||
'</div>');
|
||||
} else {
|
||||
$(".provision_users_table", context).html('<ul class="provision_users_ul large-block-grid-3 medium-block-grid-3 small-block-grid-1 text-center"></ul>');
|
||||
}
|
||||
|
||||
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 = "";
|
||||
|
||||
var quotas_html;
|
||||
QuotaWidgets.initEmptyQuotas(data);
|
||||
|
||||
if (!$.isEmptyObject(data.VM_QUOTA)) {
|
||||
var default_user_quotas = QuotaDefaults.getDefaultUserQuotas();
|
||||
|
||||
quotas = QuotaWidgets.quotaFloatInfo(
|
||||
data.VM_QUOTA.VM.VMS_USED,
|
||||
data.VM_QUOTA.VM.VMS,
|
||||
default_user_quotas.VM_QUOTA.VM.VMS,
|
||||
true);
|
||||
|
||||
quotas_html = "";
|
||||
quotas_html += '<li class="provision-bullet-item text-left">' +
|
||||
'<i class="fa fa-fw fa-th"></i> '+ Locale.tr("VMs") +
|
||||
'<span class="right">' + quotas.str + "</span>" +
|
||||
'</li>';
|
||||
|
||||
quotas = QuotaWidgets.quotaFloatInfo(
|
||||
data.VM_QUOTA.VM.CPU_USED,
|
||||
data.VM_QUOTA.VM.CPU,
|
||||
default_user_quotas.VM_QUOTA.VM.CPU,
|
||||
true);
|
||||
|
||||
quotas_html += '<li class="provision-bullet-item text-left">' +
|
||||
'<i class="fa fa-fw fa-tachometer"></i> '+ Locale.tr("CPU") +
|
||||
'<span class="right">' + quotas.str + "</span>" +
|
||||
'</li>';
|
||||
|
||||
quotas = QuotaWidgets.quotaMBInfo(
|
||||
data.VM_QUOTA.VM.MEMORY_USED,
|
||||
data.VM_QUOTA.VM.MEMORY,
|
||||
default_user_quotas.VM_QUOTA.VM.MEMORY,
|
||||
true);
|
||||
|
||||
quotas_html += '<li class="provision-bullet-item text-left">' +
|
||||
'<i class="fa fa-fw fa-align-left"></i> '+ Locale.tr("Memory") +
|
||||
'<span class="right">' + quotas.str + "</span>" +
|
||||
'</li>';
|
||||
} else {
|
||||
quotas = QuotaWidgets.quotaFloatInfo(0, 0, null, true);
|
||||
|
||||
quotas_html = "";
|
||||
quotas_html += '<li class="provision-bullet-item text-left">' +
|
||||
'<i class="fa fa-fw fa-th"></i> '+ Locale.tr("VMs") +
|
||||
'<span class="right">' + quotas.str + "</span>" +
|
||||
'</li>';
|
||||
|
||||
quotas = QuotaWidgets.quotaFloatInfo(0, 0, null, true);
|
||||
|
||||
quotas_html += '<li class="provision-bullet-item text-left">' +
|
||||
'<i class="fa fa-fw fa-tachometer"></i> '+ Locale.tr("CPU") +
|
||||
'<span class="right">' + quotas.str + "</span>" +
|
||||
'</li>';
|
||||
|
||||
quotas = QuotaWidgets.quotaMBInfo(0, 0, null, true);
|
||||
|
||||
quotas_html += '<li class="provision-bullet-item text-left">' +
|
||||
'<i class="fa fa-fw fa-align-left"></i> '+ Locale.tr("Memory") +
|
||||
'<span class="right">' + quotas.str + "</span>" +
|
||||
'</li>';
|
||||
}
|
||||
|
||||
$(".provision_users_ul", context).append('<li>' +
|
||||
'<ul class="provision-pricing-table" opennebula_id="' + data.ID + '" datatable_index="' + iDisplayIndexFull + '">' +
|
||||
'<li class="provision-title text-left" style="padding-bottom: 10px">' +
|
||||
'<a class="provision_info_user_button" style="color:#555" href="#"><i class="fa fa-fw fa-lg fa-sign-in right only-on-hover"/>' + data.NAME + '</a>' +
|
||||
'</li>' +
|
||||
quotas_html +
|
||||
'</ul>' +
|
||||
'</li>');
|
||||
|
||||
return nRow;
|
||||
}
|
||||
});
|
||||
|
||||
$('.provision_list_users_search', context).on('input',function(){
|
||||
provision_users_datatable.fnFilter($(this).val());
|
||||
})
|
||||
|
||||
context.on("click", ".provision_users_list_refresh_button", function() {
|
||||
OpenNebula.Action.clear_cache("USER");
|
||||
update_provision_users_datatable(provision_users_datatable, 0);
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).foundation();
|
||||
}
|
||||
|
||||
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: Notifier.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("");
|
||||
|
||||
QuotaWidgets.initEmptyQuotas(data);
|
||||
|
||||
if (!$.isEmptyObject(data.VM_QUOTA)) {
|
||||
var default_user_quotas = QuotaDefaults.default_quotas(data.DEFAULT_USER_QUOTAS);
|
||||
vms_quotas = QuotaWidgets.quotaFloatInfo(
|
||||
data.VM_QUOTA.VM.VMS_USED,
|
||||
data.VM_QUOTA.VM.VMS,
|
||||
default_user_quotas.VM_QUOTA.VM.VMS,
|
||||
true);
|
||||
|
||||
cpu_quotas = QuotaWidgets.quotaFloatInfo(
|
||||
data.VM_QUOTA.VM.CPU_USED,
|
||||
data.VM_QUOTA.VM.CPU,
|
||||
default_user_quotas.VM_QUOTA.VM.CPU,
|
||||
true);
|
||||
|
||||
mem_quotas = QuotaWidgets.quotaMBInfo(
|
||||
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('<li class="provision-bullet-item text-left">' +
|
||||
'<div class="large-4 columns">'+
|
||||
'<i class="fa fa-fw fa-th"></i> '+ Locale.tr("VMs") +
|
||||
'<span class="right">' + vms_quotas.str + "</span>" +
|
||||
'</div>'+
|
||||
'<div class="large-4 columns">'+
|
||||
'<i class="fa fa-fw fa-tachometer"></i> '+ Locale.tr("CPU") +
|
||||
'<span class="right">' + cpu_quotas.str + "</span>" +
|
||||
'</div>'+
|
||||
'<div class="large-4 columns">'+
|
||||
'<i class="fa fa-fw fa-align-left"></i> '+ Locale.tr("Memory") +
|
||||
'<span class="right">' + mem_quotas.str + "</span>" +
|
||||
'</div>'+
|
||||
'</li>' +
|
||||
'<li class="provision-bullet-item text-left">' +
|
||||
'<div class="large-4 columns">'+
|
||||
'<div class="progress small radius" style="background: #f7f7f7">' +
|
||||
' <span class="meter" style="width: ' + vms_quotas.percentage + '%;"></span>' +
|
||||
'</div>' +
|
||||
'</div>'+
|
||||
'<div class="large-4 columns">'+
|
||||
'<div class="progress small radius" style="background: #f7f7f7">' +
|
||||
' <span class="meter" style="width: ' + cpu_quotas.percentage + '%;"></span>' +
|
||||
'</div>' +
|
||||
'</div>'+
|
||||
'<div class="large-4 columns">'+
|
||||
'<div class="progress small radius" style="background: #f7f7f7">' +
|
||||
' <span class="meter" style="width: ' + mem_quotas.percentage + '%;"></span>' +
|
||||
'</div>' +
|
||||
'</div>'+
|
||||
'</li>');
|
||||
} else {
|
||||
vms_quotas = QuotaWidgets.quotaFloatInfo(0, 0, null, true);
|
||||
cpu_quotas = QuotaWidgets.quotaFloatInfo(0, 0, null, true);
|
||||
mem_quotas = QuotaWidgets.quotaMBInfo(0, 0, null, true);
|
||||
|
||||
$(".provision-pricing-table_user_info", context).append('<li class="provision-bullet-item text-left">' +
|
||||
'<div class="large-4 columns">'+
|
||||
'<i class="fa fa-fw fa-th"></i> '+ Locale.tr("VMs") +
|
||||
'<span class="right">' + vms_quotas.str + "</span>" +
|
||||
'</div>'+
|
||||
'<div class="large-4 columns">'+
|
||||
'<i class="fa fa-fw fa-tachometer"></i> '+ Locale.tr("CPU") +
|
||||
'<span class="right">' + cpu_quotas.str + "</span>" +
|
||||
'</div>'+
|
||||
'<div class="large-4 columns">'+
|
||||
'<i class="fa fa-fw fa-align-left"></i> '+ Locale.tr("Memory") +
|
||||
'<span class="right">' + mem_quotas.str + "</span>" +
|
||||
'</div>'+
|
||||
'</li>' +
|
||||
'<li class="provision-bullet-item text-left">' +
|
||||
'<div class="large-4 columns">'+
|
||||
'<div class="progress small radius" style="background: #f7f7f7">' +
|
||||
' <span class="meter" style="width: ' + vms_quotas.percentage + '%;"></span>' +
|
||||
'</div>' +
|
||||
'</div>'+
|
||||
'<div class="large-4 columns">'+
|
||||
'<div class="progress small radius" style="background: #f7f7f7">' +
|
||||
' <span class="meter" style="width: ' + cpu_quotas.percentage + '%;"></span>' +
|
||||
'</div>' +
|
||||
'</div>'+
|
||||
'<div class="large-4 columns">'+
|
||||
'<div class="progress small radius" style="background: #f7f7f7">' +
|
||||
' <span class="meter" style="width: ' + mem_quotas.percentage + '%;"></span>' +
|
||||
'</div>' +
|
||||
'</div>'+
|
||||
'</li>');
|
||||
}
|
||||
|
||||
$(".provision-user-resource-header", context).html(
|
||||
'<span class="provision_vdc_user_info_show_vms button medium radius" title="' + Locale.tr("User Virtual Machines") + '" style="margin-right: 10px">' +
|
||||
'<i class="fa fa-th fa-lg"></i>' +
|
||||
'</span>' +
|
||||
'<span class="provision_vdc_user_info_show_templates button medium radius" title="' + Locale.tr("User Saved Templates") + '" style="margin-right: 10px">' +
|
||||
'<i class="fa fa-save fa-lg"></i>' +
|
||||
'</span>' +
|
||||
'<span class="provision_vdc_user_info_show_flows button medium radius" title="' + Locale.tr("User Services") + '" style="margin-right: 10px">' +
|
||||
'<i class="fa fa-cubes fa-lg"></i>' +
|
||||
'</span>' +
|
||||
'<span class="provision_vdc_user_info_show_acct button medium radius" title="' + Locale.tr("User Accounting") + '" style="margin-right: 10px">' +
|
||||
'<i class="fa fa-bar-chart-o fa-lg"></i>' +
|
||||
'</span>' +
|
||||
(Config.isFeatureEnabled("showback") ? '<span class="provision_vdc_user_info_show_showback button medium radius" title="' + Locale.tr("User Showback") + '" style="margin-right: 10px">' +
|
||||
'<i class="fa fa-money fa-lg"></i>' +
|
||||
'</span>' : ''))
|
||||
|
||||
var start_time = Math.floor(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) {
|
||||
Accounting.fillAccounting($(".dashboard_vm_accounting", context), req, response, no_table);
|
||||
},
|
||||
error: Notifier.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('<div class="text-center">' +
|
||||
'<span class="fa-stack fa-5x" style="color: #dfdfdf">' +
|
||||
'<i class="fa fa-cloud fa-stack-2x"></i>' +
|
||||
'<i class="fa fa-spinner fa-spin fa-stack-1x fa-inverse"></i>' +
|
||||
'</span>' +
|
||||
'<br>' +
|
||||
'<br>' +
|
||||
'<span style="font-size: 18px; color: #999">' +
|
||||
'</span>' +
|
||||
'</div>');
|
||||
|
||||
ProvisionVmsList.generate(
|
||||
$(".provision_vdc_info_container", context),
|
||||
{
|
||||
title: $(".provision_info_vdc_user", context).attr("uname") + ' ' + Locale.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('<div class="text-center">' +
|
||||
'<span class="fa-stack fa-5x" style="color: #dfdfdf">' +
|
||||
'<i class="fa fa-cloud fa-stack-2x"></i>' +
|
||||
'<i class="fa fa-spinner fa-spin fa-stack-1x fa-inverse"></i>' +
|
||||
'</span>' +
|
||||
'<br>' +
|
||||
'<br>' +
|
||||
'<span style="font-size: 18px; color: #999">' +
|
||||
'</span>' +
|
||||
'</div>');
|
||||
|
||||
ProvisionTemplatesList.generate(
|
||||
$(".provision_vdc_info_container", context),
|
||||
{
|
||||
title: $(".provision_info_vdc_user", context).attr("uname") + ' ' + Locale.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('<div class="text-center">' +
|
||||
'<span class="fa-stack fa-5x" style="color: #dfdfdf">' +
|
||||
'<i class="fa fa-cloud fa-stack-2x"></i>' +
|
||||
'<i class="fa fa-spinner fa-spin fa-stack-1x fa-inverse"></i>' +
|
||||
'</span>' +
|
||||
'<br>' +
|
||||
'<br>' +
|
||||
'<span style="font-size: 18px; color: #999">' +
|
||||
'</span>' +
|
||||
'</div>');
|
||||
|
||||
ProvisionFlowsList.generate(
|
||||
$(".provision_vdc_info_container", context),
|
||||
{
|
||||
title: $(".provision_info_vdc_user", context).attr("uname") + ' ' + Locale.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("");
|
||||
|
||||
$(".provision_vdc_info_container", context).html(Accounting.html());
|
||||
Accounting.setup(
|
||||
$(".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(
|
||||
'<h2 class="subheader">' +
|
||||
$(".provision_info_vdc_user", context).attr("uname") + ' ' + Locale.tr("Accounting") +
|
||||
'</h2>')
|
||||
})
|
||||
|
||||
if (Config.isFeatureEnabled("showback")) {
|
||||
context.on("click", ".provision_vdc_user_info_show_showback", function() {
|
||||
$(".provision_vdc_info_container", context).html("");
|
||||
|
||||
$(".provision_vdc_info_container", context).html(Showback.html());
|
||||
Showback.setup(
|
||||
$(".provision_vdc_info_container", context),
|
||||
{fixed_user: $(".provision_info_vdc_user", context).attr("opennebula_id"),
|
||||
fixed_group: ""});
|
||||
|
||||
$(".provision_vdc_info_container", context).prepend(
|
||||
'<h2 class="subheader">' +
|
||||
$(".provision_info_vdc_user", context).attr("uname") + ' ' + Locale.tr("Showback") +
|
||||
'</h2>')
|
||||
})
|
||||
};
|
||||
|
||||
context.on("click", ".provision_vdc_user_delete_confirm_button", function() {
|
||||
$(".provision_vdc_user_confirm_action", context).html(
|
||||
'<div data-alert class="alert-box secondary radius">' +
|
||||
'<div class="row">' +
|
||||
'<div class="large-10 large-centered columns">' +
|
||||
'<span style="font-size: 14px; line-height: 20px">' +
|
||||
Locale.tr("Be careful, this action will immediately remove the User from OpenNebula") +
|
||||
'</span>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<br>' +
|
||||
'<div class="row">' +
|
||||
'<div class="large-10 large-centered columns">' +
|
||||
'<a href"#" class="provision_delete_button alert button large-12 large radius">' + Locale.tr("Delete User") + '</a>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<a href="#" class="close" style="top: 20px">×</a>' +
|
||||
'</div>');
|
||||
});
|
||||
|
||||
context.on("click", ".provision_vdc_user_password_confirm_button", function() {
|
||||
$(".provision_vdc_user_confirm_action", context).html(
|
||||
'<div data-alert class="alert-box secondary radius">' +
|
||||
'<div class="row">' +
|
||||
'<div class="large-10 large-centered columns">' +
|
||||
'<input type="password" class="provision_vdc_user_new_password provision-input" placeholder="' + Locale.tr("New Password") + '" style="height: 40px !important; font-size: 16px; padding: 0.5rem !important;"/>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="row">' +
|
||||
'<div class="large-10 large-centered columns">' +
|
||||
'<input type="password" class="provision_vdc_user_new_confirm_password provision-input" placeholder="' + Locale.tr("Confirm Password") + '" style="height: 40px !important; font-size: 16px; padding: 0.5rem !important;"/>' +
|
||||
'<br>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="row">' +
|
||||
'<div class="large-10 large-centered columns">' +
|
||||
'<button href"#" type="submit" class="provision_vdc_user_change_password_button button success large radius large-12 small-12">' + Locale.tr("Update Password") + '</button>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<a href="#" class="close" style="top: 20px">×</a>' +
|
||||
'</div>');
|
||||
|
||||
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) {
|
||||
Notifier.notifyError(Locale.tr("Fill in a new password"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pw !== confirm_password) {
|
||||
Notifier.notifyError(Locale.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) {
|
||||
Notifier.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(
|
||||
'<div data-alert class="alert-box secondary radius">' +
|
||||
TemplateProvisionQuotaWidget() +
|
||||
'<br>' +
|
||||
'<br>' +
|
||||
'<div class="row">' +
|
||||
'<div class="large-10 large-centered columns">' +
|
||||
'<a href"#" class="provision_update_quota_button success large button large-12 radius" style="margin-right: 15px">' + Locale.tr("Update User Quota") + '</a>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<a href="#" class="close" style="top: 20px">×</a>' +
|
||||
'</div>');
|
||||
|
||||
$(".provision_vdc_user_confirm_action", context).foundation('slider', 'reflow');
|
||||
|
||||
ProvisionQuotaWidget.setup(context);
|
||||
|
||||
var quotas_str = $(".provision_info_vdc_user", context).attr("quotas");
|
||||
if (quotas_str) {
|
||||
var quotas = JSON.parse(quotas_str);
|
||||
|
||||
var vms_limit = QuotaLimits.QUOTA_LIMIT_DEFAULT;
|
||||
var cpu_limit = QuotaLimits.QUOTA_LIMIT_DEFAULT;
|
||||
var mem_limit = QuotaLimits.QUOTA_LIMIT_DEFAULT;
|
||||
|
||||
if (quotas.VM != undefined) {
|
||||
vms_limit = quotas.VM.VMS;
|
||||
cpu_limit = quotas.VM.CPU;
|
||||
mem_limit = quotas.VM.MEMORY;
|
||||
|
||||
if (mem_limit != QuotaLimits.QUOTA_LIMIT_UNLIMITED &&
|
||||
mem_limit != QuotaLimits.QUOTA_LIMIT_DEFAULT) {
|
||||
|
||||
mem_limit = quotas.VM.MEMORY / 1024;
|
||||
}
|
||||
}
|
||||
|
||||
var fill_limits = function(limit, select, input) {
|
||||
switch (limit){
|
||||
case QuotaLimits.QUOTA_LIMIT_DEFAULT:
|
||||
select.val('default').change();
|
||||
input.val('').change();
|
||||
break;
|
||||
|
||||
case QuotaLimits.QUOTA_LIMIT_UNLIMITED:
|
||||
select.val('unlimited').change();
|
||||
input.val('').change();
|
||||
break;
|
||||
|
||||
default:
|
||||
select.val('edit').change();
|
||||
input.val(limit).change();
|
||||
}
|
||||
}
|
||||
|
||||
fill_limits(
|
||||
vms_limit,
|
||||
$("div.provision_rvms_quota select.provision_quota_select", context),
|
||||
$(".provision_rvms_quota_input", context));
|
||||
|
||||
fill_limits(
|
||||
cpu_limit,
|
||||
$("div.provision_cpu_quota select.provision_quota_select", context),
|
||||
$(".provision_cpu_quota_input", context));
|
||||
|
||||
fill_limits(
|
||||
mem_limit,
|
||||
$("div.provision_memory_quota select.provision_quota_select", context),
|
||||
$(".provision_memory_quota_tmp_input", context));
|
||||
}
|
||||
});
|
||||
|
||||
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) {
|
||||
Notifier.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");
|
||||
|
||||
quota_json = ProvisionQuotaWidget.retrieve(context);
|
||||
|
||||
OpenNebula.User.set_quota({
|
||||
data : {
|
||||
id: user_id,
|
||||
extra_param: quota_json
|
||||
},
|
||||
success: function(request, response) {
|
||||
update_provision_vdc_user_info(user_id, context);
|
||||
button.removeAttr("disabled");
|
||||
},
|
||||
error: function(request, response) {
|
||||
Notifier.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;
|
||||
});
|
||||
}
|
||||
});
|
@ -1,153 +0,0 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2015, OpenNebula Project, OpenNebula Systems */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
define(function(require) {
|
||||
require('foundation.slider');
|
||||
var QuotaLimits = require('utils/quotas/quota-limits');
|
||||
|
||||
return {
|
||||
'setup': setup_provision_quota_widget,
|
||||
'reset': reset_provision_quota_widget,
|
||||
'retrieve': retrieve_provision_quota_widget
|
||||
}
|
||||
|
||||
function setup_provision_quota_widget(context) {
|
||||
// Mode selector, for the 3 sliders
|
||||
$("select.provision_quota_select", context).on('change', function() {
|
||||
var row = $(this).closest(".row");
|
||||
|
||||
switch ($(this).val()) {
|
||||
case "edit":
|
||||
$("div.provision_quota_edit", row).show();
|
||||
$("div.provision_quota_default", row).hide();
|
||||
$("div.provision_quota_unlimited", row).hide();
|
||||
|
||||
$("input", row).change();
|
||||
|
||||
break;
|
||||
|
||||
case "default":
|
||||
$("div.provision_quota_edit", row).hide();
|
||||
$("div.provision_quota_default", row).show();
|
||||
$("div.provision_quota_unlimited", row).hide();
|
||||
|
||||
break;
|
||||
|
||||
case "unlimited":
|
||||
$("div.provision_quota_edit", row).hide();
|
||||
$("div.provision_quota_default", row).hide();
|
||||
$("div.provision_quota_unlimited", row).show();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
var provision_rvms_quota_input = $(".provision_rvms_quota_input", context);
|
||||
|
||||
$(".provision_rvms_quota_slider", context).on('change.fndtn.slider', function() {
|
||||
provision_rvms_quota_input.val($(this).attr('data-slider'))
|
||||
});
|
||||
|
||||
provision_rvms_quota_input.change(function() {
|
||||
$(".provision_rvms_quota_slider", context).foundation(
|
||||
'slider', 'set_value', this.value);
|
||||
});
|
||||
|
||||
var provision_cpu_quota_input = $(".provision_cpu_quota_input", context);
|
||||
|
||||
$(".provision_cpu_quota_slider", context).on('change.fndtn.slider', function() {
|
||||
provision_cpu_quota_input.val($(this).attr('data-slider'))
|
||||
});
|
||||
|
||||
provision_cpu_quota_input.change(function() {
|
||||
$(".provision_cpu_quota_slider", context).foundation(
|
||||
'slider', 'set_value', this.value);
|
||||
});
|
||||
|
||||
var provision_memory_quota_input = $(".provision_memory_quota_input", context);
|
||||
var provision_memory_quota_tmp_input = $(".provision_memory_quota_tmp_input", context);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
$(".provision_memory_quota_slider", context).on('change.fndtn.slider', function() {
|
||||
provision_memory_quota_tmp_input.val($(this).attr('data-slider'));
|
||||
update_final_memory_input();
|
||||
});
|
||||
|
||||
provision_memory_quota_tmp_input.change(function() {
|
||||
update_final_memory_input();
|
||||
$(".provision_memory_quota_slider", context).foundation(
|
||||
'slider', 'set_value', this.value);
|
||||
});
|
||||
|
||||
$(".provision_rvms_quota_input", context).val('').change();
|
||||
$(".provision_memory_quota_input", context).val('').change();
|
||||
$(".provision_memory_quota_tmp_input", context).val('').change();
|
||||
$(".provision_cpu_quota_input", context).val('').change();
|
||||
}
|
||||
|
||||
function reset_provision_quota_widget(context) {
|
||||
$("select.provision_quota_select", context).val('edit').change();
|
||||
|
||||
$(".provision_rvms_quota_input", context).val('').change();
|
||||
$(".provision_memory_quota_input", context).val('').change();
|
||||
$(".provision_memory_quota_tmp_input", context).val('').change();
|
||||
$(".provision_cpu_quota_input", context).val('').change();
|
||||
}
|
||||
|
||||
function retrieve_provision_quota_widget(context) {
|
||||
var retrieve_quota = function(select, input) {
|
||||
switch (select.val()) {
|
||||
case "edit":
|
||||
return input.val();
|
||||
case "default":
|
||||
return QuotaLimits.QUOTA_LIMIT_DEFAULT;
|
||||
case "unlimited":
|
||||
return QuotaLimits.QUOTA_LIMIT_UNLIMITED;
|
||||
}
|
||||
}
|
||||
|
||||
var vms_limit = retrieve_quota(
|
||||
$(".provision_rvms_quota select.provision_quota_select", context),
|
||||
$(".provision_rvms_quota_input", context));
|
||||
|
||||
var cpu_limit = retrieve_quota(
|
||||
$(".provision_cpu_quota select.provision_quota_select", context),
|
||||
$(".provision_cpu_quota_input", context));
|
||||
|
||||
var mem_limit = retrieve_quota(
|
||||
$(".provision_memory_quota select.provision_quota_select", context),
|
||||
$(".provision_memory_quota_input", context));
|
||||
|
||||
return {
|
||||
"VM" : {
|
||||
"SYSTEM_DISK_SIZE": QuotaLimits.QUOTA_LIMIT_DEFAULT,
|
||||
"VMS": vms_limit,
|
||||
"MEMORY": mem_limit,
|
||||
"CPU": cpu_limit
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
@ -1,130 +0,0 @@
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
{{! Copyright 2002-2015, OpenNebula Project, OpenNebula Systems }}
|
||||
{{! }}
|
||||
{{! 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. }}
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
<div class="row">
|
||||
<div class="large-12 large-centered columns">
|
||||
<h5 class="subheader text-right">
|
||||
<span class="left" style="margin-bottom: 0.5em">{{tr "Running VMs"}}</span>
|
||||
</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row provision_rvms_quota">
|
||||
<div class="medium-3 small-12 columns">
|
||||
<select class="provision_quota_select">
|
||||
<option value="edit">{{tr "Manual"}}</option>
|
||||
<option value="unlimited">{{tr "Unlimited"}}</option>
|
||||
<option value="default">{{tr "Default"}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="medium-9 small-12 columns provision_quota_edit">
|
||||
<div class="row collapse">
|
||||
<div class="small-9 columns">
|
||||
<div class="range-slider radius provision_rvms_quota_slider" data-slider data-options="start: 0; end: 50;">
|
||||
<span class="range-slider-handle"></span>
|
||||
<span class="range-slider-active-segment"></span>
|
||||
<input type="hidden"></div>
|
||||
</div>
|
||||
<div class="large-2 small-2 columns">
|
||||
<input type="text" class="provision-input provision_rvms_quota_input" style="margin-top: -7px; height: 40px !important; font-size: 16px; padding: 0.5rem !important;"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="medium-9 small-12 columns provision_quota_unlimited" style="display:none">
|
||||
<span style="font-size: 18px; color: #999">{{tr "Unlimited. Group quotas will still apply"}}</span>
|
||||
</div>
|
||||
<div class="medium-9 small-12 columns provision_quota_default" style="display:none">
|
||||
<span style="font-size: 18px; color: #999">
|
||||
{{tr "Use the default system quotas set by the cloud adminstrator"}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="large-12 large-centered columns">
|
||||
<h5 class="subheader text-right">
|
||||
<span class="left" style="margin-bottom: 0.5em">{{tr "CPU"}}</span>
|
||||
</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row provision_cpu_quota">
|
||||
<div class="medium-3 small-12 columns">
|
||||
<select class="provision_quota_select">
|
||||
<option value="edit">{{tr "Manual"}}</option>
|
||||
<option value="unlimited">{{tr "Unlimited"}}</option>
|
||||
<option value="default">{{tr "Default"}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="medium-9 small-12 columns provision_quota_edit">
|
||||
<div class="row collapse">
|
||||
<div class="small-9 columns">
|
||||
<div class="range-slider radius provision_cpu_quota_slider" data-slider data-options="start: 0; end: 50;">
|
||||
<span class="range-slider-handle"></span>
|
||||
<span class="range-slider-active-segment"></span>
|
||||
<input type="hidden"></div>
|
||||
</div>
|
||||
<div class="large-2 small-2 columns">
|
||||
<input type="text" class="provision-input provision_cpu_quota_input" style="margin-top: -7px; height: 40px !important; font-size: 16px; padding: 0.5rem !important;"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="medium-9 small-12 columns provision_quota_unlimited" style="display:none">
|
||||
<span style="font-size: 18px; color: #999">{{tr "Unlimited. Group quotas will still apply"}}</span>
|
||||
</div>
|
||||
<div class="medium-9 small-12 columns provision_quota_default" style="display:none">
|
||||
<span style="font-size: 18px; color: #999">
|
||||
{{tr "Use the default system quotas set by the cloud adminstrator"}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="large-12 large-centered columns">
|
||||
<h5 class="subheader text-right">
|
||||
<span class="left" style="margin-bottom: 0.5em">{{tr "Memory (GB)"}}</span>
|
||||
</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vm_param">
|
||||
<input type="hidden" class="provision_memory_quota_input"/>
|
||||
</div>
|
||||
<div class="row provision_memory_quota">
|
||||
<div class="medium-3 small-12 columns">
|
||||
<select class="provision_quota_select">
|
||||
<option value="edit">{{tr "Manual"}}</option>
|
||||
<option value="unlimited">{{tr "Unlimited"}}</option>
|
||||
<option value="default">{{tr "Default"}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="medium-9 small-12 columns provision_quota_edit">
|
||||
<div class="row collapse">
|
||||
<div class="small-9 columns">
|
||||
<div class="range-slider radius provision_memory_quota_slider" data-slider data-options="start: 0; end: 50;">
|
||||
<span class="range-slider-handle"></span>
|
||||
<span class="range-slider-active-segment"></span>
|
||||
<input type="hidden"></div>
|
||||
</div>
|
||||
<div class="large-2 small-2 columns">
|
||||
<input type="text" class="provision-input provision_memory_quota_tmp_input" style="margin-top: -7px; height: 40px !important; font-size: 16px; padding: 0.5rem !important;"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="medium-9 small-12 columns provision_quota_unlimited" style="display:none">
|
||||
<span style="font-size: 18px; color: #999">{{tr "Unlimited. Group quotas will still apply"}}</span>
|
||||
</div>
|
||||
<div class="medium-9 small-12 columns provision_quota_default" style="display:none">
|
||||
<span style="font-size: 18px; color: #999">
|
||||
{{tr "Use the default system quotas set by the cloud adminstrator"}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
Loading…
x
Reference in New Issue
Block a user