Commit bdb49d44 by Karsa Zoltán István

bugfix

parent 8a65e8d0
var Websock_native; // not sure var Websock_native; // not sure
$(function() { $(function() {
if ($("#ace-meta-data").length && $("#ace-user-data").length) {
var meta_data = ace.edit('ace-meta-data', { var meta_data = ace.edit('ace-meta-data', {
mode: "ace/mode/yaml", useWorker: false, mode: "ace/mode/yaml", useWorker: false,
selectionStyle: "text" }); selectionStyle: "text" });
var textarea_meta = $('textarea[name="ci_meta_data"]'); var textarea_meta = $('textarea[name="ci_meta_data"]');
meta_data.getSession().setValue(textarea_meta.val()) meta_data.getSession().setValue(textarea_meta.val())
meta_data.getSession().on("change", function () { meta_data.getSession().on("change", function () {
textarea_meta.val(meta_data.getSession().getValue()); textarea_meta.val(meta_data.getSession().getValue());
});
var user_data = ace.edit('ace-user-data', {
mode: "ace/mode/yaml", useWorker: false,
selectionStyle: "text" });
var textarea_user = $('textarea[name="ci_user_data"]');
user_data.getSession().setValue(textarea_user.val())
user_data.getSession().on("change", function () {
textarea_user.val(user_data.getSession().getValue());
});
meta_data.session.setTabSize(4);
meta_data.session.setUseSoftTabs(true);
user_data.session.setTabSize(4);
user_data.session.setUseSoftTabs(true);
document.getElementById('ace-meta-data').style.fontSize='14px';
document.getElementById('ace-user-data').style.fontSize='14px';
/* */
$('#vm-details-cidata-save').click(function(e) {
$.ajax({
type: 'POST',
url: $(this).parents("form").prop('action'),
data: $('#resource-cidata-form').serialize(),
success: function(data, textStatus, xhr) {
if(data.success) {
$('a[href="#activity"]').trigger("click");
} else {
addMessage(data.messages.join("<br />"), "danger");
}
$("#vm-details-resources-save i").removeClass('fa-refresh fa-spin').addClass("fa-floppy-o");
},
error: function(xhr, textStatus, error) {
$("#vm-details-resources-save i").removeClass('fa-refresh fa-spin').addClass("fa-floppy-o");
if (xhr.status == 500) {
addMessage("500 Internal Server Error", "danger");
} else {
addMessage(xhr.status + " Unknown Error", "danger");
}
}
}); });
var user_data = ace.edit('ace-user-data', {
e.preventDefault() mode: "ace/mode/yaml", useWorker: false,
}) selectionStyle: "text" });
var textarea_user = $('textarea[name="ci_user_data"]');
user_data.getSession().setValue(textarea_user.val())
user_data.getSession().on("change", function () {
textarea_user.val(user_data.getSession().getValue());
});
meta_data.session.setTabSize(4);
meta_data.session.setUseSoftTabs(true);
user_data.session.setTabSize(4);
user_data.session.setUseSoftTabs(true);
document.getElementById('ace-meta-data').style.fontSize='14px';
document.getElementById('ace-user-data').style.fontSize='14px';
/* */
$('#vm-details-cidata-save').click(function(e) {
$.ajax({
type: 'POST',
url: $(this).parents("form").prop('action'),
data: $('#resource-cidata-form').serialize(),
success: function(data, textStatus, xhr) {
if(data.success) {
$('a[href="#activity"]').trigger("click");
} else {
addMessage(data.messages.join("<br />"), "danger");
}
$("#vm-details-resources-save i").removeClass('fa-refresh fa-spin').addClass("fa-floppy-o");
},
error: function(xhr, textStatus, error) {
$("#vm-details-resources-save i").removeClass('fa-refresh fa-spin').addClass("fa-floppy-o");
if (xhr.status == 500) {
addMessage("500 Internal Server Error", "danger");
} else {
addMessage(xhr.status + " Unknown Error", "danger");
}
}
});
e.preventDefault()
})
}
/* save resources */ /* save resources */
$('#vm-details-resources-save').click(function(e) { $('#vm-details-resources-save').click(function(e) {
var error = false; var error = false;
......
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