Commit 285c642c by Your Name

transfer ownerhip UI fix

parent 38777397
......@@ -528,6 +528,11 @@ if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE':
SAML_MAIN_ATTRIBUTE_MAX_LENGTH = int(get_env_variable(
"DJANGO_SAML_MAIN_ATTRIBUTE_MAX_LENGTH", 0))
SAML_LOGOUT_REQUESTS_SIGNED = True
SAML_LOGOUT_RESPONSES_SIGNED = True
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
LOGIN_REDIRECT_URL = "/"
AGENT_DIR = get_env_variable(
......
......@@ -27,83 +27,129 @@ $(function() {
return false;
});
/* operations */
$('#ops, #vm-details-resources-disk, #vm-details-renew-op, #vm-details-pw-reset, #vm-details-add-interface, .operation-wrapper').on('click', '.operation', function(e) {
var icon = $(this).children("i").addClass('fa-spinner fa-spin');
$.ajax({
type: 'GET',
url: $(this).attr('href'),
success: function(data) {
icon.removeClass("fa-spinner fa-spin");
$('body').append(data);
$('#confirmation-modal').modal('show');
$('#confirmation-modal').on('hidden.bs.modal', function() {
$('#confirmation-modal').remove();
});
$('#vm-migrate-node-list li input:checked').closest('li').addClass('panel-primary');
}
function initAutocompleteSelect2($root) {
$root.find('select[data-autocomplete-light-function="select2"]').each(function () {
var $el = $(this);
// már initelve?
if ($el.hasClass('select2-hidden-accessible')) return;
var url = $el.data('autocomplete-light-url');
var placeholder = $el.data('placeholder') || '';
$el.select2({
dropdownParent: $root, // bootstrap modal fókusz miatt
width: 'resolve',
placeholder: placeholder,
allowClear: true,
ajax: {
url: url,
dataType: 'json',
delay: 250,
data: function (params) {
return { q: params.term, page: params.page || 1 };
},
processResults: function (data) {
// DAL autocomplete view tipikusan már {results: [...], pagination: {more: ...}}
return data;
}
},
// data-html="true" miatt: hagyjuk az HTML-t renderelődni
escapeMarkup: function (m) { return m; }
});
});
e.preventDefault();
});
}
function showConfirmationModal(data) {
// ha valamiért bent maradt egy régi modal, takarítsuk (örökölt kódnál előfordul)
$('#confirmation-modal').remove();
$('body').append(data);
var $modal = $('#confirmation-modal');
$modal.modal('show');
initAutocompleteSelect2($modal);
// egyszer fusson csak
$modal.one('hidden.bs.modal', function () {
$modal.remove();
});
return $modal;
}
/* operations */
$('#ops, #vm-details-resources-disk, #vm-details-renew-op, #vm-details-pw-reset, #vm-details-add-interface, .operation-wrapper')
.on('click', '.operation', function (e) {
e.preventDefault();
var $icon = $(this).children("i").addClass('fa-spinner fa-spin');
$.ajax({
type: 'GET',
url: $(this).attr('href'),
success: function (data) {
$icon.removeClass("fa-spinner fa-spin");
var $modal = showConfirmationModal(data);
// megmaradt a korábbi, specifikus UI tweak
$modal.find('#vm-migrate-node-list li input:checked').closest('li').addClass('panel-primary');
},
error: function () {
$icon.removeClass("fa-spinner fa-spin");
}
});
});
/* if the operation fails show the modal again */
$("body").on("click", "#confirmation-modal #op-form-send", function() {
var url = $(this).closest("form").prop("action");
$("body").on("submit", "#confirmation-modal form", function (e) {
e.preventDefault()
var $form = $(this);
var url = $form.attr("action");
$.ajax({
url: url,
headers: {"X-CSRFToken": getCookie('csrftoken')},
headers: { "X-CSRFToken": getCookie('csrftoken') },
type: 'POST',
data: $(this).closest('form').serialize(),
success: function(data, textStatus, xhr) {
/* hide the modal we just submitted */
data: $form.serialize(),
success: function (data) {
// mindig zárjuk le az aktuális modalt
$('#confirmation-modal').modal("hide");
/* if it was successful trigger a click event on activity, this will
* - go to that tab
* - starts refreshing the activity
*/
if(data.success) {
if (data.success) {
$('a[href="#activity"]').trigger("click");
if(data.with_reload) {
// when the activity check stops the page will reload
if (data.with_reload) {
reload_vm_detail = true;
}
/* if there are messages display them */
if(data.messages && data.messages.length > 0) {
if (data.messages && data.messages.length > 0) {
addMessage(data.messages.join("<br />"), data.success ? "success" : "danger");
}
}
else {
/* if the post was not successful wait for the modal to disappear
* then append the new modal
*/
$('#confirmation-modal').on('hidden.bs.modal', function() {
$('body').append(data);
$('#confirmation-modal').modal('show');
$('#confirmation-modal').on('hidden.bs.modal', function() {
$('#confirmation-modal').remove();
});
} else {
// a bezárás után nyissuk meg az új (hibás) modalt
$('#confirmation-modal').one('hidden.bs.modal', function () {
showConfirmationModal(data);
});
}
},
error: function(xhr, textStatus, error) {
error: function (xhr) {
$('#confirmation-modal').modal("hide");
if (xhr.status == 500) {
if (xhr.status === 500) {
addMessage("500 Internal Server Error", "danger");
} else {
addMessage(xhr.status + " Unknown Error", "danger");
}
}
});
return false;
});
function decideActivityRefresh() {
var check = false;
/* if something is still spinning */
......
......@@ -29,6 +29,39 @@ $(function () {
return false;
});
function initAutocompleteSelect2($root) {
$root.find('select[data-autocomplete-light-function="select2"]').each(function () {
var $el = $(this);
// már initelve?
if ($el.hasClass('select2-hidden-accessible')) return;
var url = $el.data('autocomplete-light-url');
var placeholder = $el.data('placeholder') || '';
$el.select2({
dropdownParent: $root, // bootstrap modal fókusz miatt
width: 'resolve',
placeholder: placeholder,
allowClear: true,
ajax: {
url: url,
dataType: 'json',
delay: 250,
data: function (params) {
return { q: params.term, page: params.page || 1 };
},
processResults: function (data) {
// DAL autocomplete view tipikusan már {results: [...], pagination: {more: ...}}
return data;
}
},
// data-html="true" miatt: hagyjuk az HTML-t renderelődni
escapeMarkup: function (m) { return m; }
});
});
}
$('.group-create, .group-import, .group-export, .node-create, .tx-tpl-ownership, .group-delete, .node-delete, .disk-remove, .template-delete, .delete-from-group, .group-remove-all-btn, .lease-delete').click(function(e) {
$.ajax({
type: 'GET',
......@@ -37,6 +70,7 @@ $(function () {
$('body').append(data);
var modal = $('#confirmation-modal');
modal.modal('show');
initAutocompleteSelect2(modal);
modal.on('hidden.bs.modal', function() {
modal.remove();
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment