Integrate resources form into project detail view

This commit is contained in:
bfederle 2012-02-06 13:03:56 -08:00
parent ce7656674c
commit 8326989410
3 changed files with 40 additions and 9 deletions

View File

@ -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;

View File

@ -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 $('<div>').addClass('project-dashboard').append($resources);
}
}
}
}

View File

@ -1,5 +1,5 @@
(function(cloudStack, $) {
var pageElems = {
var pageElems = cloudStack.uiCustom.projectsTabs = {
/**
* User management multi-edit
*/
@ -87,7 +87,9 @@
return $('<div>').addClass('management-invite').data('tab-title', 'Invitations');
},
resources: function() {
resources: function(options) {
if (!options) options = {};
var $resources = $('<div>').addClass('resources').data('tab-title', 'Resources');
var $form = $('<form>');
var $submit = $('<input>').attr({
@ -136,7 +138,7 @@
});
}
}
});
}, options.projectID);
return false;
});
@ -145,7 +147,7 @@
$form.appendTo($resources);
}
}
});
}, options.projectID);
return $resources;
}