From 8326989410e29c189dc4c231035f6ea18465cb30 Mon Sep 17 00:00:00 2001 From: bfederle Date: Mon, 6 Feb 2012 13:03:56 -0800 Subject: [PATCH] Integrate resources form into project detail view --- ui/css/cloudstack3.css | 9 +++++++++ ui/scripts/projects.js | 30 +++++++++++++++++++++++++----- ui/scripts/ui-custom/projects.js | 10 ++++++---- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index 50d1ece16ee..9b24892c716 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -7512,6 +7512,15 @@ div.panel.ui-dialog div.list-view div.fixed-header { clear: both; } +.detail-view .project-dashboard .resources form { + width: 83%; + border-bottom: 1px solid #DBDBDB; +} + +.detail-view .project-dashboard .resources form .field input { + margin-right: 105px; +} + /*** Dashboard*/ .project-dashboard .toolbar { position: relative; diff --git a/ui/scripts/projects.js b/ui/scripts/projects.js index adb40b51c96..6c3315ea26b 100644 --- a/ui/scripts/projects.js +++ b/ui/scripts/projects.js @@ -5,13 +5,17 @@ }, resourceManagement: { - update: function(args) { + update: function(args, projectID) { var totalResources = 5; var updatedResources = 0; + + projectID = projectID ? projectID : cloudStack.context.projects[0].id; + $.each(args.data, function(key, value) { $.ajax({ - url: createURL('updateResourceLimit'), + url: createURL('updateResourceLimit', { ignoreProject: true }), data: { + projectid: projectID, resourcetype: key, max: args.data[key] }, @@ -25,9 +29,14 @@ }); }, - dataProvider: function(args) { + dataProvider: function(args, projectID) { + projectID = projectID ? projectID : cloudStack.context.projects[0].id; + $.ajax({ - url: createURL('listResourceLimits'), + url: createURL('listResourceLimits', { ignoreProject: true }), + data: { + projectid: projectID + }, success: function(json) { args.response.success({ data: $.map( @@ -70,7 +79,6 @@ }); } }); - } }, @@ -778,6 +786,18 @@ } }); } + }, + + resources: { + title: 'Resources', + custom: function(args) { + var $resources = cloudStack.uiCustom + .projectsTabs.dashboardTabs.resources({ + projectID: args.context.projects[0].id + }); + + return $('
').addClass('project-dashboard').append($resources); + } } } } diff --git a/ui/scripts/ui-custom/projects.js b/ui/scripts/ui-custom/projects.js index 7d1121be39a..269b6f7717c 100644 --- a/ui/scripts/ui-custom/projects.js +++ b/ui/scripts/ui-custom/projects.js @@ -1,5 +1,5 @@ (function(cloudStack, $) { - var pageElems = { + var pageElems = cloudStack.uiCustom.projectsTabs = { /** * User management multi-edit */ @@ -87,7 +87,9 @@ return $('
').addClass('management-invite').data('tab-title', 'Invitations'); }, - resources: function() { + resources: function(options) { + if (!options) options = {}; + var $resources = $('
').addClass('resources').data('tab-title', 'Resources'); var $form = $('
'); var $submit = $('').attr({ @@ -136,7 +138,7 @@ }); } } - }); + }, options.projectID); return false; }); @@ -145,7 +147,7 @@ $form.appendTo($resources); } } - }); + }, options.projectID); return $resources; }