');
- });
-
- context.on("click", ".provision_delete_template_button", function(){
- var button = $(this);
- button.attr("disabled", "disabled");
-
- var template_id = $(this).attr("template_id");
- var image_id = $(this).attr("image_id");
-
- OpenNebula.Image.del({
- timeout: true,
- data : {
- id : image_id
- },
- success: function (){
- OpenNebula.Template.del({
- timeout: true,
- data : {
- id : template_id
- },
- success: function (){
- $(".provision_templates_list_refresh_button", context).trigger("click");
- },
- error: function (request,error_json, container) {
- Notifier.onError(request, error_json, container);
- }
- })
- },
- error: function (request,error_json, container) {
- if (error_json.error.http_status=="404") {
- OpenNebula.Template.del({
- timeout: true,
- data : {
- id : template_id
- },
- success: function (){
- $(".provision_templates_list_refresh_button", context).trigger("click");
- },
- error: function (request,error_json, container) {
- Notifier.onError(request, error_json, container);
- $(".provision_templates_list_refresh_button", context).trigger("click");
- }
- })
- } else {
- Notifier.onError(request, error_json, container);
- }
- }
- })
- });
- }
-
-
- if (Config.isTabActionEnabled("provision-tab", "Template.chmod")) {
- context.on("click", ".provision_confirm_chmod_template_button", function(){
- var ul_context = $(this).parents(".provision-pricing-table");
- var template_id = ul_context.attr("opennebula_id");
- var image_id = ul_context.attr("saved_to_image_id");
- var template_name = $(".provision-title", ul_context).text();
-
- $(".provision_confirm_delete_template_div", context).html(
- '
'+
- '
'+
- '
'+
- ''+
- Locale.tr("The template")+
- ' "' + template_name + '" ' +
- Locale.tr("and the image associated will be shared and all the users will be able to instantiate new VMs using this template.") +
- ''+
- '
');
- });
-
- context.on("click", ".provision_chmod_template_button", function(){
- var button = $(this);
- button.attr("disabled", "disabled");
-
- var template_id = $(this).attr("template_id");
- var image_id = $(this).attr("image_id");
-
- OpenNebula.Template.chmod({
- timeout: true,
- data : {
- id : template_id,
- extra_param: {'group_u': 1}
- },
- success: function (){
- $(".provision_templates_list_refresh_button", context).trigger("click");
-
- OpenNebula.Image.chmod({
- timeout: true,
- data : {
- id : image_id,
- extra_param: {'group_u': 1}
- },
- success: function (){
- },
- error: Notifier.onError
- })
- },
- error: Notifier.onError
- })
- });
-
- context.on("click", ".provision_confirm_unshare_template_button", function(){
- var ul_context = $(this).parents(".provision-pricing-table");
- var template_id = ul_context.attr("opennebula_id");
- var image_id = ul_context.attr("saved_to_image_id");
- var template_name = $(".provision-title", ul_context).first().text();
-
- $(".provision_confirm_delete_template_div", context).html(
- '
'+
- '
'+
- '
'+
- ''+
- Locale.tr("The template")+
- ' "' + template_name + '" ' +
- Locale.tr("and the image associated will be unshared and the users will not be able to instantiate new VMs using this template.") +
- ''+
- '
');
+ });
+
+ context.on("click", ".provision_delete_template_button", function(){
+ /* TODO SAVED_TO_IMAGE_ID does not exists anymore and now all the images of the template
+ are cloned instead of only the main disk, therefore all the images should be deleted now.
+ Probably this could be done in the core
+
+ var button = $(this);
+ button.attr("disabled", "disabled");
+
+ var template_id = $(this).attr("template_id");
+ var image_id = $(this).attr("image_id");
+
+ OpenNebula.Image.del({
+ timeout: true,
+ data : {
+ id : image_id
+ },
+ success: function (){
+ OpenNebula.Template.del({
+ timeout: true,
+ data : {
+ id : template_id
+ },
+ success: function (){
+ $(".provision_templates_list_refresh_button", context).trigger("click");
+ },
+ error: function (request,error_json, container) {
+ Notifier.onError(request, error_json, container);
+ }
+ })
+ },
+ error: function (request,error_json, container) {
+ if (error_json.error.http_status=="404") {
+ OpenNebula.Template.del({
+ timeout: true,
+ data : {
+ id : template_id
+ },
+ success: function (){
+ $(".provision_templates_list_refresh_button", context).trigger("click");
+ },
+ error: function (request,error_json, container) {
+ Notifier.onError(request, error_json, container);
+ $(".provision_templates_list_refresh_button", context).trigger("click");
+ }
+ })
+ } else {
+ Notifier.onError(request, error_json, container);
+ }
+ }
+ })*/
+ });
+ }
+
+
+ if (Config.isTabActionEnabled("provision-tab", "Template.chmod")) {
+ context.on("click", ".provision_confirm_chmod_template_button", function(){
+ var ul_context = $(this).parents(".provision-pricing-table");
+ var template_id = ul_context.attr("opennebula_id");
+ var image_id = ul_context.attr("saved_to_image_id");
+ var template_name = $(".provision-title", ul_context).text();
+
+ $(".provision_confirm_delete_template_div", context).html(
+ '
'+
+ '
'+
+ '
'+
+ ''+
+ Locale.tr("The template")+
+ ' "' + template_name + '" ' +
+ Locale.tr("and the image associated will be shared and all the users will be able to instantiate new VMs using this template.") +
+ ''+
+ '
');
+ });
+
+ context.on("click", ".provision_chmod_template_button", function(){
+ /* TODO SAVED_TO_IMAGE_ID does not exists anymore and now all the images of the template
+ are cloned instead of only the main disk, therefore all the images should be chmod now.
+ Probably this could be done in the core
+ var button = $(this);
+ button.attr("disabled", "disabled");
+
+ var template_id = $(this).attr("template_id");
+ var image_id = $(this).attr("image_id");
+
+ OpenNebula.Template.chmod({
+ timeout: true,
+ data : {
+ id : template_id,
+ extra_param: {'group_u': 1}
+ },
+ success: function (){
+ $(".provision_templates_list_refresh_button", context).trigger("click");
+
+ OpenNebula.Image.chmod({
+ timeout: true,
+ data : {
+ id : image_id,
+ extra_param: {'group_u': 1}
+ },
+ success: function (){
+ },
+ error: Notifier.onError
+ })
+ },
+ error: Notifier.onError
+ })*/
+ });
+
+ context.on("click", ".provision_confirm_unshare_template_button", function(){
+ var ul_context = $(this).parents(".provision-pricing-table");
+ var template_id = ul_context.attr("opennebula_id");
+ var image_id = ul_context.attr("saved_to_image_id");
+ var template_name = $(".provision-title", ul_context).first().text();
+
+ $(".provision_confirm_delete_template_div", context).html(
+ '
'+
+ '
'+
+ '
'+
+ ''+
+ Locale.tr("The template")+
+ ' "' + template_name + '" ' +
+ Locale.tr("and the image associated will be unshared and the users will not be able to instantiate new VMs using this template.") +
+ ''+
+ '
\ No newline at end of file
diff --git a/src/sunstone/public/app/tabs/provision-tab/users/list.js b/src/sunstone/public/app/tabs/provision-tab/users/list.js
index babaa2fc21..3a68d2e7eb 100644
--- a/src/sunstone/public/app/tabs/provision-tab/users/list.js
+++ b/src/sunstone/public/app/tabs/provision-tab/users/list.js
@@ -1,4 +1,5 @@
define(function(require) {
+ require('foundation.alert');
var OpenNebula = require('opennebula');
var Locale = require('utils/locale');
var Config = require('sunstone-config');
@@ -11,6 +12,8 @@ define(function(require) {
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');
@@ -121,120 +124,67 @@ define(function(require) {
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;
+ QuotaWidgets.initEmptyQuotas(data);
- if (q != undefined) {
- var quota = q.QUOTAS;
-
- if ($.isEmptyObject(quota.VM_QUOTA)) {
- var limit = (data.ID != 0 ? QuotaLimits.QUOTA_LIMIT_DEFAULT : QuotaLimits.QUOTA_LIMIT_UNLIMITED);
-
- quota.VM_QUOTA = {
- VM: {
- VMS : limit,
- VMS_USED : 0,
- CPU : limit,
- CPU_USED : 0,
- MEMORY : limit,
- MEMORY_USED : 0
- }
- }
- }
-
- if (!$.isEmptyObject(quota.VM_QUOTA)) {
- var default_user_quotas = QuotaDefaults.getDefaultUserQuotas();
+ if (!$.isEmptyObject(data.VM_QUOTA)) {
+ var default_user_quotas = QuotaDefaults.getDefaultUserQuotas();
- quotas = QuotaWidgets.quotaFloatInfo(
- quota.VM_QUOTA.VM.VMS_USED,
- quota.VM_QUOTA.VM.VMS,
- default_user_quotas.VM_QUOTA.VM.VMS,
- true);
+ 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 += '