Add invitation check; dialog for pending invites; misc. fixes

This commit is contained in:
bfederle 2012-02-06 16:50:08 -08:00
parent 99fe55e385
commit 995589b479
4 changed files with 73 additions and 10 deletions

View File

@ -2769,6 +2769,22 @@ Dialogs*/
text-shadow: 0px 1px 1px #FFFFFF;
}
.ui-dialog span.message ul {
margin-left: 30px;
margin-top: 14px;
text-align: left;
list-style: disc;
}
.ui-dialog span.message ul li {
margin-top: 3px;
}
.ui-dialog span.message p {
text-align: left;
margin-top: 20px;
}
.ui-dialog-titlebar {
background: #4C5F70 url(../images/bg-dialog-header.png);
color: #FFFFFF;
@ -7859,6 +7875,20 @@ div.panel.ui-dialog div.list-view div.fixed-header {
text-align: left;
}
.ui-dialog .new-project .add-by {
font-size: 12px;
color: #5E6D7D;
margin-left: 11px;
}
.ui-dialog .new-project .add-by input {
margin-right: 8px;
}
.ui-dialog .new-project .add-by label {
margin-right: 12px;
}
.new-project .title {
color: #3497E6;
font-size: 26px;
@ -7885,6 +7915,7 @@ div.panel.ui-dialog div.list-view div.fixed-header {
#new-project-review-tabs-resouces {
background: #D2D2D2;
height: 225px;
}
.new-project .resources .ui-widget-content {
@ -8057,10 +8088,10 @@ div.panel.ui-dialog div.list-view div.fixed-header {
.new-project .review .ui-tabs ul {
text-align: left;
/*+placement:shift -233px 1px;*/
/*+placement:shift 0px -2px;*/
position: relative;
left: -233px;
top: 1px;
left: 0px;
top: -2px;
}
.new-project .review .ui-tabs .list-view {

View File

@ -4,6 +4,19 @@
return g_capabilities.projectinviterequired;
},
invitationCheck: function(args) {
$.ajax({
url: createURL('listProjectInvitations'),
data: { state: 'Pending' },
success: function(json) {
args.response.success({
data: json.listprojectinvitationsresponse.projectinvitation ?
json.listprojectinvitationsresponse.projectinvitation : []
});
}
});
},
resourceManagement: {
update: function(args, projectID) {
var totalResources = 5;
@ -292,10 +305,6 @@
cloudStack.dialog.notice({
message: 'Invitation sent to ' + args.data.email
});
} else {
cloudStack.dialog.notice({
message: 'Pending invitation added for account ' + args.data.account
});
}
}
},

View File

@ -380,7 +380,10 @@
.append(
// Users tab
$('<li>').addClass('first').append(
$('<a>').attr({ href: '#new-project-review-tabs-users'}).html('Accounts')
$('<a>').attr({ href: '#new-project-review-tabs-users'}).html(
cloudStack.projects.requireInvitation() ?
'Invitations' : 'Accounts'
)
)
);
@ -413,7 +416,7 @@
fields: !cloudStack.projects.requireInvitation() ? {
username: { label: 'Account' }
} : {
email: { label: 'E-mail invite'}
account: { label: 'Invited Accounts'}
},
actions: !cloudStack.projects.requireInvitation() ? {
destroy: {
@ -449,7 +452,7 @@
return !cloudStack.projects.requireInvitation() ? {
username: $(elem).find('td.username span').html()
} : {
email: $(elem).find('td.email span').html()
account: $(elem).find('td.account span').html()
};
})
});

View File

@ -269,6 +269,26 @@
// Validation
$.extend($.validator.messages, { required: 'Required field' });
// Check for pending project invitations
cloudStack.projects.invitationCheck({
context: cloudStack.context,
response: {
success: function(args) {
if (!args.data.length) return;
var projectList = $.map(args.data, function(invitation) {
return '<li>' + invitation.project + '</li>';
}).join('');
cloudStack.dialog.notice({
message: 'You have pending project invitations for:' +
'<ul>' + projectList + '</ul>' +
'<p>To view, please go to the projects section, then select invitations from the drop-down.</p>'
});
}
}
});
return this;
};