/* globals $, urls, updateEnabled */ (function () { var origData; var setupButtonClickOnRefreshedProperties = function () { $('#formRefreshCAS button').on('click', function (e) { e.preventDefault(); // Show the refreshModal var myModal = $('#refreshModal').modal({ keyboard: false, backdrop: 'static' }); var primaryButton = myModal.find('.modal-footer button.btn-primary'); // Disable the primary button primaryButton.prop('disabled', true).text('Refreshing...'); $.post(e.target.parentNode.action, function (data) { if (data.length !== 0) { $('#refreshModal-label').text('Refreshed Properties'); myModal.find('.modal-content .modal-body').html( '
' + data + '' + '
Click "OK" to reload page.
' ); } else { myModal.find('.modal-header .modal-title').text('Properties Refreshed'); myModal.find('.modal-content .modal-body').html( 'Click "OK" to reload page.
' ); } }) .done(function () { primaryButton.prop('disabled', false).text('Reload page').on('click', function (e) { e.preventDefault(); window.location.reload(); }); }) .fail(function (jqXHR) { $('#refreshModal-label').text('Problem With Refreshing Properties'); myModal.find('.modal-content .modal-body').html( '' + item + '
',
'value': '' + json[item] + ''
});
}
return returnData;
}
},
'columns': [
{'data': 'key', 'className': 'col-xs-6 key'},
{'data': 'value', 'className': 'col-xs-6 value'}
],
'pageLength': 50
});
};
var getRowData = function (row) {
var tds = row.find('td');
var tmp = {};
$.each(tds, function (i) {
if (i % 2 === 0) {
tmp.key = $(this).text();
} else {
tmp.value = $(this).text();
}
});
return tmp;
};
var editTable = function () {
$('#viewConfigsTable').editableTableWidget({editor: $('