Commit 66a20909 authored by Bruno Soares's avatar Bruno Soares
Browse files

- Changing redirect on slice creation to the created slice detail page

- Changed buttons of next,prev and setup on slice creation page
- Changed confirmation emails to be sent to ROOT and ADMINS
- Removed the reservation cancell when the reservation is active
parent 9250f787
......@@ -63,18 +63,31 @@ $(document).ready(function() {
prevButton.removeAttr('disabled');
prevButton.html("Back to '<b><span></span></b>'");
prevButton.find('span').html(prev.text());
prevButton.css('border-radius', '4px');
prevButton.show();
} else {
prevButton.attr('disabled', 'disabled');
prevButton.html('Back');
prevButton.removeAttr('style');
prevButton.hide();
}
if(next !== false) {
nextButton.removeAttr('disabled');
nextButton.html("Next to '<b><span></span></b>'");
nextButton.find('span').html(next.text());
nextButton.css('border-radius', '4px');
nextButton.show();
} else {
nextButton.attr('disabled', 'disabled');
nextButton.html('Next');
nextButton.removeAttr('style');
nextButton.hide();
}
if(next && prev) {
prevButton.removeAttr('style');
nextButton.removeAttr('style');
}
// load page
......@@ -110,7 +123,7 @@ $(document).ready(function() {
}
var li = $('.reservation-breadcrumb li');
if(page === li.length - 1) {
//getReservedResources();
//getReservedResources();
updateSummary();
}
}
......@@ -212,7 +225,7 @@ function addVm(vm) {
model.find("select[name='vm.hypervisor']").val(vm.hypervisor).trigger('change');
setTimeout(function() {model.find("select[name='vm.image']").val(vm.image);}, 100);
}
model.find('span[data-vm-id]').html(vmsCount);
model.find('button.close').click(function() {
$(this).parent().parent().remove();
......@@ -285,7 +298,7 @@ function getReservedResources() {
}
var nodeName = $($(node).parent().parent().find('#node_name')).html();
var nodeDomain = $($(node).parent().parent().find('#node_domain')).html();
var nodeUrn = $($(node).parent().parent().find('#node_urn')).html();
var nodeUrn = $($(node).parent().parent().find('#node_urn')).html();
var wnode={
'urn': nodeUrn,
'name': nodeName,
......@@ -506,21 +519,21 @@ var schedules=[];
function updateSummary() {
var resources=getReservedResources();
//vm resources
var vmres="";
resources.reservedResources.filter(function(res){return res.type==="hypervisor"}).forEach(function(res) {
vmres+="<tr><td>"+res.name+"</td><td>"+res.image_name+"</td><td>"+res.ram_name+"</td><td>"+res.urn+"</td></tr>";
});
$("#vm_summary").html(vmres);
//node resources
var noderes="";
resources.reservedResources.filter(function(res){return res.type==="node"}).forEach(function(res) {
noderes+="<tr><td>"+res.domain+"</td><td>"+res.name+"</td></tr>";
});
$("#node_summary").html(noderes);
// //network resources
// var netres="";
// resources.reservedResources.filter(function(res){return res.type==="network"}).forEach(function(res) {
......
......@@ -102,6 +102,12 @@ $(document).ready(function() {
});
}
},
eventResize: function(event, delta, revertFunc) {
update_schedules();
},
eventDrop: function(event, delta, revertFunc) {
update_schedules();
},
events: [
createBgElapsedTimeEvnt()
]
......
......@@ -259,6 +259,7 @@ $(document).ready(function() {
console.log('Checking if experiment tab needs to be enabled/disabled');
reservationTBody.empty();
var hasActiveExperiment = false;
data.leases = data.leases.sort(function(a,b) { return a.valid_from - b.valid_from;});
data.leases.forEach(function(lease) {
var actualTime = parseInt(new Date().getTime()/1000);
var status = (lease.valid_from <= actualTime && actualTime <= lease.valid_until)
......@@ -311,15 +312,20 @@ $(document).ready(function() {
'<td>' + formatDate(lease.valid_until) + '</td>' +
'<td>' + leasesCompCount + '</td>' +
'<td>' + statusLbl + '</td>' +
'<td>' +
"<a href='" + deleteLink + "' class='btn btn-danger btn-sm loading delete-slice' " +
'<td>';
if(status != 'active') {
leaseElem += "<a href='" + deleteLink + "' class='btn btn-danger btn-sm loading delete-slice' " +
"data-loading-text='<i class=\"fa fa-spinner fa-spin\"></i> Deleting...'>" +
'<input type="hidden" name="delete_slice_btn">' +
'<span class="glyphicon glyphicon-trash"></span>' +
'Delete' +
'</a>' +
'</td>' +
"</tr>" + leaseElem;
' Remove' +
'</a>';
}
leaseElem += '</td>' +
"</tr>" + leaseElem;
reservationTBody.append(leaseElem);
});
......
......@@ -43,15 +43,16 @@
$( document ).ready(function() {
var target = document.getElementById('review_reservation');
$("#create_reservation_btn").hide();
// create an observer instance
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if($('#review_reservation').is(":visible")) {
$("#create_reservation_btn").prop('disabled', false);
$("#create_reservation_btn").prop('disabled', false).show();
}
else {
$("#create_reservation_btn").prop('disabled', true);
$("#create_reservation_btn").prop('disabled', true).hide();
}
});
});
......@@ -336,16 +337,16 @@
</div>
</div>
<div class="panel-footer">
<div class="row" style="margin: 10px;">
<div id="page-controls" class="col-sm-6">
<div class="row" style="margin: 10px 0;">
<div id="page-controls" class="col-sm-6" style="padding-left: 0;">
<div class="btn-group">
<button type="button" class="btn btn-default" disabled="disabled" data-page-action="prev"></button>
<button type="button" class="btn btn-default" data-page-action="next"></button>
</div>
</div>
<div class="col-sm-6 text-right">
<button type="submit" class="btn btn-primary" disabled="disabled" id="create_reservation_btn">{% trans "Setup slice" %}</button>
<a class="btn btn-default loading" href="{% url 'portal:detail_project' project_urn=project_urn%}" data-loading-text="<i class='fa fa-spinner fa-spin '></i> Cancel">{% trans "Cancel" %}</a>
<div class="col-sm-6 text-right" style="padding-right: 0;">
<button type="submit" class="btn btn-success loading" disabled="disabled" id="create_reservation_btn" data-loading-text="<i class='fa fa-spinner fa-spin '></i> Creating slice...">{% trans "Create slice" %}</button>
<a class="btn btn-danger loading" href="{% url 'portal:detail_project' project_urn=project_urn%}" data-loading-text="<i class='fa fa-spinner fa-spin '></i> Cancelling creation...">{% trans "Cancel creation" %}</a>
</div>
</div>
</div>
......
......@@ -18,6 +18,7 @@ from portal.models.portal import Portal
from portal.models.member import Member
import threading
from portal_config.settings import TEST_AUTH_ENABLE
# #############################################
# ################ Main Methods ###############
......@@ -100,8 +101,15 @@ def fibre_idp_authentication(request):
# Check if given email exists in CH.
email_check = Portal.check_identifier(const.CH_MEMBER_EMAIL_ADDRESS, email)
print (email_check)
print (eppn)
# Bypass auth (test only)
if TEST_AUTH_ENABLE:
request_email = request.GET.get('email')
allowed_emails = ['brunosoares.inf@gmail.com', 'g.ndias@gmail.com', 'gustavo.dias@rnp.br',
'daniel.marques@rnp.br', 'inf.araujo@gmail.com', 'vinicius.esufg@gmail.com']
if request_email is not None and request_email in allowed_emails:
eppn = '8902689e17dca5f25352360f68a55f96@rnp.br'
email = request_email
validade_old = False
# Add old fibre user on the clearing house
if (eppn) and (not email_check):
......
......@@ -45,7 +45,7 @@ def delete_reservation(request, slice_urn, lease_name, slice):
Reservation.delete_reservation(slice_credential, lease_name)
return redirect('portal:detail_slice', slice_urn)
return redirect(reverse('portal:detail_slice', kwargs={'slice_urn':slice_urn}) + '?tab=reservations')
def build_reservation_oedl(lease, slice):
......
......@@ -432,7 +432,7 @@ def get_admins_mail(request):
# Retrieve members with admin privilege.
operation = Member().retrieve_member_privileges(
credential=request.session['member_cred'],
privileges=[2])
privileges=[2, 3])
# If success.
if operation['operation_status'] == 'success':
......
......@@ -120,7 +120,8 @@ def create_slice(request, project_urn, project):
if success == 200:
# Redirect to detail project template.
messages.success(request, _('Your slice was successfully created!'))
return redirect(reverse('portal:detail_project', kwargs={'project_urn':project_urn}) + '?tab=slices')
return redirect('portal:detail_slice', slice_urn)
# return redirect(reverse('portal:detail_project', kwargs={'project_urn':project_urn}) + '?tab=slices')
else:
if Slice().delete_slice(request.session['member_cred'], slice_urn):
logging.info("Slice removed from CH")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment